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

Copying GDG version(all/few) from production to test g


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nimisha 3

New User


Joined: 12 Feb 2022
Posts: 4
Location: India

PostPosted: Sat Feb 12, 2022 8:41 pm
Reply with quote

Hi All,

I am trying to copy the latest (0) and (-1) generations from production gdg to test gdg.
There are around 200 production gdgs for which this has to be done.

Kindly suggest Jcl/Rexx code for this.

If I want to copy all the generations , then can I use IEBGENER ?
Kindly suggest.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Sat Feb 12, 2022 8:52 pm
Reply with quote

Welcome !
For the first task -
You copy current and previous generations , you can write a proc with two steps in it using SORT and for GDG names use symbolics . Write a JCL to call this proc by overriding with GDG names , repeat this proc for rest of the GDGs.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Sat Feb 12, 2022 10:19 pm
Reply with quote

Hmmm, keep in mind that I never really used GDGs. I only studied them and tried a few things.

I think job one should do this:
copy prod(-1) to test(0)

and job two would be:
copy prod(0) to test(0)

Notice that the target is test(0) for both jobs.

Or can you copy directly to test(-1)??
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Sun Feb 13, 2022 2:19 pm
Reply with quote

do you copy to new datasetnames?
do you want the same generation number or are G0001V00 and G0002V00 ok?
Back to top
View user's profile Send private message
Nimisha 3

New User


Joined: 12 Feb 2022
Posts: 4
Location: India

PostPosted: Mon Feb 14, 2022 8:45 pm
Reply with quote

Code:
//ABCD job notify=&sysuid
//mylib  jcllib order=(mygdg.pds)
//step01 exec proc=test proc,
//                       f1=xyz.input.gdg,
//                       f2=ABC.out.gdg,
//                       gen0='(+0)'
//                       gen1='(-1)'


//testproc proc
//st1  exec pgm=sort
//sortin dd dsn=&f1.&gen1, disp=shr
//sortout dd dsn=&f2, disp=(old,keep,delete)
     Sort fields =copy

//st2 exec pgm=sort
//sortin dd dsn=&f1.&gen0, disp=shr
//sortout dd dsn=&f2, disp=(old,keep,delete)
    Sort fields = copy

Kindly suggest whether my understanding is correct.
If any other method, please share[/img]
Coded
Back to top
View user's profile Send private message
Nimisha 3

New User


Joined: 12 Feb 2022
Posts: 4
Location: India

PostPosted: Mon Feb 14, 2022 9:06 pm
Reply with quote

I want to copy last 2 generations of production gdg to test gdg
Kindly suggest
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Tue Feb 15, 2022 3:45 am
Reply with quote

in that case just a straight forward IEBGENER should do it, something like:

Code:
//C        PROC PROD=,TEST=                         
//C1       EXEC PGM=IEBGENER                       
//SYSPRINT DD SYSOUT=*                             
//SYSIN    DD DUMMY                                 
//SYSUT1   DD DISP=OLD,DSN=&PROD.(-1)               
//SYSUT2   DD DISP=(,CATLG),DSN=&TEST.(+1),         
//            UNIT=SYSDA,BLKSIZE=0,LIKE=&PROD.(0)   
//C2       EXEC PGM=IEBGENER                       
//SYSPRINT DD SYSOUT=*                             
//SYSIN    DD DUMMY                                 
//SYSUT1   DD DISP=OLD,DSN=&PROD.(-0)               
//SYSUT2   DD DISP=(,CATLG),DSN=&TEST.(+1),         
//            UNIT=SYSDA,BLKSIZE=0,LIKE=&PROD.(0)   
//         PEND                                     
//*                                                 
//D1       EXEC C,PROD=prod.gdg,TEST=test.gdg       

By the way, do remember that JCL must be in uppercase.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Tue Feb 15, 2022 11:25 pm
Reply with quote

Willy Jensen wrote:
in that case just a straight forward IEBGENER should do it, something like:

