IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Pass Information from Cobol to JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Mon May 03, 2010 2:51 pm
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: 792
Location: Chennai, India

PostPosted: Mon May 03, 2010 2:57 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top