Appending Yesterday's date to a file extension using JCL



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Appending Yesterday's date to a file extension using JCL

Postby rajas.abcdefg » Thu Jul 09, 2009 9:21 pm

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.
rajas.abcdefg
 
Posts: 38
Joined: Thu Jul 09, 2009 8:56 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby MrSpock » Thu Jul 09, 2009 9:32 pm

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.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

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

Postby dick scherrer » Fri Jul 10, 2009 1:19 am

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 . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby expat » Fri Jul 10, 2009 11:56 am

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
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

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

Postby rajas.abcdefg » Fri Jul 10, 2009 7:38 pm

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..
rajas.abcdefg
 
Posts: 38
Joined: Thu Jul 09, 2009 8:56 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby rajas.abcdefg » Fri Jul 10, 2009 10:27 pm

Plz share your ideas in achieving the requirement.
rajas.abcdefg
 
Posts: 38
Joined: Thu Jul 09, 2009 8:56 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby MrSpock » Sat Jul 11, 2009 12:19 am

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?
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

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

Postby MAINFRAME GURU » Sat Jul 11, 2009 1:33 am

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
MAINFRAME GURU
 
Posts: 18
Joined: Fri Jul 10, 2009 8:41 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Sat Jul 11, 2009 1:46 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby MAINFRAME GURU » Sat Jul 11, 2009 2:53 am

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..
MAINFRAME GURU
 
Posts: 18
Joined: Fri Jul 10, 2009 8:41 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post