How to access creation date of PS file in a JCL program?



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

Re: How to access creation date of PS file in a JCL program?

Postby Akatsukami » Sun Dec 11, 2011 8:43 pm

Find a colleague who knows Rexx. This may require admitting that you don’t know Rexx; if so, try to bear up under the humiliation.

Have a Rexx exec written that uses LISTCAT to list the generations of the GDG with their creation dates (if none of your colleagues actually know Rexx – as opposed to having put it on their résumés because slipping that past an incompetent recruiter got them an extra Rs. 10,000/year – look on our sister forum for examples. Search on “GDG Rexx” (click on the radio button to use all the search terms instead of any of them), and don’t bother to lie to us that you got no hits). OUTTRAP the LISTCAT output to a stem variable and parse it for the dates. Write the absolute generations for the target dates to another stem variable. Fabricate – either through tailoring an ISPF skeleton or, if you really must, writing JCL out of the exec – one or more (if you have more than 255 data sets) jobs using IEBGENER to copy the data sets to tape (hint: allocate the output data set on SYSUT2 to UNIT=TAPE, or whatever esoteric name your site uses). Submit the job(s) from the exec.

Brag to your managers about how you thought of this all by your lonesome and how you’re so sharp that it’s all you can do to keep from cutting yourself.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: How to access creation date of PS file in a JCL program?

Postby skankatala » Sun Dec 11, 2011 9:41 pm

BillyBoyo wrote:OK, if you can't write Cobol I'd rule that one out anyway. Never much of a front-runner.

