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

How to get latest GDG Name into another File


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hemantpareek

New User


Joined: 27 Aug 2010
Posts: 3
Location: Pune

PostPosted: Fri Aug 27, 2010 8:01 pm
Reply with quote

Hi!

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.

Now How to go Further....
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 27, 2010 8:47 pm
Reply with quote

Hello and welcome to the forum,

Suggest you post the LISTCAT entries for a few generations and mention the relevant data positions.

When posting these, use the "Code" tag to preserve alignment.
Back to top
View user's profile Send private message
hemantpareek

New User


Joined: 27 Aug 2010
Posts: 3
Location: Pune

PostPosted: Sat Aug 28, 2010 8:51 pm
Reply with quote

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             
Back to top
View user's profile Send private message
hemantpareek

New User


Joined: 27 Aug 2010
Posts: 3
Location: Pune

PostPosted: Sat Aug 28, 2010 8:53 pm
Reply with quote

Sorry Please read
Step 2; if Step1 RC=0, IDCAMS LISTCAT,will cheeck existence of G0001
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Mon Aug 30, 2010 3:34 pm
Reply with quote

Code:
//STPU000 EXEC PGM=RMS,PARM='00F'               
//CMT       DD DSN=PERM.TDP.CMT,DISP=SHR       
//RMSRPT    DD SYSOUT=*                         
//*                                             
//STPN320  EXEC PGM=IDCAMS                     
//SYSPRINT  DD DSN=TEMP.TLM.TEST,             
//             DISP=(NEW,CATLG),UNIT=DISK,     
//             DCB=(LRECL=80,RECFM=FB),         
//             SPACE=(27998,(40,100),RLSE)     
//SYSOUT DD SYSOUT=*                           
//SYSIN DD *                                   
  LISTCAT ENTRIES('NJUST.NJUSIUS1.NJGCL404.X.TABREC') HISTORY   
/*                                             
//STPN320  EXEC PGM=SORT                       
//SORTIN    DD DSN=TEMP.TLM.TEST,DISP=SHR     
//SORTOUT   DD DSN=TEMP.TLM.TEST2,           
//             DISP=(NEW,CATLG),UNIT=DISK,     
//             SPACE=(27998,(40,100),RLSE)     
//SYSOUT DD SYSOUT=*                           
//SYSIN DD *                                   
  OPTION VLSHRT,VLSCMP                         
  INCLUDE COND=(9,7,CH,EQ,C'NONVSAM')           
  INREC BUILD=(1,4,SEQNUM,8,ZD,22)               
  SORT FIELDS=(5,8,ZD,D)                         
  OUTFIL OUTREC=(13,50,80:X),CONVERT,ENDREC=1   
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Aug 30, 2010 9:23 pm
Reply with quote

Hemantpareek,

Use the following DFSORT JCL which will give you last created GDG generation name even if the version number is different.

Code:

//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.name') ALL                     
//*                                                       
//STEP0200 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=&&L,DISP=(OLD,PASS)                     
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                                           
  INCLUDE COND=(04,7,CH,EQ,C'NONVSAM',OR,                 
                37,8,CH,EQ,C'CREATION')                   
                                                         
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:17,44),     
  BEGIN=(1,8,CH,EQ,C'GDG BASE',OR,4,7,CH,EQ,C'NONVSAM')) 
                                                         
  SORT FIELDS=(55,6,UFF,D)                               
  OUTFIL ENDREC=1,BUILD=(81,44,80:X)                     
//*


smijoss,

Run your job allocating a version 1 gdg generation as follows.

Code:

//NEWGEN   EXEC PGM=IEFBR14                         
//FILE01   DD DSN=NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V01,
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,                           
//            SPACE=(CYL,(1,1),RLSE),               
//            DCB=(LRECL=NNN,RECFM=FB,BLKSIZE=?????)
//*
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Tue Aug 31, 2010 11:57 am
Reply with quote

Hi Skolusu,

I created a dataset
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G9998V01

asnd then created 2 new datasats using the
NJUST.NJUSIUS1.NJGCL404.X.TABREC(+1)

so the following datasets were created.
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G9999V01
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V01

on running my Job i got
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V01
as the output.

am i missing anything ??
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Aug 31, 2010 10:40 pm
Reply with quote

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.

NJUST.NJUSIUS1.NJGCL404.X.TABREC.G9999V00
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Wed Sep 01, 2010 12:12 pm
Reply with quote

Hi Skolusu,


Quote:
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.

Eg.

if i have

NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V00
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0002V00
NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0003V00

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


what do you suggest ?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Sep 01, 2010 9:22 pm
Reply with quote

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.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top