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

Need to know the current generation of GDG


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

New User


Joined: 29 Nov 2005
Posts: 49

PostPosted: Wed Oct 19, 2011 9:55 pm
Reply with quote

Hello all,

I have following requirement.

I have some set of file names. I need to know the following.
1. If dataset is GDG then need to know the current generation of file.
2. If dataset is not GDG then it should display as it is saying not a GDG file.


I am going to put all file names in one file as input and want to get output file with above mentioned two points.


Say my input file xxx.xxx.xxx contains following files.
a.a.a
b.b.b
c.c.c

output file need to have in following format
a.a.a is not a GDG file
b.b.b.G0012V00
c.c.c.G0009V00

Please help me on this.

Thanks
Ram
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Oct 19, 2011 10:15 pm
Reply with quote

Write a Rexx exec that reads the DSNs from a file. For each DSN, do a LISTCAT, OUTTRAPping the results. If the first trapped line does not contain the token "GDG BASE", it is not a GDG; otherwise, parse the last line containing the token "NONVSAM" for the highest version number (won't work if any of your GDGs have wrapped, but this usually takes a while).
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Oct 20, 2011 12:11 am
Reply with quote

Good Grief! How many times THIS YEAR has this sort of question been asked?
Back to top
View user's profile Send private message
sunnybunny

New User


Joined: 29 Nov 2005
Posts: 49

PostPosted: Thu Oct 20, 2011 12:38 am
Reply with quote

Hi

Thanks for your reply.

I am not familiar with REXX...I started learning it. Can you please help me with the REXX code for this.

Thanks
Ram.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Oct 20, 2011 12:58 am
Reply with quote

sunnybunny wrote:
Hi

Thanks for your reply.

I am not familiar with REXX...I started learning it. Can you please help me with the REXX code for this.

Kids these days icon_rolleyes.gif

The Rexx:
Code:
/* Rexx */                                                             
/* Written Heisei 23.10.19 by Akatsukami-sama */                       
  trace o                                                             
/* Allocation of TULIN and TULOUT must be done if exec is not run in */
/* the background.                                                   */
  "EXECIO 1 DISKR TULIN"                                               
                                                                       
  do while (rc=0)                                                     
    pull dsn .                                                         
    x = outtrap("LC.")                                                 
    "LISTCAT ENTRIES('"dsn"')"                                         
    x = outtrap("OFF")                                                 
                                                                       
    if (pos("GDG BASE",lc.1)=0) then do                               
      line = dsn "is not a GDG"                                       
      push line                                                       
      "EXECIO 1 DISKW TULOUT"                                         
    end                                                               
    else if (lc.0=2) then do                                           
      line = "No generations of" dsn                                   
      push line                                                       
      "EXECIO 1 DISKW TULOUT"                                         
      end                                                             
      else do                                                         
        i = lc.0 - 1                                                   
        parse var lc.i . . g                                           
        p = lastpos('.',g)                                             
        gen = substr(g,p+1)                                           
        push g                                                         
        "EXECIO 1 DISKW TULOUT"                                       
      end                                                             
    "EXECIO 1 DISKR TULIN"                                             
  end                                                                 
/* If TULIN and TULOUT are allocated in the exec, they must also be  */
/* freed in it.                                                      */
  exit                                                                 
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 20, 2011 1:00 am
Reply with quote

Browse the forum for some likely-looking titles, try google.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Oct 20, 2011 5:32 pm
Reply with quote

There's also IDCAMS LISTCAT.

Write the report to a file and write a program or other extraction method to parse the report.
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

 


Similar Topics
Topic Forum Replies
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
No new posts Fetch data from programs execute (dat... DB2 3
No new posts DFHPI1008 JSON generation failed COBOL Programming 0
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top