user278458
user278458

Reputation: 211

How To Read MVS System Catalog To Retrieve GDG Information?

I have a job (JCL) on the mainframe where I want to programmatically retrieve a particular GDG file's recent relative generation numbers from the system catalog (API call)...where I can then programmatically dig thru the results returned by the call to figure out the relative generation numbers. This is similar to doing TSO 3.4 on the GDG base file name where the most recent generation numbers can be seen. IDCAMS doesn't appear to return information in a format that is friendly to a program. Thanks!

Example: GDG BASE NAME: TEST.FILE

GDG generations:

TEST.FILE.G0010V00

TEST.FILE.G0011V00

TEST.FILE.G0012V00

Upvotes: 1

Views: 2391

Answers (3)

JCR --
JCR --

Reputation: 11

Programatically (in assembler language), you could use the LOCATE SVC, with CAMLST specifying the parameter list,to get the information you're seeking -- here's a reference: https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.idas300/s3099.htm -- the example there shows only how to use that to get a volume list, but I used it in the early '80s to get the G-V- (generation-version) subname qualifiers corresponding to the relative index numbers -- pass the GDG base DSNAME and you get all the gens -- if you'd like to see some threads on this, maybe search bit.listserv.ibm-main -- you could also search the online IBM manuals with the term "Generation Index Pointer Entry" (GIPE), which is a pivotal part of the associated control blocks ...

Upvotes: 1

zarchasmpgmr
zarchasmpgmr

Reputation: 1434

Take a look at IGGCSI00, the catalog interface. You can call it from any program (REXX, CLIST, COBOL, assembler, PL/I), and it offers a lot of flexibility. Of course, like a lot of IBM flexible solutions, there is always some obtuseness.

There are lots of examples around the Internet, but the sample program in SYS1.SAMPLIB(IGGCSIRX) is excellent.

Upvotes: 2

Bruce Martin
Bruce Martin

Reputation: 10543

Your choices include:

  • IDCAMS/TSO Listcat and writing a program to reformat
  • Rexx ListDsi command

In particular for the the ListDsi you can have the following in the JCL

//MYGDG  DD DSN=my.gdg(0),DISP=SHR

and in the rexx program

x = ListDsi("MYGDG FILE")

say SYSDSNAME

You could also use Background ISPF services but that is an overkill for this


**Note:* to runn rexx, You need to Run TSO

//* job statement 
//TSOBATCH EXEC PGM=IKJEFT1A,DYNAMNBR=200 
//SYSEXEC  DD  DSN=userid.REXX.EXEC,DISP=SHR 
//SYSPRINT DD  SYSOUT=* 
//SYSTSPRT DD  SYSOUT=* 
//MYGDG    DD  DSN=my.gdg(0),DISP=SHR
//SYSTSIN  DD  * 
PROFILE PREFIX(userid) /* specifying a userid*/ 
%MYREXX 

Upvotes: 0

Related Questions