MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to assign a dynamic datasetname-based on month and year

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
star09
Beginner


Joined: 04 Jun 2004
Posts: 2
Topics: 1

PostPosted: Fri Jun 04, 2004 3:52 am    Post subject: How to assign a dynamic datasetname-based on month and year Reply with quote

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. Smile

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
Smile

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Fri Jun 04, 2004 4:19 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Fri Jun 04, 2004 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message
star09
Beginner


Joined: 04 Jun 2004
Posts: 2
Topics: 1

PostPosted: Mon Jun 07, 2004 1:49 am    Post subject: Reply with quote

Hi Kolusu and superk,

Thank you very much for the quick response.
Both your inputs are great! Smile

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.
Smile
star09
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group