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

JES2/3, JCL, utilities.
Previous topicNext topic

Topic Author
ShilpiSRE
Registered Member
Posts: 21
Joined: Sat Aug 17, 2013 12:28 pm
Zodiac: Pisces

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

Post by ShilpiSRE » Tue Jul 05, 2016 1:35 pm

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: 580
Joined: Wed Apr 23, 2014 8:45 pm

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

Post by nicc » Tue Jul 05, 2016 1:45 pm

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


Topic Author
ShilpiSRE
Registered Member
Posts: 21
Joined: Sat Aug 17, 2013 12:28 pm
Zodiac: Pisces

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

Post by ShilpiSRE » Tue Jul 05, 2016 4:25 pm

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: 1331
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

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

Post by Robert Sample » Tue Jul 05, 2016 6:20 pm

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




Topic Author
ShilpiSRE
Registered Member
Posts: 21
Joined: Sat Aug 17, 2013 12:28 pm
Zodiac: Pisces

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

Post by ShilpiSRE » Fri Jul 08, 2016 11:25 am

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: 1331
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

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

Post by Robert Sample » Fri Jul 08, 2016 3:08 pm

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

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.




Topic Author
ShilpiSRE
Registered Member
Posts: 21
Joined: Sat Aug 17, 2013 12:28 pm
Zodiac: Pisces

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

Post by ShilpiSRE » Sat Jul 16, 2016 12:24 pm

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
Zodiac: Capricorn

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

Post by raazankeet » Fri Jul 14, 2017 11:55 pm

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 :)



Previous topicNext topic

Return to “JCL - Job Control Language.”