If you do a LISTCAT of your GDG (that's with some JCL with EXEC PGM=IDCAMS) you'll get some listing output showing you information about all the datasets belonging to your GDG. You will be able to see which ones you need.

When you say you need them on tape, how do you need them? Seperate datasets? Or all the data together as one dataset?

You could start with a visual/manual process (you run the LISTCAT, look at the output, amend for that day's data) and then consider how to automate it.

What do you need to do with the data afterwards? Are you actually "backing-up" the data, or do you want to be able to use it directly?

Even if you can't visit the technical people, are you allowed to make a 'phone call, or send an e-mail?


I need tape datasets seperately, We use these files as input to other jcls which we run for every coulple of weeks, sometimes once in a week. We can't meet those people either through call or email.
skankatala
 
Posts: 42
Joined: Sun Dec 11, 2011 9:45 am
Location: Hyderabad
Has thanked: 0 time
Been thanked: 0 time

Re: How to access creation date of PS file in a JCL program?

Postby NicC » Sun Dec 11, 2011 9:43 pm

No JCL does not do it - all JCL does is tell the operating system which programs you want to run, in which order, and if any are to be skipped if previous programs give a certain return code and the JCL lets the operating system know what resources e.g. datasets these programs need allocated to start with (a program may dynamically allocate other datasets that it need e.g. ADRDSSU will 'allocate' the datasets that it is going to back up).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to access creation date of PS file in a JCL program?

Postby BillyBoyo » Mon Dec 12, 2011 3:54 am

Here is something which might get you going. First thing in the morning, find out the latest generation of the gdg that you want copied. Amend something like this for ddnames in pairs, change the generation part of the gdg name for each which you need to copy. The first time, you need "start" and "end" generation numbers, the following day your new start is the previous end plus one. You then need one COPY operator, with the correct ddnames, for each you want to copy.

You do it manually to get you going, while you look for a method to automate it. You could, generate the JCL/control cards from SORT and output to a dataset for you to EDIT and SUBMIT as a first step in that.

You choice of whether you have multiple datasets per volume, or multiple volumes with a single dataset. Sort of your choice. Someone will contact you if you make the wrong choice.


//COPYGDG EXEC PGM=ICETOOL       
//SYSOUT DD SYSOUT=*             
//TOOLMSG DD SYSOUT=*           
//DFSMSG DD SYSOUT=*             
//IGDG0001 DD dataset details of first generation to copy, say qual1.qual2.qual3.g0010v00                 
//OFIL0001 DD datset details for first tile on tape, could be a gdg name if you like           
//IGDG0002 DD  dataset details of second generation to copy, say qual1.qual2.qual3.g0011v00                 
//OFIL0002 DD datset details for second tile on tape, could be a gdg name if you like         
//SYSIN DD *                     
//TOOLIN  DD *                   
 COPY FROM(IGDG0001) TO(OFIL0001)
 COPY FROM(IGDG0002) TO(OFIL0002)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to access creation date of PS file in a JCL program?

Postby skankatala » Mon Dec 12, 2011 9:21 am

BillyBoyo wrote:Here is something which might get you going. First thing in the morning, find out the latest generation of the gdg that you want copied. Amend something like this for ddnames in pairs, change the generation part of the gdg name for each which you need to copy. The first time, you need "start" and "end" generation numbers, the following day your new start is the previous end plus one. You then need one COPY operator, with the correct ddnames, for each you want to copy.

You do it manually to get you going, while you look for a method to automate it. You could, generate the JCL/control cards from SORT and output to a dataset for you to EDIT and SUBMIT as a first step in that.

You choice of whether you have multiple datasets per volume, or multiple volumes with a single dataset. Sort of your choice. Someone will contact you if you make the wrong choice.


//COPYGDG EXEC PGM=ICETOOL       
//SYSOUT DD SYSOUT=*             
//TOOLMSG DD SYSOUT=*           
//DFSMSG DD SYSOUT=*             
//IGDG0001 DD dataset details of first generation to copy, say qual1.qual2.qual3.g0010v00                 
//OFIL0001 DD datset details for first tile on tape, could be a gdg name if you like           
//IGDG0002 DD  dataset details of second generation to copy, say qual1.qual2.qual3.g0011v00                 
//OFIL0002 DD datset details for second tile on tape, could be a gdg name if you like         
//SYSIN DD *                     
//TOOLIN  DD *                   
 COPY FROM(IGDG0001) TO(OFIL0001)
 COPY FROM(IGDG0002) TO(OFIL0002)


//STEP0100 EXEC PGM=IKJEFT01                                   
//SYSTSPRT DD DSN=&&L,                                         
//            DISP=(,PASS),                                   
//            SPACE=(CYL,(1,1),RLSE),                         
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)               
//SYSTSIN  DD *                                               
  LISTCAT ENT('YOUR GDG BASE') ALL                           
//*                                                           
//STEP0200 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SYMNAMES DD *                                               
CURRDATE,S'&LYR4..&LJDAY'                                     
//SORTIN   DD DSN=&&L,DISP=(OLD,PASS)                         
//SORTOUT  DD DSN=&&T,DISP=(,PASS),SPACE=(CYL,(1,2),RLSE)     
//SYSIN    DD *                                               
  INCLUDE COND=(04,7,CH,EQ,C'NONVSAM',OR,                     
                37,8,CH,EQ,C'CREATION')                       
                                                               
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,                         
        BEGIN=(4,7,CH,EQ,C'NONVSAM'),PUSH=(81:17,44)),         
  IFTHEN=(WHEN=(53,8,CH,EQ,CURRDATE),OVERLAY=(125:SEQNUM,3,ZD))
  SORT FIELDS=COPY                                             
                                                               
  OUTFIL IFOUTLEN=80,NULLOFL=RC4,                             
  INCLUDE=(53,8,CH,EQ,CURRDATE),                               
  IFTHEN=(WHEN=(125,3,ZD,EQ,1),                               
  BUILD=(C'//SORTIN   DD DISP=SHR,DSN=',81,44,80:X)),         
  IFTHEN=(WHEN=NONE,                                           
  BUILD=(C'//         DD DISP=SHR,DSN=',81,44,80:X))           