Code:
//C        PROC PROD=,TEST=                         
//C1       EXEC PGM=IEBGENER                       
//SYSPRINT DD SYSOUT=*                             
//SYSIN    DD DUMMY                                 
//SYSUT1   DD DISP=OLD,DSN=&PROD.(-1)               
//SYSUT2   DD DISP=(,CATLG),DSN=&TEST.(+1),         
//            UNIT=SYSDA,BLKSIZE=0,LIKE=&PROD.(0)   
//C2       EXEC PGM=IEBGENER                       
//SYSPRINT DD SYSOUT=*                             
//SYSIN    DD DUMMY                                 
//SYSUT1   DD DISP=OLD,DSN=&PROD.(-0)               
//SYSUT2   DD DISP=(,CATLG),DSN=&TEST.(+1),         
//            UNIT=SYSDA,BLKSIZE=0,LIKE=&PROD.(0)   
//         PEND                                     
//*                                                 
//D1       EXEC C,PROD=prod.gdg,TEST=test.gdg       

By the way, do remember that JCL must be in uppercase.
There are several problems here.
  1. There is no such thing as a -0 relative generation.
  2. Steps C1 and C2 attempt to create the same data set. Step C2 should copy from relative generation 0 to relative generation +2
  3. I'm not comfortable using the LIKE parameter. Better to use no DCB and let IEBGENER copy the SYSUT1 DCB attributes to the SYSUT2 DCB.
There is no easy way to copy all generations of a GDG to the equivalent "test" GDG. You pretty much have to use IEBGENER steps, though it should be possible to write a Rexx exec to generate the JCL, which is pretty much what I'd do if I had the task.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Tue Feb 15, 2022 11:54 pm
Reply with quote

@steve-myers
you are right, it went too fast and should have been tested.
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 581
Location: London

PostPosted: Wed Feb 16, 2022 2:07 am
Reply with quote

Fairly simple with DFDSS (ADRDSSU) COPY, or DUMP/RESTORE, especially if only the HLQ needs changing as per below example. (You need to define the target GDG bases before the copy is run)

If the target names have to changed more substantially, e.g. less or more name qualifiers, then you need specific absolute generation numbers i.e. *.GnnnnV00 for source and targets in the RENAMEU pairs. Note each of these pairs and other statements in the SYSIN can't exceed 255. (Yes a pain in the arse IBM)
e.g.
Code:
RENAMEU( -
     (GDGP.NAME1.GnnnnV00 - 
       TEST.X. NAME1.GnnnnV00 ) - 
     (GDGP.NAME2.GnnnnV00 - 
       TEST.X. NAME2.GnnnnV00 ) - 
     (GDGP.NAME2.GnnnnV00 - 
       TEST.X. NAME2.GnnnnV00 ) -                                                                                         
     ETC...   
        )


//*                                                                 
//* COPY GDGP.** DATASETS TO NEW HLQ TEST
//*                                                                 
//JSTEP010 EXEC  PGM=ADRDSSU                                         
//SYSPRINT  DD  SYSOUT=*                                             
//SYSIN     DD    *                                                 
 COPY ALLE TGTA(SRC) TGTGDS(ACTIVE) NMC NSC CAT SHR -
 TOL(ENQF) OPT(4) -
   DS(FDD(FILT))  -                                                   
     RENAMEU(TEST)                                                   
