View previous topic :: View next topic |
Author |
Message |
stewchicken Beginner
Joined: 25 Oct 2008 Posts: 3 Topics: 1
|
Posted: Sun Oct 26, 2008 5:19 pm Post subject: Is it possible to pass numerics via SYSIN to COBOL's ACCEPT? |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Oct 27, 2008 5:43 am Post subject: |
|
|
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 |
|
 |
stewchicken Beginner
Joined: 25 Oct 2008 Posts: 3 Topics: 1
|
Posted: Mon Oct 27, 2008 8:46 am Post subject: |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Oct 27, 2008 9:48 am Post subject: |
|
|
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 |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Mon Oct 27, 2008 12:18 pm Post subject: |
|
|
stewchicken,
I think the Language Reference Manual (see ACCEPT) has the answer. _________________ ....Terry |
|
Back to top |
|
 |
stewchicken Beginner
Joined: 25 Oct 2008 Posts: 3 Topics: 1
|
Posted: Mon Oct 27, 2008 5:24 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Oct 27, 2008 6:15 pm Post subject: |
|
|
stewchicken,
How did you define the receiving variable in the program? |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Tue Oct 28, 2008 4:19 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Oct 28, 2008 4:48 am Post subject: |
|
|
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 |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Tue Oct 28, 2008 7:53 am Post subject: |
|
|
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 |
|
 |
callanand Beginner

Joined: 12 Jun 2007 Posts: 23 Topics: 2
|
Posted: Thu Oct 30, 2008 10:53 am Post subject: |
|
|
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 |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Mon Nov 24, 2008 3:17 pm Post subject: |
|
|
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 |
|
 |
|
|