Page 1 of 1

GDG Generations

PostPosted: Fri Feb 10, 2012 10:44 am
by vamsyk9
Hi,

I am trying with the below code , but it is giving later version code , I tried giving Dataset.GDG(-2) but gives me error. Do i need to change anything below.

/* REXX */
PARSE UPPER PULL GDG
DSN = STRIP(GDG!!".G0000V00") /* DEFAULT IF NOT EXIST */
X=OUTTRAP(LST.) /* LISTCAT GDG BASE */
" LISTC ENT('"GDG"')"
X=OUTTRAP(OFF)
DO A = LST.0 TO 1 BY -1 /* FIRST FIND = 0 GDG */
  IF POS('NONVSAM',LST.A) > 0 THEN DO
    DSN = SUBSTR(LST.A,POS('NONVSAM',LST.A)+13,44)
    A = 0
  END
END
SAY "GDG=" GDG
SAY "DSN =" DSN
GDG1= SUBSTR(DSN,19,8)
QUEUE GDG1
"EXECIO "QUEUED() "DISKW OUTSRCH (FINIS"

Re: GDG Generations

PostPosted: Fri Feb 10, 2012 11:53 am
by NicC
I am trying with the below code , but it is giving later version code

I do not know what the above means - I read it to mean that you are using the program quoted below but it is using a later version of the program. This is gibberish. If you mean GDG version then you are not touching the V00 part of the dataset name at any point in the program.

You do realise that you are quitting your loop as soon as you find the string 'NONVSAM' and nowhere are you specifying a generation other than the later - except G0000V00 for the default.

By now you shaould also know to use the code tags to make your code readable - preserve spacing.

Re: GDG Generations

PostPosted: Fri Feb 10, 2012 1:03 pm
by expat
My code is doing exactly what it was written to do, to obtain the latest generation of any given GDS.

You need to adapt the code to suit your purpose.

Re: GDG Generations

PostPosted: Fri Feb 10, 2012 9:22 pm
by vamsyk9
Thanks for the above. I am new to Rexx and trying to learn things.

It would be great if you can guide me to change.

Re: GDG Generations

PostPosted: Sat Feb 11, 2012 1:43 am
by NicC
Best way to learn is get the manual, get another rexx program, read the manual, study the program. You can also get rexx on your PC so that you can practice at home - the i/o is different but, depending on which version of rexx for the pc you ,most of the other stuff is compatible.

Re: GDG Generations

PostPosted: Sat Feb 11, 2012 2:04 am
by enrico-sorichetti
oorexx provides EXECIO