Values from JCL to Cobol subroutine



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Values from JCL to Cobol subroutine

Postby rambachi2000 » Sat May 28, 2011 3:43 pm

Hi All,

How to pass values from JCl to cobol subroutine, if want to pass date value from JCL to subroutine without changing main program.
rambachi2000
 
Posts: 9
Joined: Fri Mar 18, 2011 11:14 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Values from JCL to Cobol subroutine

Postby steve-myers » Sat May 28, 2011 3:49 pm

JCL communicates parameter data only to a "main" program. What you propose cannot be done.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Values from JCL to Cobol subroutine

Postby BillyBoyo » Sat May 28, 2011 5:03 pm

Although you haven't said exactly what you want to do, one possibility would be to put the data your require into a dataset and then read that dataset in the sub-program. As Steve says, you can't specify PARM in the JCL and have your sub-program get access to it, unless the main-program specifically includes it on the USING of the CALL to the sub-program.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Values from JCL to Cobol subroutine

Postby rambachi2000 » Sat May 28, 2011 5:21 pm

Can we pass the data through sysin card in JCL to subroutine..?
rambachi2000
 
Posts: 9
Joined: Fri Mar 18, 2011 11:14 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Values from JCL to Cobol subroutine

Postby Robert Sample » Sat May 28, 2011 5:26 pm

Use ACCEPT.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Values from JCL to Cobol subroutine

Postby BillyBoyo » Sat May 28, 2011 5:28 pm

Yes. SYSIN is just a DD statement. If your main-program is not reading SYSIN, then your sub-program could.

However, things would be much clearer for maintenance if you create a new DD for your sub-program to read. People won't expect SYSIN to be read in a sub-program, so will waste time investigating why it is in the JCL and not used by the main-program, then remove it from the JCL and have the sub-program not work.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Values from JCL to Cobol subroutine

Postby rambachi2000 » Sat May 28, 2011 6:00 pm

thanks Billy, Robert and Steve
rambachi2000
 
Posts: 9
Joined: Fri Mar 18, 2011 11:14 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Values from JCL to Cobol subroutine

Postby rambachi2000 » Sat May 28, 2011 6:15 pm

if subroutine is using 10 times in the same main program then how to code sysin card in jcl..?
do I need to repeat the values 10 times in sysin..?
rambachi2000
 
Posts: 9
Joined: Fri Mar 18, 2011 11:14 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Values from JCL to Cobol subroutine

Postby enrico-sorichetti » Sat May 28, 2011 6:37 pm

then it would be wise to organize the subroutine in order to read the parameters only once
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Values from JCL to Cobol subroutine

Postby BillyBoyo » Sat May 28, 2011 9:32 pm

rambachi2000 wrote:if subroutine is using 10 times in the same main program then how to code sysin card in jcl..?
do I need to repeat the values 10 times in sysin..?


No, as enrico has said. In the sub-routine, only read the data (you have, unwisely to my mind, chosen to go with SYSIN) once, then store it for use that time and the remaining times that the sub-routine is called.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post