IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to do a GDG reversal?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shirazpasha

New User


Joined: 24 Nov 2006
Posts: 14
Location: India

PostPosted: Fri Apr 20, 2007 3:30 pm
Reply with quote

Hi,
Copying all the generations of a gdg to another file will copy the data from last gen. to 1st gen. of the GDG.
Now my requirement is, I have to copy the GDG versions in the order of their creation. i.e.,
Example:
Data in m.g0001v00 = 1
Data in m.g0002v00 = 2
Data in m.g0003v00 = 3

An IDCAMS repro to a PS of this GDG base would give me the following output.
3
2
1
But I want to get the output as
1
2
3
Hope my question is clear

Regards,
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Apr 20, 2007 3:43 pm
Reply with quote

There isn't an easy way.

If you are certain that the number of generations will not vary then you need to code them all on your DD statement.
Code:

//DDNAME DD DSN=my gdg(-x),DISP=SHR
//       DD DSN=my gdg(-y),DISP=SHR
//       DD DSN=my gdg(-z),DISP=SHR
//       DD DSN=my gdg(-0),DISP=SHR
Back to top
View user's profile Send private message
Shirazpasha

New User


Joined: 24 Nov 2006
Posts: 14
Location: India

PostPosted: Sat Apr 21, 2007 1:46 pm
Reply with quote

Hi,
Expact you are right. There isn't an easy or straight way. Yet I have found a way out.

The code given below uses LISTCAT to get the GDG info.
The output of STEP01 will be

Code:

   READY                                           
     LISTCAT ENT('TAS333.PASHA.TEST') NAME         
   GDG BASE ------ TAS333.PASHA.TEST               
        IN-CAT --- JCPA.UCATDTT6                   
      NONVSAM ---- TAS333.PASHA.TEST.G0001V00     
        IN-CAT --- JCPA.UCATDTT6                   
      NONVSAM ---- TAS333.PASHA.TEST.G0002V00     
        IN-CAT --- JCPA.UCATDTT6                   
      NONVSAM ---- TAS333.PASHA.TEST.G0003V00     
        IN-CAT --- JCPA.UCATDTT6                   
      NONVSAM ---- TAS333.PASHA.TEST.G0004V00     
        IN-CAT --- JCPA.UCATDTT6                   
      NONVSAM ---- TAS333.PASHA.TEST.G0005V00     
        IN-CAT --- JCPA.UCATDTT6                   
   READY                                           
   END                                         


Step02 uses sort to write the result of step 1 into two separate files.
SORT is used to write the GDG version names alone to the output files.
THe GDG version names can be found in the above listing after the text

Code:

                NONVSAM ----     


Step03 uses another SORT to merge the contents of the two files T1 and T2 with the SORT IN data, which is a job.

The output of the SORT is routed to the Internal Reader which submits the resulting job.

The output of this final job will give the FIFO data of the GDG versions.

Here is the code below which does exactly what i wanted.
Code:


//TAS333TB JOB (T0632DL),'GDG REVERSAL',MSGCLASS=X,CLASS=1,   
//  NOTIFY=&SYSUID
//*                                                           
//STEP01   EXEC  PGM=IKJEFT01     
//SYSTSPRT DD  DSN=&LC,                                         
//             DISP=(,PASS),                                   
//             SPACE=(CYL,(25,25),RLSE),                       
//             DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)               
//SYSTSIN  DD  *                                               
  LISTCAT ENTRY('TAS333.PASHA.TEST') NAME                     
//*                                                           
//STEP02   EXEC  PGM=SORT                                     
//SYSOUT   DD  SYSOUT=*                                       
//SORTIN        DD DSN=&LC,DISP=(OLD,PASS)
//T1       DD  DSN=&T1,                                       
//             DISP=(,PASS),                                           
//             SPACE=(CYL,(1,1),RLSE)                                   
//T2       DD  DSN=&T2,                                                 
//             DISP=(,PASS),                                           
//             SPACE=(CYL,(1,1),RLSE)                                   
//SYSIN    DD  *                                                       
          SORT FIELDS=COPY                                             
          INCLUDE COND=(4,7,CH,EQ,C'NONVSAM')                           
          OUTFIL FNAMES=T1,ENDREC=1,                                   
          OUTREC=(C'//SYSUT1 DD DISP=SHR,DSN=',17,44,80:X)             
          OUTFIL FNAMES=T2,STARTREC=2,                                 
          OUTREC=(C'//         DD DISP=SHR,DSN=',17,44,80:X)           
/*                                                                     
//STEP03   EXEC  PGM=SORT                                               
//SYSOUT   DD  SYSOUT=*                                                 
//SORTOUT  DD  SYSOUT=(*,INTRDR)                                       
//SORTIN   DD  DATA,                                                   
//             DLM=##                                                   
//TAS333TC JOB 'GDG REVERSAL',CLASS=3,MSGCLASS=X
//             NOTIFY=&SYSUID                                   
//*                                                             
//STEP10 EXEC PGM=IEBGENER                                       
//SYSIN    DD DUMMY                                             
//SYSUT2   DD DSN=TAS333.PASHA.TEST.SORTOUT,                     
//            DISP=(OLD,CATLG,DELETE),                           
//            SPACE=(TRK,(1,1),RLSE),                         
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)                 
//SYSPRINT DD SYSOUT=*                                           
##                                                               
//         DD  DSN=&T1,                                         
//             DISP=(OLD,PASS)                                   
//         DD  DSN=&T2,                                         
//             DISP=(OLD,PASS)                                   
//SYSIN    DD  *                                                 
         SORT FIELDS=COPY                                       
//*


Regards,
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Apr 21, 2007 4:31 pm
Reply with quote

Firstly, well done for showing some initiative and posting your solution. If only all posters would do the same.

As I suggested, knowing that the number of generations would not change, the solution I showed would work.

The other solution I would have offered would have been by using REXX, where you could have initiated the IDCAMS and created and submitted the JCL all in one step. But once again, well done.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Search our Forums:

Back to Top