How to put year as last qualifier of dataset using a job?

JES2/3, JCL, utilities.
Post Reply
ShilpiSRE
Registered Member
Posts: 23
Joined: Sat Aug 17, 2013 12:28 pm

How to put year as last qualifier of dataset using a job?

Post by ShilpiSRE »

Hi,

I need help to develop a method to append the year as the last qualifier of the file name. The requirement islike that the job should create the ouput files with year as the last qualifier. So in example form if the file name is like some.file then the job should be able to create a file name like some.file.Y2016.

How can I do that, can you please help.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: How to put year as last qualifier of dataset using a job?

Post by nicc »

Have you searched (either the forum or Google) for something like "include date in data set name"? And it is a data set not a file. Files are on PCs and UNIX. Data in a data set is structured - not simply a string of bytes with the odd (CR)LF and EOF marker.
Regards
Nic
ShilpiSRE
Registered Member
Posts: 23
Joined: Sat Aug 17, 2013 12:28 pm

Re: How to put year as last qualifier of dataset using a job?

Post by ShilpiSRE »

Have done some search on this and I have a solution which is like this. But it is in two parts.

In this first step I run the following job.

Code: Select all

//STEP001    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=MY.PDS(INMEM),DISP=SHR                    
/*                                                                     
//SORTOUT  DD DSN=MY.PDS(OMEM),DISP=OLD                    
//SYSIN    DD  *                                                       
 SORT FIELDS=COPY                                                     
 OUTREC OVERLAY=(1:1,16,DATE1,21:30X)                                 
/*                                                                    
and I get

Code: Select all

//SET1 SET YEAR=2013
in OMEM.

I run the second job with OMEM as input,

Code: Select all

//       JCLLIB ORDER=MY.PDS                                
//       INCLUDE MEMBER=OMEM                                        
//STEP002  EXEC PGM=IEFBR14                                              
//DD002    DD DSN=MY.PSFILE.Y&YEAR,                                  
//           SPACE=(TRK,(10,10),RLSE),                                   
//           DISP=(MOD,DELETE,DELETE),UNIT=SYSDA                           
//STEP003    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                        
TEST
/*                                                                     
//SORTOUT  DD DSN=MY.PSFILE.Y&YEAR,                                
//           SPACE=(TRK,(1,1),RLSE),                                   
//            DISP=(MOD,KEEP,KEEP),UNIT=SYSDA,                         
//            DCB=(LRECL=80,RECFM=FB)                                  
//SYSIN    DD  *                                                      
 SORT FIELDS=COPY                                                     
/*
It works. But I think it can be refined for better but not sure how. I am working on it ...
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: How to put year as last qualifier of dataset using a job?

Post by Robert Sample »

Most job schedulers will do this quite easily.

If you cannot or will not use a job scheduler, you need to plan on using two jobs, or writing a program in the language of your choice to use dynamic allocation (BPXWDYN for example) to accomplish this in one job (depending upon your requirements, you may HAVE to use two jobs).
ShilpiSRE
Registered Member
Posts: 23
Joined: Sat Aug 17, 2013 12:28 pm

Re: How to put year as last qualifier of dataset using a job?

Post by ShilpiSRE »

Thanks Robert. We use CA-7 but I am not sure how to do it in CA-7. I shall check on that.

I was thinking that sort or some other utility program could do this but it is not that easy.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: How to put year as last qualifier of dataset using a job?

Post by Robert Sample »

Check the manual on CA DRIVER.  CA-7 supports what you want to do.

[ Post made via iPhone ] Image
AS@SI
New Member
Posts: 1
Joined: Tue Jul 05, 2016 10:29 pm

Re: How to put year as last qualifier of dataset using a job?

Post by AS@SI »

Hi,
what about this (done under z/OS 2.2):

Code: Select all

//jobcard
//       SET MYYEAR=&YR4                                       
//STEP     EXEC PGM=IEFBR14                                    
//FILE01   DD DSN=&SYSUID..Y&MYYEAR..TEST,                     
//            DISP=(NEW,CATLG,DELETE),                         
//            UNIT=SYSDA,                                      
//            SPACE=(CYL,(10,10),RLSE),                        
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=27920)            
//                                 

Greetings,
Andy
Last edited by Anuj Dhawan on Sat Jul 16, 2016 12:25 pm, edited 1 time in total.
Reason: Added code tags.
ShilpiSRE
Registered Member
Posts: 23
Joined: Sat Aug 17, 2013 12:28 pm

Re: How to put year as last qualifier of dataset using a job?

Post by ShilpiSRE »

Thanks but I think we are not yet on zOS 2.2.
raazankeet
New Member
Posts: 5
Joined: Wed Jul 06, 2016 8:59 pm

Re: How to put year as last qualifier of dataset using a job?

Post by raazankeet »

Hi,
You may use the below JCL

Code: Select all

//STEP01 EXEC PGM=EZACFSM1                          
//SYSOUT DD  DSN=&&CTRL,DISP=(,PASS),               
//       SPACE=(CYL,(1,1),RLSE)                     
//SYSIN DD DSN=TSUE34S.ANKIT.NEW(CRTLCRD),DISP=SHR  
//*                                                 
//STEP02 EXEC PGM=IKJEFT01                          
//SYSTSPRT DD SYSOUT=*                              
//SYSOUT   DD SYSOUT=*                              
//SYSTSIN  DD DSN=&&CTRL,DISP=SHR                   
The content of TSUE34S.ANKIT.NEW(CRTLCRD) is

Code: Select all

TSUE34S.ANKIT.NEW(CRTLCRD)
 ===>                                                
ALLOC  DA('TSUE34S.ANKIT.Y&LYR4') NEW DSORG(PS)    + 
SPACE(2,0) TRACKS  LRECL(80) BLKSIZE (800) RECFM(F,B)
**************************** Bottom of Data *********
After running the above JCL dataset TSUE34S.ANKIT.Y2017 was created which is blank. You may change the attributes as per your requirement. You can also copy content to it by modifying the control card or using SMCOPY in the worst case scenario :)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”