/*                                                                   
//FILT      DD    *                                                 
 INC( -                                                             
     GDGP.NAME1(0) -                                                 
     GDGP.NAME1(-1) -                                               
     GDGP.NAME2(0) -                                                 
     GDGP.NAME2(-1) -                                               
     ETC...                                                         
     ) -                                                             



If you want to copy all generations you can code GDG.NAME1(*) -
Coded
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Wed Feb 16, 2022 8:07 am
Reply with quote

Pete Wilson wrote:
COPY ALLE TGTA(SRC) TGTGDS(ACTIVE) NMC NSC CAT SHR -
TOL(ENQF) OPT(4) -

I would suggest using TGTGDS(SRC) and remove NMC NSC. Also TOL(ENQF) is enough so that SHR can be omitted here.
Only problem I see so far is identifying the GDSs that are part of a GDG (not DEFERRED or ROLLED-OFF state).
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 581
Location: London

PostPosted: Thu Feb 17, 2022 6:56 pm
Reply with quote

Joerg.Findeisen wrote:
Pete Wilson wrote:
COPY ALLE TGTA(SRC) TGTGDS(ACTIVE) NMC NSC CAT SHR -
TOL(ENQF) OPT(4) -

I would suggest using TGTGDS(SRC) and remove NMC NSC. Also TOL(ENQF) is enough so that SHR can be omitted here.
Only problem I see so far is identifying the GDSs that are part of a GDG (not DEFERRED or ROLLED-OFF state).



TGTGDS(ACTIVE/SRC) in this case is kind of irrelevant as the use of relative generations in the input list means only Active GDS's are selected anyway. Rolled-off or deferred ones cannot be referenced with relative generation numbers.

Why would you not include NMC and NSC? The MGMTCLAS and STORCLAS assignments of the Prod datasets might be completely inappropriate for TEST datasets so better to let ACS re-drive and assign the correct ones. Some rare issues with things like RLS STORCLAS's can be sorted at leisure in the Test environment.

TOL(ENQF) and/or SHR, not really a concern
Back to top
View user's profile Send private message
Nimisha 3

New User


Joined: 12 Feb 2022
Posts: 4
Location: India

PostPosted: Wed Mar 02, 2022 7:10 am
Reply with quote

Thank you for the solution, but I could not get the rexx code.
Can we directly start writing from RENAMEU and then follow the structure ?
Are there any prerequisite to be followed?
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 581
Location: London

PostPosted: Wed Mar 02, 2022 12:44 pm
Reply with quote

This is the correct order for the JCL and SYSIN statements for a DFDSS COPY. The first example just changes the high level qualifier only on all the target names to 'TEST'.
The second example changes each individual target to an individual new name

Code:
//DSSCOPY JOB 0,CLASS=X,MSGCLASS=0,NOTIFY=&SYSUID         
//*                                                       
//* COPY GDGP.** DATASETS TO A  NEW HLQ 'TEST'           
//*                                                       
//JSTEP010 EXEC  PGM=ADRDSSU                             
//SYSPRINT  DD  SYSOUT=*                                 
//SYSIN     DD    *                                       
 COPY ALLE TGTA(SRC) TGTGDS(ACTIVE) NMC NSC CAT SHR -     
 TOL(ENQF) OPT(4) -                                       
   DS(FDD(FILT))  -                                       
     RENAMEU(TEST)                                       
/*                                                       
//FILT      DD    *                                       
 INC( -                                                   
     GDGP.NAME1(0) -                                     
     GDGP.NAME1(-1) -                                     
     GDGP.NAME2(0) -                                     
     GDGP.NAME2(-1) -                                     
     ETC...                                               
     ) -                                                 
                                                         
//DSSCOPY JOB 0,CLASS=X,MSGCLASS=0,NOTIFY=&SYSUID         
//*                                                       
//* COPY GDGP.** DATASETS TO NEW NAMES                   
//*                                                       
//JSTEP010 EXEC  PGM=ADRDSSU                             
//SYSPRINT  DD  SYSOUT=*                                 
//SYSIN     DD    *                                       
 COPY ALLE TGTA(SRC) TGTGDS(ACTIVE) NMC NSC CAT SHR -     
 TOL(ENQF) OPT(4) -                                       
   DS(FDD(FILT))  -                                       
 RENAMEU( -                                               
     (GDGP.NAME1.GNNNNV00 -                               
       TEST.X.NAME1.GNNNNV00 ) -                         
     (GDGP.NAME2.GNNNNV00 -                               
       TEST.X.NAME2.GNNNNV00 ) -                         
     (GDGP.NAME2.GNNNNV00 -                               
       TEST.X.NAME2.GNNNNV00 ) -   
     ETC...                         
        )                           
/*                                 
//FILT      DD    *                 
 INC( -                             
     GDGP.NAME1(0) -               
     GDGP.NAME1(-1) -               
     GDGP.NAME2(0) -               
     GDGP.NAME2(-1) -               
     ETC...                         
     ) -                           
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts Monitoring production job progress. N... JCL & VSAM 4
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
No new posts Zunit Test case editor error Testing & Performance 4
No new posts Panvalet - 9 Character name - Issue c... CA Products 6
Search our Forums:

Back to Top