rc = RxLstCat( [filter] ) [;]
Sourcecode
/* REXX ***************************************************************/
/* */
/* Program name: RXLSTCAT */
/* Program type: tso command */
/* Function....: ICF Catalog search interface with IGGCSI00 */
/* This is only a sample to show cataloged datasets */
/* for a mask (filter key) und their typ and volume(s) */
/* For more information refer to the IBM book */
/* "z/OS DFSMS Managing Catalogs" */
/* */
/* Using.......: tso %rxlstcat mask */
/* sample mask : ITIZ077.** */
/* default mask: your-userid.** */
/* Returns.....: List of all Catalog entries for given key in Format: */
/* TYPE ENTRYNAME VOLUME(S) */
/* */
/* Author......: Janosch R(exx) Kowalczyk */
/* Create date.: 19 Sep 2007, Wed / 262 */
/* Version.....: 0.1 */
/* Changes.....: No */
/* */
/* On return, general-purpose register 15 can contain the following: */
/* */
/* Return Description */
/* Code [hex] */
/* 0 No errors or return messages */
/* */
/* 4 Information was returned from Catalog Management */
/* processing. Further information is returned in the */
/* 4-byte reason area pointed to by the first address in */
/* the parameter list. See Table 19 in topic C.4.1.1 for */
/* the interpretation of this information. */
/* */
/* 8 Failure in Catalog Search Interface routine. Further */
/* information is returned in the 4-byte reason area */
/* pointed to by the first address in the parameter list. */
/* See "Return Code 8" in topic C.4.1.2 for the interpre- */
/* tation of this information */
/* When general-purpose register 15 contains 8, the reason */
/* area information is passed back from Catalog Search */
/* Interface routine. The module identification is always */
/* set to X'FFFF'. The reason codes have the following */
/* meanings: */
/* 01 Insufficient storage for Getmain, increase region */
/* size */
/* 02 Invalid entry type in CSIDTYPS */
/* */
/* 03 Invalid data/index option in CSICLDI, should be Y */
/* or blank */
/* 04 Invalid resume option in CSIRESUM, should be Y or */
/* blank */
/* 05 Invalid search one catalog option in CSIS1CAT, */
/* should be Y or blank */
/* */
/* 06 Invalid number of fields value in CSINUMEN, should */
/* be between zero and 100, inclusive */
/* */
/* 07 Invalid work area length, should be between 1024 */
/* and 1048575, inclusive */
/* */
/* 08 The CSIOPTNS value is not F or blank */
/* */
/* C Error in Catalog Search Interface routine parameter */
/* list-check for zero entries. */
/* */
/* 10 Parameter list pointer in general-purpose register 1 */
/* is zero. */
/* */
/* Copyright © Janosch R(exx) Kowalczyk. 2007-2009. */
/* All rights reserved. */
/**********************************************************************/
/* trace r */
Parse Source environment callType procName .
Arg mask
/*--------( Exceptions handling )--------*/
Signal On Failure Name CLEANUP
Signal On Halt Name CLEANUP
Signal On Syntax Name CLEANUP
/* If mask = '' Then mask = "SYS1.NVGP01.MCAT" */
If mask = '' Then mask = "IZSP.RACF.ARC.**"
If mask = '' Then mask = Userid() !! ".**"
/*==================================================================*/
/* Initialize work variables */
/*------------------------------------------------------------------*/
modrsnrc = Left( " ", 4 ) /* Clear module/return/reason */
workLen = 64000 /* Pre-given Work Area length */
Call CsiEtnCreate /* Initialize Entry type names */
Call CsiWahDesc /* Initialize Header of Work Area */
Call CsiFldDesc /* Initialize selection criteria fields */
Call OutrecDesc /* Initialize output record fields */
/*==================================================================*/
/* Build the selection criteria fields part of parameter list */
/*------------------------------------------------------------------*/
cldi = "Y" /* Return data or index */
numen = '0001'x /* Number of entries in Tab.*/
fld1 = "VOLSER" /* Field name (1st one) */
csifield = CsiFldCreate( mask,, /* Generic Filter Key */
,, /* Catalog name or blanks */
,, /* Resume name or blanks */
cldi,, /* Return data or index Y/b */
,, /* Resume, Y or blank */
numen,, /* Number of entries in Tab.*/
fld1 ) /* Field name (1st one) */
/*==================================================================*/
/* Initialize and build work area output part of parameter list */
/*------------------------------------------------------------------*/
dwork = Overlay( '0000FA00'x, Copies( '00'x, workLen ), 1, 4 )
/*==================================================================*/
/* Set up loop for resume (if a resume is necessary) */
/*------------------------------------------------------------------*/
Do Until csifld._resume = ' '
/*================================================================*/
/* Issue link to catalog generic filter interface */
/*----------------------------------------------------------------*/
Address Linkpgm "IGGCSI00 MODRSNRC CSIFIELD DWORK"
currMask = CsiFldParse( csifield ) /* Check answer in the selec- */
/* tion criteria fields */
next = CsiWahParse( dwork ) /* Separete header from entries */
usedLen = c2d( csiwah._usdLn ) /* Get amount of Work Area used */
Parse Var next next +(usedLen) . /* Cat Work Area to the real size*/
/*================================================================*/
/* Process data returned in work area */
/*----------------------------------------------------------------*/
Do While Length( next ) > csiwah._pos._next
index = CsiEnPrefParse( next )
If index = "0" Then Do
name = csien._name
prevRemain = csien._remain
next = CsiCatParse( csien._remain )
/*--( User- or Master Catalogue? )--*/
nextIndex = CsiEnPrefParse( next )
If nextIndex = "X" Then index = "0X"
csien._remain = prevRemain
out = ICreateOutRec( Left( csietn.index, 8 ), name, "******" )
Say out
End
Else Do
next = CsiEnParse( csien._remain )
start = c2d(csien._lenF1)
If start > 0 Then Do
Parse Var next 1 vol +(start) next
n = start / 6
Do i = n-1 To 1 by -1
vol = Insert( " ", vol, i * 6 )
End
End
Else vol = Overlay( csietn.index, "******" )
out = ICreateOutRec( Left( csietn.index, 8 ), csien._name, vol )
Say out
End
End
End
Exit rc
/*============( Signal cleaning procedure )=============*/
CLEANUP:
"DELSTACK"
Say "Break, Failure or Syntax Error running" procName". rc="rc
Say "Sourceline" sigl ">>>" SourceLine( sigl )
Say "Restart please. If the error recurs, notify the author."
If rc = 0 Then RC = 3
Exit rc
/*=====================( P R O Z E D U R E N )=======================*/
/*=============( Create Output Record )============*/
ICreateOutRec: Procedure Expose outrec.
Parse Arg typ, ent, vol, rec
rec = Overlay( ent, typ, outrec._pos._ent, outrec._len._ent )
rec = Overlay( vol, rec, outrec._pos._vol )
/* rec = Overlay( vol, rec, outrec._pos._vol, outrec._len._vol ) */
Return Strip( rec, "T" )
/*** End ICreateOutRec ***/
/*============( Decription values of CSI output record )=============*/
OutrecDesc: Procedure Expose outrec.
/*==========( Length block of OutrecDesc )===========*/
outrec._len. = 0
outrec._len._typ = 8
outrec._len._ent = 44
outrec._len._vol = 8
/*=========( Position block of CsiWahDesc )==========*/
outrec._pos. = 0
outrec._pos._typ = 1
outrec._pos._ent = outrec._pos._typ + outrec._len._typ + 1
outrec._pos._vol = outrec._pos._ent + outrec._len._ent + 1
Return outrec._pos._vol + outrec._len._vol
/*** End OutrecDesc ***/
/*====================( Create Entry Type Name )=====================*/
CsiEtnCreate: Procedure Expose csietn.
Arg index
csietn. = ""
csietn.0X = "CATALOG"
csietn.0 = "USERCAT"
csietn.A = "NONVSAM"
csietn.B = "GDG"
csietn.C = "CLUSTER"
csietn.D = "DATA"
csietn.G = "AIX"
csietn.H = "GDS"
csietn.I = "INDEX"
csietn.R = "PATH"
csietn.X = "ALIAS"
csietn.U = "UCAT"
csietn.L = "ATLLIB"
csietn.W = "ATLVOL"
Return csietn.index
/*** End CsiEtnCreate ***/
/*===============( Create Selection Criteria Fields )================*/
CsiFldCreate: Procedure Expose csifld.
Arg filtk, catnm, resnm, cldi, resum, numen, fld1, rec
rec = Overlay( filtk, rec, csifld._pos._filtKey, csifld._len._filtKey )
rec = Overlay( catnm, rec, csifld._pos._catName, csifld._len._catName )
rec = Overlay( resnm, rec, csifld._pos._resName, csifld._len._resName )
rec = Overlay( cldi , rec, csifld._pos._cldi , csifld._len._cldi )
rec = Overlay( resum, rec, csifld._pos._resume, csifld._len._resume )
rec = Overlay( numen, rec, csifld._pos._numen, csifld._len._numen )
rec = Overlay( fld1 , rec, csifld._pos._fld1, csifld._len._fld1 )
Return Left( rec, csifld._pos._rest-1 )
/*** End CsiFldCreate ***/
/*===============( Parse Selection Criteria Fields )=================*/
CsiFldParse: Procedure Expose csifld.
Arg 1 csifld._filtKey , /* Filter mask in the list 44 */
45 csifld._catName , /* Catalog name 44 */
89 csifld._resName , /* Resume name 44 */
133 csifld._dtyps , /* Entry types to be returned 1 */
134 . , /* 15 */
133 csifld._dtypd , /* Entry types 16 */
149 csifld._cldi , /* Indicate data and index (Y/N) 1 */
150 csifld._resume , /* Resume flag 1 */
151 csifld._s1cat , /* Indicate search > 1 catalogs 1 */
152 csifld._lenOptns , /* Indicates lengths field: 1 */
, /* F = Fullword, other=Halfword */
153 csifld._numen , /* Init number of fields in hex 2 */
155 csifld._fld1 , /* Init field 1 for volsers 8 */
162 csifld._rest
Return csifld._filtKey
/*** End CsiFldParse ***/
/*========( Description values of Selection Criteria Fields )========*/
CsiFldDesc: Procedure Expose csifld.
/*==========( Length block of CsiFldDesc )===========*/
csifld._len. = 0
csifld._len._filtKey = 44
csifld._len._catName = 44
csifld._len._resName = 44
csifld._len._dtypd = 16
csifld._len._dtyps = 1
csifld._len._cldi = 1
csifld._len._resume = 1
csifld._len._s1cat = 1
csifld._len._lenOptns = 1
csifld._len._numen = 2
csifld._len._fld1 = 8
/*=========( Position block of CsiFldDesc )==========*/
csifld._pos. = 0
csifld._pos._filtKey = 1
csifld._pos._catName = csifld._pos._filtKey + csifld._len._filtKey
csifld._pos._resName = csifld._pos._catName + csifld._len._catName
csifld._pos._dtyps = csifld._pos._resName + csifld._len._resName
csifld._pos._dtypd = csifld._pos._resName + csifld._len._resName
csifld._pos._cldi = csifld._pos._dtypd + csifld._len._dtypd
csifld._pos._resume = csifld._pos._cldi + csifld._len._cldi
csifld._pos._s1cat = csifld._pos._resume + csifld._len._resume
csifld._pos._lenOptns = csifld._pos._s1cat + csifld._len._s1cat
csifld._pos._numen = csifld._pos._lenOptns + csifld._len._lenOptns
csifld._pos._fld1 = csifld._pos._numen + csifld._len._numen
csifld._pos._rest = csifld._pos._fld1 + csifld._len._fld1
Return csifld._pos._rest - 1
/*** End CsiFldDesc ***/
/*====================( Parse Work Area Hesder )=====================*/
CsiWahParse: Procedure Expose csiwah.
Arg 1 csiwah._usrLn , /* Total length of WA. User provided 4 */
5 csiwah._reqLn , /* Minimum required work area for 1 cat. 4 */
, /* name entry and 1 data entry entry. */
9 csiwah._usdLn , /* Total length of work area used in 4 */
, /* returning entries. */
13 csiwah._numFd , /* Number of field names plus 1. 2 */
15 csiwah._next /* Next part of work area VL */
Return csiwah._next
/*** End CsiWahParse ***/
/*============( Decription values of CSI Work Area data )============*/
CsiWahDesc: Procedure Expose csiwah.
/*==========( Length block of CsiWahDesc )===========*/
csiwah._len. = 0
csiwah._len._usrLn = 4
csiwah._len._reqLn = 4
csiwah._len._usdLn = 4
csiwah._len._numFd = 2
/*=========( Position block of CsiWahDesc )==========*/
csiwah._pos. = 0
csiwah._pos._usrLn = 1
csiwah._pos._reqLn = csiwah._pos._usrLn + csiwah._len._usrLn
csiwah._pos._usdLn = csiwah._pos._reqLn + csiwah._len._reqLn
csiwah._pos._numFd = csiwah._pos._usdLn + csiwah._len._usdLn
csiwah._pos._next = csiwah._pos._numFd + csiwah._len._numFd
Return csiwah._pos._next
/*** End CsiWahDesc ***/
/*=================( Parse Work Area Catalog Data )==================*/
CsiEnPrefParse: Procedure Expose csien.
Arg 1 csien._flag , /* Catalog/Entry flag information 1 */
2 csien._type , /* Catalog/Entry flag information 1 */
, /* A=NonVSAM,B=GDG,C=Cluster,D=VSAM data, */
, /* G=Alternate Index,H=GDS,I=VSAM Index, */
, /* R=Path,X=Alias,U=UserCat.connector entry, */
, /* L=ALT Library entry,W=ALT Volume entry, */
, /* 0=Catalog=x'F0',other=Catalog error info. */
3 csien._name , /* Catalog/Entry name 44 */
47 csien._remain /* Variable part of this entry including VL */
/* remaining part of the Work Area */
Return csien._type
/*** End CsiEnPrefParse ***/
/*=================( Parse Work Area Catalog Data )==================*/
CsiCatParse: Procedure Expose csien.
Arg 1 csien._retn , /* MODRSNRC-Information code (3 folgende 4 */
5 . , /* Felder) */
1 csien._retm , /* Catalog/Entry return module ID 2 */
3 csien._retr , /* Catalog/Entry return reason code 1 */
4 csien._retc , /* Catalog/Entry return code 1 */
5 csien._next /* Next part of work area after cat. ent. VL */
Return csien._next
/*** End CsiCatParse ***/
/*==================( Parse Work Area Entry Data )===================*/
CsiEnParse: Procedure Expose csien.
Arg 1 csien._totLn , /* Total length of returned information 2 */
, /* including this field and length fields. */
, /* The next entry begins at this offset plus */
, /* this length. */
3 csien._resr , /* Reserved 2 */
5 csien._lenF1 , /* First length field 2 */
7 csien._next /* Next part of work area for field 1 VL */
Return csien._next
/*** End CsiEnParse ***/
Beispiel 1
rc = RxLstCat() Say "RC="rc
Ergebnis 1
USERCAT USER.CAT1 ****** NONVSAM USER01.BRODCAST.USERMAIL VOLM03 NONVSAM USER01.ISPF.PROFILE VOLM15 NONVSAM USER01.PRIVATE.DMCDATA VOLM05 NONVSAM USER01.PRIVATE.DMGDF VOLM15 NONVSAM USER01.PRIVATE.CNTL MIGRAT NONVSAM USER01.PUBLIC.CNTL VOLM15 NONVSAM USER01.PUBLIC.DSQCFORM VOLM15 NONVSAM USER01.PUBLIC.EXEC VOLM05 GDG USER01.PUBLIC.GDGTEST GDG*** NONVSAM USER01.PUBLIC.TASKLIST.NOTEBOOK VOLM02 CATALOG SYS1.MASTER.CAT ****** ALIAS USER01 ALIAS* RC=0