Page 1 of 1

to accept a value in cobol

PostPosted: Thu Jul 22, 2010 2:57 pm
by nagendra
How to accept a value for a variable, in cobol using jcl. I'm confused regarding this concept..

can any one please help me to check it out. .....

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 3:25 pm
by NicC
Well, you are not explaining it all that well. Do you mean passing a parameter from JCL to COBOL? If so, (1) - look up how to code a parameter on the EXEC PGM= statement in the JCL manual and (2) - look up how to code the variable it is to be stored in in the Cobol program. I think it is in the LINKAGE SECTION. Your PROCEDURE DIVISION will need the USING keyword.

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 3:59 pm
by nagendra
NicC wrote:Well, you are not explaining it all that well. Do you mean passing a parameter from JCL to COBOL? If so, (1) - look up how to code a parameter on the EXEC PGM= statement in the JCL manual and (2) - look up how to code the variable it is to be stored in in the Cobol program. I think it is in the LINKAGE SECTION. Your PROCEDURE DIVISION will need the USING keyword.



yaa, k thanx..

but my question was...

when we are compiling cobol programs through jcl,

then if i m giving accept command it is saying some internal errors...

so, how to solve this problem.......

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 4:05 pm
by NicC
You are having compile problems? You did not say that before, you inferred that you were trying to receive into your program a value passed through the JCL parameter and didn't know how to code it. You should post your error messages and the piece of code that it refers to.

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 4:38 pm
by Robert Sample
1. Use the ACCEPT verb -- but be aware that ACCEPT is generally not allowed in production programs at most sites.

2. Use a DD name, allocate the file, and OPEN / READ / CLOSE the file like normal.

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 4:55 pm
by nagendra
thanx a lot..

i got a solution here, by just.. testing and by the suggestion given by. mr.ramesh..


well thanx a lot for.... suggesting me....


i just cleard one concept....

thanx a lot...

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 5:00 pm
by nagendra
this was my question...........................
...................................................

I checkd every thing...

if i m just initialising the variable and then compiling the cobol program through jcl naa

its successful, maxcc=0, and output is also correct..

if in case of initialising if i m just declaring it in working storage section,

and then i m trying for accepting the value in procedure section as,

accept a.

then here in case of accept, its giving error.....

why this is not compiling correct.

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 5:02 pm
by NicC
Possibly because you are not ACCEPTing FROM but I am not sure about this for parms from the JCL.

Re: to accept a value in cobol

PostPosted: Thu Jul 22, 2010 5:16 pm
by Robert Sample
Why not post the actual lines of code and error message with the message number on the front of it so we know exactly what you're getting? With all due respect, actual output from the computer is vastly better than your word about what is happening. And please use the Code button when posting this information so spaces are preserved!