View previous topic :: View next topic
|
Author |
Message |
ambrish
New User
Joined: 30 Apr 2010 Posts: 2 Location: Noida
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
ambrish
New User
Joined: 30 Apr 2010 Posts: 2 Location: Noida
|
|
|
|
@Gnana Sekaran Nallathambi
Thanks sir the solution was great and it worked.
Thanks everyone else for posting the reply. It was very helpful |
|
Back to top |
|
|
|