Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Pass Information from Cobol to JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ambrish

New User


Joined: 30 Apr 2010
Posts: 2
Location: Noida

PostPosted: Mon May 03, 2010 1:47 pm    Post subject: Pass Information from Cobol to JCL
Reply with quote

How can we pass a string from COBOL to JCL and then use that string in creating dataset of that name in JCL ?
I need to create a dataset in JCL at runtime using the file name supplied by the COBOL program.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon May 03, 2010 2:51 pm    Post subject: Reply to: Pass Information from Cobol to JCL
Reply with quote

You can't, since JCL is not a programming language and does not take parameters. Not to mentiona that once the JCL has been submitted to the internal reader and scheduled for execution, any variables it contains have alredy been resolved and cannot be changed during execution.

I'd suggest that you re-think your design. Maybe you can allocate that dataset within your program instead. Or, maybe your program can create a new job with that dataset name, to run after the current job finishes.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Mon May 03, 2010 2:57 pm    Post subject:
Reply with quote

Hi,

You can not pass a string from COBOL to JCL. Have that string, ie, data set name(along with a part of ALLOC DSNAME statement) in data set and use it in next step(IDCAMS) for creating another data set.

Code:

//.....
//..... COBOL step
//STEP0100 EXEC PGM=IDCAMS                     
//SYSPRINT DD SYSOUT=*                         
//SYSIN    DD DISP=SHR,DSN=GNANAS.TEST.PS     
//         DD *                                 
 NEW CATALOG -                                 
 SPACE(1,1) TRACKS -                           
 BLKSIZE(0) -                                   
 LRECL(80) -                                   
 DSORG(PS) -                                   
 RECFM(F,B)                                     
/*     


GNANAS.TEST.PS is created from COBOL prog as below. You can have this as Temp data set.

Code:
 EDIT       GNANAS.TEST.PS                                 Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000001  ALLOC DSNAME('GNANAS.TEST.DSTEST') -                                 
 ****** **************************** Bottom of Data ****************************

So, STEP0100 creates GNANAS.TEST.DSTEST data set.

Please let me know if this works for you.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 03, 2010 3:53 pm    Post subject: Re: Pass Information from Cobol to JCL
Reply with quote

ambrish wrote:
How can we pass a string from COBOL to JCL and then use that string in creating dataset of that name in JCL ?
I need to create a dataset in JCL at runtime using the file name supplied by the COBOL program.

Try understanding what Superk wants to say about JCL..
You can dynamically allocate dataset in cobol itself using BPXWDYN (but I won't recommend that)
There are couple of examples in the forum on it.

I feel you, should tell your original problem statement for which you have thought of this design and asked here how to do\achieve it(...
Back to top
View user's profile Send private message
ambrish

New User


Joined: 30 Apr 2010
Posts: 2
Location: Noida

PostPosted: Mon May 03, 2010 6:26 pm    Post subject: Reply to: Pass Information from Cobol to JCL
Reply with quote

@Gnana Sekaran Nallathambi
Thanks sir the solution was great and it worked.

Thanks everyone else for posting the reply. It was very helpful icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us