MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is it possible to pass numerics via SYSIN to COBOL's ACCEPT?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
stewchicken
Beginner


Joined: 25 Oct 2008
Posts: 3
Topics: 1

PostPosted: Sun Oct 26, 2008 5:19 pm    Post subject: Is it possible to pass numerics via SYSIN to COBOL's ACCEPT? Reply with quote

hello

my cobol program need 3 numerics via accept.
but i need to use jcl to call this cobol

therefore i try to pass those 3 numerics via SYSIN from JCL to cobol
but it failed , below is how i did it. is there any way to do some?

//SYSIN DD *
13068
/*
//SYSIN DD*
0.0045
/*
//SYSIN DD*
60
/*

Thanks and Rgds
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Oct 27, 2008 5:43 am    Post subject: Reply with quote

Your DDNames must be unique within a step - I think in the example you show, if the interpreter did not fail it then the last one would be the one that is used.

Why not try:

//SYSIN DD *
13068
0.0045
60

Otherwise just treat SYSIN as an ordinary file and read the 3 values.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
stewchicken
Beginner


Joined: 25 Oct 2008
Posts: 3
Topics: 1

PostPosted: Mon Oct 27, 2008 8:46 am    Post subject: Reply with quote

Hey Nic

I tried it already. but by this way will pass three values to only one accept right?
i had 3 accepts in my cobol program.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Oct 27, 2008 9:48 am    Post subject: Reply with quote

I do not know - you could try it and see what happens - or you can wait until I write a little cobol program and figure out how to replicate your query on a PC. My thought is that IF you can ACCEPT from a file (and SYSIN is just another file) then it would act like a read and after each ACCEPT it would advance the read position but unless I read the manual and/or write a little test I could not be sure.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Mon Oct 27, 2008 12:18 pm    Post subject: Reply with quote

stewchicken,
I think the Language Reference Manual (see ACCEPT) has the answer.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
stewchicken
Beginner


Joined: 25 Oct 2008
Posts: 3
Topics: 1

PostPosted: Mon Oct 27, 2008 5:24 pm    Post subject: Reply with quote

hey,

but seems the vaule passed by SYSIN will be automatically padded if it is shorter than
variable defined in COBOL.

how do I solve this problem?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Oct 27, 2008 6:15 pm    Post subject: Reply with quote

stewchicken,

How did you define the receiving variable in the program?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Oct 28, 2008 4:19 am    Post subject: Reply with quote

The manual seems to say that ACCEPT will, in one invocation, read the entire file, conatenating the records together into the receiving field. In this case you have 3 * 80 byte records (SYSIN DD * records are 80 bytes) so you will need a 240 byte receiving field. How you extract your data from there is standard COBOL - you could REDEFINE as 3 x 80 byte records and extract the required number of byytes from column 1 for each record.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Oct 28, 2008 4:48 am    Post subject: Reply with quote

At this point one would think that the ACCEPT verb is not the proper verb to use.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Oct 28, 2008 7:53 am    Post subject: Reply with quote

Quote:
my cobol program need 3 numerics via accept.


Why? I'm with dbz. Explain why this needs to be done with an ACCEPT.
Back to top
View user's profile Send private message
callanand
Beginner


Joined: 12 Jun 2007
Posts: 23
Topics: 2

PostPosted: Thu Oct 30, 2008 10:53 am    Post subject: Reply with quote

I too would wonder why 3 ACCEPT is required. If there are 3 numerics to be picked up from SYSIn then define a working storage like this
ws-sysin.
ws-num1 pic x(80).
ws-num2 pic x(80).
ws-num3 pic x(80).
and the jcl like this
//sysin dd *
1234
5678
9810
/*

once you use accept ws-sysin in your cobol pgm, you can use standard cobol features to get the numeric part and remove spaces.
Back to top
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Mon Nov 24, 2008 3:17 pm    Post subject: Reply with quote

Hi Stew,

I guess you're long gone, but for posterity's sake and for those future searchers w/a similar ques:

Each line in your SYSIN will require an ACCEPT stmt in your pgm unless you want to string them left to right on the same line (not a good idea, unless you want to conserve on ACCEPTs).

While your SYSIN values are numbers they won't be treated as "numerics" by ACCEPT, in spite of a numeric PIC in the pgm. Your "60" will become "60bbb" in a PIC 9(05) in your pgm, giving you an 0C7 when you try to arith it.

One approach is to us the FUNCTION NUMVAL after the ACCEPT to create a true numeric image of the SYSIN input.
_________________
Regards, Jack.

"A problem well stated is a problem half solved" -- Charles F. Kettering
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group