Page 2 of 2

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

PostPosted: Sun Dec 11, 2011 8:43 pm
by Akatsukami
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.

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

PostPosted: Sun Dec 11, 2011 9:41 pm
by skankatala
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.

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

PostPosted: Sun Dec 11, 2011 9:43 pm
by NicC
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).

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

PostPosted: Mon Dec 12, 2011 3:54 am
by BillyBoyo
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)

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

PostPosted: Mon Dec 12, 2011 9:21 am
by skankatala
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

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

PostPosted: Mon Dec 12, 2011 10:28 am
by dick scherrer
Hello,

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

If you haven't tried this, why not?

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

PostPosted: Mon Dec 12, 2011 2:43 pm
by expat
Take a look at DFdss (ADRDSSU) which has date and datset filtering capabilities

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

PostPosted: Tue Dec 13, 2011 1:16 am
by skankatala
//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.