Page 1 of 1

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

Posted: Tue Jul 05, 2016 1:35 pm
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.

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

Posted: Tue Jul 05, 2016 1:45 pm
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.

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

Posted: Tue Jul 05, 2016 4:25 pm
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 ...

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

Posted: Tue Jul 05, 2016 6:20 pm
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).

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

Posted: Fri Jul 08, 2016 11:25 am
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.

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

Posted: Fri Jul 08, 2016 3:08 pm
by Robert Sample
Check the manual on CA DRIVER.  CA-7 supports what you want to do.

[ Post made via iPhone ] Image

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

Posted: Fri Jul 08, 2016 3:40 pm
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

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

Posted: Sat Jul 16, 2016 12:24 pm
by ShilpiSRE
Thanks but I think we are not yet on zOS 2.2.

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

Posted: Fri Jul 14, 2017 11:55 pm
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 :)