/*                                                             
//STEP0300 EXEC PGM=ICEMAN,COND=(4,EQ,STEP0200)
//SYSOUT   DD SYSOUT=*                         
//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
//SORTOUT  DD SYSOUT=*                         
//SORTIN   DD DATA,DLM=$$                       
//TIDXXXA  JOB 'COPY',     
//             CLASS=A,                         
//             MSGCLASS=H,                     
//             MSGLEVEL=(1,1),                 
//             NOTIFY=TIDXXX                   
//*                                             
//STEP0100 EXEC PGM=ICEMAN                     
//SYSOUT   DD SYSOUT=*                         
//SORTOUT  DD DSN=TIDXXX.CURRDATE.GDGCOPY,           
//            DISP=(NEW,CATLG,DELETE),         
//            UNIT=SYSDA,                       
//            SPACE=(CYL,(X,Y),RLSE)           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
$$                                             
//         DD DSN=&&T,DISP=(OLD,PASS)
/*


I found this code somewhere in the forums. I didn't understand everything. Can you please go through this and explain it.

This is the URL - Link to a different forum removed
skankatala
 
Posts: 42
Joined: Sun Dec 11, 2011 9:45 am
Location: Hyderabad
Has thanked: 0 time
Been thanked: 0 time

Re: How to access creation date of PS file in a JCL program?

Postby dick scherrer » Mon Dec 12, 2011 10:28 am

Hello,

What happened when you tried what i suggested many replies ago. . .

If you haven't tried this, why not?
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: How to access creation date of PS file in a JCL program?

Postby expat » Mon Dec 12, 2011 2:43 pm

Take a look at DFdss (ADRDSSU) which has date and datset filtering capabilities
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: How to access creation date of PS file in a JCL program?

Postby skankatala » Tue Dec 13, 2011 1:16 am

//STEP0100 EXEC PGM=IKJEFT01                                   
//SYSTSPRT DD DSN=&&L,                                         
//            DISP=(,PASS),                                   
//            SPACE=(CYL,(1,1),RLSE),                         
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)               
//SYSTSIN  DD *                                               
  LISTCAT ENT('YOUR GDG BASE') ALL                           
//*                                                           
//STEP0200 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SYMNAMES DD *                                               
CURRDATE,S'&LYR4..&LJDAY'                                     
//SORTIN   DD DSN=&&L,DISP=(OLD,PASS)                         
//SORTOUT  DD DSN=&&T,DISP=(,PASS),SPACE=(CYL,(1,2),RLSE)     
//SYSIN    DD *                                               
  INCLUDE COND=(04,7,CH,EQ,C'NONVSAM',OR,                     
                37,8,CH,EQ,C'CREATION')                       
                                                               
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,                         
        BEGIN=(4,7,CH,EQ,C'NONVSAM'),PUSH=(81:17,44)),         
  IFTHEN=(WHEN=(53,8,CH,EQ,CURRDATE),OVERLAY=(125:SEQNUM,3,ZD))
  SORT FIELDS=COPY                                             
                                                               
  OUTFIL IFOUTLEN=80,NULLOFL=RC4,                             
  INCLUDE=(53,8,CH,EQ,CURRDATE),                               
  IFTHEN=(WHEN=(125,3,ZD,EQ,1),                               
  BUILD=(C'//SORTIN   DD DISP=SHR,DSN=',81,44,80:X)),         
  IFTHEN=(WHEN=NONE,                                           
  BUILD=(C'//         DD DISP=SHR,DSN=',81,44,80:X))           
/*                                                             
//STEP0300 EXEC PGM=ICEMAN,COND=(4,EQ,STEP0200)
//SYSOUT   DD SYSOUT=*                         
//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
//SORTOUT  DD SYSOUT=*                         
//SORTIN   DD DATA,DLM=$$                       
//TIDXXXA  JOB 'COPY',     
//             CLASS=A,                         
//             MSGCLASS=H,                     
//             MSGLEVEL=(1,1),                 
//             NOTIFY=TIDXXX                   
//*                                             
//STEP0100 EXEC PGM=ICEMAN                     
//SYSOUT   DD SYSOUT=*                         
//SORTOUT  DD DSN=TIDXXX.CURRDATE.GDGCOPY,           
//            DISP=(NEW,CATLG,DELETE),         
//            UNIT=SYSDA,                       
//            SPACE=(CYL,(X,Y),RLSE)           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
$$                                             
//         DD DSN=&&T,DISP=(OLD,PASS)
/*



    This code worked properly. It pulls the current date generations in a gdg and copy all those data into one file. We can extend our functionality based on the requirement.

Thanks everybody for your suggestions.
skankatala
 
Posts: 42
Joined: Sun Dec 11, 2011 9:45 am
Location: Hyderabad
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post