Page 1 of 2

Appending Yesterday's date to a file extension using JCL

PostPosted: Thu Jul 09, 2009 9:21 pm
by rajas.abcdefg
Hi All,

Could you please help me in achieving the following requirement.

My file which generates today needs to have an extension of yesterday's date, for eg. ABCD.XYZ.G0001V00 is my actual file name. I want this file to be copied to a new file which looks like ABCD.XYZ.AMMDDYY (MM-MONTH, DD-YESTEDAY'S DATE, YY-YEAR).

Please help me in acheiving strictly using JCL.

Thanks a bunch in advance...


Thanks
Raj.

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Thu Jul 09, 2009 9:32 pm
by MrSpock
rajas.abcdefg wrote:Please help me in acheiving strictly using JCL.


I have to presume then that you'll be getting this value for the date from .... where? The job scheduling system? If so, then I think we'd need to know what scheduling system you use.

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Fri Jul 10, 2009 1:19 am
by dick scherrer
Hello,

Please help me in acheiving strictly using JCL.
A very large number of new people are being taught a horrible concept - that jcl can actually "do things". JCL primarily executes programs or PROCedures (which eventually execute programs).

By itself it cannot do date arithmetic, data conversion, or any other processing. The executed program(s) actually accomplish "things". . .

It would be wonderful if we could find the perpetrators who spread this misunderstanding and re-direct them. . . Not likely, but surely would be a good thing . . .

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Fri Jul 10, 2009 11:56 am
by expat
But you are already using a GDG, why the urgent need to create a different copy of the dataset with a different name

Also, file extension is not a mainframe term. The correct term is dataset name
Please use the correct terms when posting as it cuts down on confusion which could lead to an incorrect solution

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Fri Jul 10, 2009 7:38 pm
by rajas.abcdefg
Thanks for the comments.

I wil take care of using the correct terms while posting the queries.

To answer the queries:

1. No restrictions in the way of date generation. I mean my job needs to generate the yesterday's date dynamically during job submission and need to append the same for the new dataset.

2. I need to take the back of files with date as extension in the dataset name, so that I can reach the correct data set on the required date.

Thanks in advance



Thanks
Raj..

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Fri Jul 10, 2009 10:27 pm
by rajas.abcdefg
Plz share your ideas in achieving the requirement.

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Sat Jul 11, 2009 12:19 am
by MrSpock
Don't have enough details to work on yet. Read my first reponse. What will you be using to perform the calculation of Yesterday's Date?

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Sat Jul 11, 2009 1:33 am
by MAINFRAME GURU
Hi Raja,

In order to achieve this, one cobol/cobol|| program needs to be written which will create a control/parm member say MEMBER1 to generate the below code:

//SYSUT1   DD  DSN=ABCD.XYZ(0),           
//             DISP=SHR                                 
//SYSUT2   DD DSN=ABCD.XYZ.AMMDDYY,DISP=(NEW,CATLG,DELETE),
//           SPACE=<SAME AS OF ABCD.XYZ(0)>,                     
//           DCB=*.SYSUT1



Once it is done then you need to two steps to your JCL, which are as follows:

1. To execute the above program
2. IEBGENER step to copy the data from ABCD.XYZ(0) to ABCD.XYZ.AMMDDYY. Step is given below:

//STEPN    EXEC PGM=IEBGENER
//STATOUT  DD SYSOUT=*       
//SYSPRINT DD SYSOUT=*       
//SYSUDUMP DD SYSOUT=*       
//SYSIN    DD DUMMY         
//SYSOUT   DD SYSOUT=*       
//DSN1     DD DSN=LOCATION1(MEMBER1),DISP=SHR

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Sat Jul 11, 2009 1:46 am
by dick scherrer
Hello and welcome to the forum,

MAINFRAME GURU
Perhaps someday. . . Not yet. . . :)

Did you test this "solution" before posting it? DSN1 and LOCATION1 are not part of IEBGENER. . . Actually LOCATION1 is an invalid dataset name. . .

Please do not post untested solutions.

Re: Appending Yesterday's date to a file extension using JCL

PostPosted: Sat Jul 11, 2009 2:53 am
by MAINFRAME GURU
dick scherrer wrote:Hello and welcome to the forum

MAINFRAME GURU
Perhaps someday. . . Not yet. . .

Did you test this "solution" before posting it? DSN1 and LOCATION1 are not part of IEBGENER. . . Actually LOCATION1 is an invalid dataset name. . .

Please do not post untested solutions.


Thanks for your warm welcome my friend!!

Yes, you are right...

Correction:

Program needs to be written to write a dynamic Proc instead of parm...

Here is the code for the same

//STEP1    EXEC PGM=IEBGENER
//STATOUT  DD SYSOUT=*       
//SYSPRINT DD SYSOUT=*       
//SYSUDUMP DD SYSOUT=*       
//SYSIN    DD DUMMY         
//SYSOUT   DD SYSOUT=*       
//SYSUT1   DD  DSN=ABCD.XYZ(0),           
//             DISP=SHR                                 
//SYSUT2   DD DSN=ABCD.XYZ.AMMDDYY,DISP=(NEW,CATLG,DELETE),
//           SPACE=<SAME AS OF ABCD.XYZ.G0001V00>,     
//           UNIT=SYSDA,               
//           DCB=*.SYSUT1


I do agree with you on DSN1....However, LOCATION1 is not the exact location...it can be any valid location like abx.xyz.xyz etc...

I should have written <location1> instead of that.

I will take care of tested solutions going forward

Hope it works for you Raja..

Regards..