View previous topic :: View next topic |
Author |
Message |
star09 Beginner
Joined: 04 Jun 2004 Posts: 2 Topics: 1
|
Posted: Fri Jun 04, 2004 3:52 am Post subject: How to assign a dynamic datasetname-based on month and year |
|
|
Hi everyone,
I'm a newbie to the mainframe world and going through the posts and information in this forum has indeed helped me a lot in my work.
I was hoping someone could share his/her idea on how I'd be able to assign a dynamic datasetname(based on processing month and date) to a sequential file.
Some Details:
I have a jcl that will execute a Cobol Program. This Cobol Program will first select data from a Table to get some date related info. This date info will determine the month and year that the Cobol program is going to process (june 2004 for example).
An output sequential file will be produced by this program.
Now this output sequential file needs to have a dynamic datasetname,
something like...
DSN=MYFILE.JUNE.2004.
A colleague recommends that I could define the dsn to be
DSN=MYFILE.D&YYYYMM to append the system current date to the filename.
However, our processing is on a "month-after" basis, that is the June data will be processed on July. If I use the option above,then my filename will become MYFILE.200407 which is not the appropriate name for June file.
Is there a way where I could pass parameter/s(processing date-related) from the COBOL program to the JCL and then use these parameter/s in the "DSN=" line in JCL for me to have a dynamic datasetname.
Thanks in advance.
star
p.s.
I chanced upon a somewhat related post:
http://www.mvsforums.com/helpboards/viewtopic.php?t=654&highlight=dynamic+dsn
however,the last entry tells about hard coding the symbolics in the jcl which is not a desired option for our client.
-ditto- |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Jun 04, 2004 4:19 am Post subject: |
|
|
Star09,
You can try any of the following methods to achieve the desired results.
1. Use dynamic allocation using BPXWDYN to allocate the file with the month and year name
2. Add another step at the end which will rename the output dataset from the cobol pgm
3. Use translator pgm EZACFSM1 to create the dataset with month name and year
4. Use a GDG
Examples for 1 & 3 you can search the application programming forum and JCL forum respectively
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Fri Jun 04, 2004 9:06 am Post subject: |
|
|
star, since the COBOL program is going to have to determine the appropriate date for the dataset, and to make things relatively simple, why not have the program create a SYSIN card for an IDCAMS step. The SYSIN could be either a REPRO command or an ALTER command:
COBOL output card:
Code: |
REPRO INF(SYSUT1) ODS('MY.INPUT.DATASET.NEWNAME')
//IDCAMS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MY.INPUT.DATASET,DISP=SHR
//SYSIN DD DSN=COBOL.SYSIN.CARD,DISP=SHR
|
OR
COBOL output card:
Code: |
ALTER 'MY.INPUT.DATASET' NEWNAME('MY.INPUT.DATASET.NEWNAME')
//IDCAMS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD DSN=COBOL.SYSIN.CARD,DISP=SHR
|
|
|
Back to top |
|
|
star09 Beginner
Joined: 04 Jun 2004 Posts: 2 Topics: 1
|
Posted: Mon Jun 07, 2004 1:49 am Post subject: |
|
|
Hi Kolusu and superk,
Thank you very much for the quick response.
Both your inputs are great!
Since our shop don't have both
BPXWDYN and EZACFSM1, I applied superk's advise instead to make use of IDCAMS to repro/alter the filename.
Thanks again.
star09 |
|
Back to top |
|
|
|
|