How to put year as last qualifier of dataset using a job?
How to put year as last qualifier of dataset using a job?
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.
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?
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
Nic
Re: How to put year as last qualifier of dataset using a job?
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.
and I get
in OMEM.
I run the second job with OMEM as input,
It works. But I think it can be refined for better but not sure how. I am working on it ...
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)
/*
Code: Select all
//SET1 SET YEAR=2013
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
/*
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: How to put year as last qualifier of dataset using a job?
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).
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?
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.
I was thinking that sort or some other utility program could do this but it is not that easy.
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: How to put year as last qualifier of dataset using a job?
Check the manual on CA DRIVER. CA-7 supports what you want to do.
[ Post made via iPhone ]
[ Post made via iPhone ]

Re: How to put year as last qualifier of dataset using a job?
Hi,
what about this (done under z/OS 2.2):
Greetings,
Andy
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)
//
Andy
Last edited by Anuj Dhawan on Sat Jul 16, 2016 12:25 pm, edited 1 time in total.
Reason: Added code tags.
Reason: Added code tags.
Re: How to put year as last qualifier of dataset using a job?
Thanks but I think we are not yet on zOS 2.2.
-
- 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?
Hi,
You may use the below JCL
The content of TSUE34S.ANKIT.NEW(CRTLCRD) is
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 
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
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 *********

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