We have a Requirement in which , we have to write the latest GDG generation Name into another File. We have Done following Steps in our JCL.
1. Step1: Use IDCAMS LISTCAT Command with History Option and written the output to a Flat File.
2. Step2: Converts the output file from VBA to FB format and sorts the
records based on GDG generation Number in Descending Order.
3. Step3: Select the First Record using STOPAFT=1.
But the problem is that After 9999 generations ( Max G9999V00 ) the cycle will start from 1 , and for the same reason we have to include Creation Date and sort the records based on that. But the Creation Date and GDG File name comes in different records in the OUTPUT File of LISTCAT Command.
Above mentioned step2 and Step3 are I am doing in single Step2. And for the problem when GDG9999 has reached I have below approch.
Step 1 : IDCAMS LISTCAT , will cheeck existence of G9999
Step 2; IDCAMS LISTCAT , will cheeck existence of G0001, if Step1 RC=1
If Step2 RC= 0
Then process which I mentined in starting of forum will run , with SORTing in Ascending order
If Step2 RC= 4
Then Then Steps mentined in my starting will run , with SORTing in Descending order
If you have better way , please let me know.
LISTCAT entries for a is given below. This file is in VBA format .
File name starts from 22 postion and Creation date from 57.
Code:
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
NJUST.LISTCAT.TESTX Columns 000
d ===> Scroll =
----+----1----+----2----+----3----+----4----+----5----+----6---
***************************** Top of Data *********************
1IDCAMS SYSTEM SERVICES
0
LISTCAT ENTRIES('NJUST.NJUSIUS1.NJGCL404.X.TABREC') HISTORY
0GDG BASE ------ NJUST.NJUSIUS1.NJGCL404.X.TABREC
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER----NB5564A CREATION--------2010.081
RELEASE----------------2 LAST ALTER------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.081
RELEASE----------------2 EXPIRATION------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0002V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.085
RELEASE----------------2 EXPIRATION------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0003V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.085
RELEASE----------------2 EXPIRATION------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0004V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.101
RELEASE----------------2 EXPIRATION------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0005V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.101
RELEASE----------------2 EXPIRATION------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0006V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.102
RELEASE----------------2 EXPIRATION------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0007V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.103
RELEASE----------------2 EXPIRATION------0000.000
1IDCAMS SYSTEM SERVICES
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0016V00
IN-CAT --- CATALOG.PRJT01
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2010.109
RELEASE----------------2 EXPIRATION------0000.000
0 NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0019V00
IN-CAT --- CATALOG.PRJT01
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Quote:
am i missing anything ??
smijoss,
You should have a mixed bag of GDG VERSIONS.
for ex: you have a gdg base today and it has 9999 generations with version 00.
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G9999V00
and you allocate the next gdg version with generation 1 and version 1.
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V01
Now when you run your job you will pick up G9999 as listcat lists the generations in the sorted order of their name. You are appending a seqnum and sorting in the reverse order which would bring the G9999 to the top.
for ex: you have a gdg base today and it has 9999 generations with version 00.
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G9999V00
and you allocate the next gdg version with generation 1 and version 1.
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V01
i agree with your explanation, but the version is changed only if mentioned in the JCL.
Generally GDGs are created using (+1) to the base. This will increment the Generation no. but the version will always be zero.
an then i allocate : NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V01
then this dataset will still be treated as
NJUST.NJUSIUS1.NJGCL404.X.TABREC(-2)
and NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0003V00
will be treated as NJUST.NJUSIUS1.NJGCL404.X.TABREC(0)
so technically although G0001V01 was created after G0003V00, the latter will be treated as the latest GDG version in all JCLs refering to it.
Unless Date is the only criteria to i still dont understand why changing version will help
Quote:
Now when you run your job you will pick up G9999 as listcat lists the generations in the sorted order of their name. You are appending a seqnum and sorting in the reverse order which would bring the G9999 to the top.
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G9999V00
this situation will only arise when G0001V00 exists when G9999V00 and then G0001V01 are created. Since maximum generations for GDG is 256
by the time it reaches G9999, the G0001 will not exists.
in that case if NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V01
is created it will be treated as the latest GDG
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
hemantpareek wrote:
Unless Date is the only criteria to i still dont understand why changing version will help
From Op's first post,
hemantpareek wrote:
But the problem is that After 9999 generations ( Max G9999V00 ) the cycle will start from 1 , and for the same reason we have to include Creation Date and sort the records based on that. But the Creation Date and GDG File name comes in different records in the OUTPUT File of LISTCAT Command.