MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Capture List of Datasets

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
akshaj
Beginner


Joined: 30 Dec 2002
Posts: 12
Topics: 8

PostPosted: Tue Feb 04, 2003 10:05 am    Post subject: Capture List of Datasets Reply with quote

How Can I capture list of datasets with the qualifier
say abc.abc.* in REXX ?
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Feb 04, 2003 10:35 am    Post subject: Reply with quote

'SYS1.SAMPLIB(IGGCSIRX)' for pure rexx, LMDLIST for an ISPF solution.

Last edited by semigeezer on Tue Feb 04, 2003 1:10 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Tue Feb 04, 2003 11:17 am    Post subject: Reply with quote

Try this

[code:1:9c6b8a3a91]
/* REXX */
/********************************************************************/
/* */
/* NAME: IGGCSIRX */
/*DESCRIPTION: THIS REXX EXEC IS USED TO CALL THE CATALOG */
/* SEARCH INTERFACE. */
/* INPUT: FILTER KEY */
/* OUTPUT: DATA SETS NAMES AND VOLUMES */
/* */
SAY 'ENTER FILTER KEY' /* ASK FOR FILTER KEY */
PULL KEY /* GET FILTER KEY */
/********************************************************************/
/* */
/* INITIALIZE THE PARM LIST */
/* */
/********************************************************************/
MODRSNRC = SUBSTR(' ',1,4) /* CLEAR MODULE/RETURN/REASON */
CSIFILTK = SUBSTR(KEY,1,44) /* MOVE FILTER KEY INTO LIST */
CSICATNM = SUBSTR(' ',1,44) /* CLEAR CATALOG NAME */
CSIRESNM = SUBSTR(' ',1,44) /* CLEAR RESUME NAME */
CSIDTYPS = SUBSTR(' ',1,16) /* CLEAR ENTRY TYPES */
CSICLDI = SUBSTR('Y',1,1) /* INDICATE DATA AND INDEX */
CSIRESUM = SUBSTR(' ',1,1) /* CLEAR RESUME FLAG */
CSIS1CAT = SUBSTR(' ',1,1) /* INDICATE SEARCH > 1 CATALOGS*/
CSIRESRV = SUBSTR(' ',1,1) /* CLEAR RESERVE CHARACTER */
CSINUMEN = '0001'X /* INIT NUMBER OF FIELDS */
CSIFLD1 = SUBSTR('VOLSER',1,8) /* INIT FIELD 1 FOR VOLSERS */
/********************************************************************/
/********************************************************************/
/* */
/* BUILD THE SELECTION CRITERIA FIELDS PART OF PARAMETER LIST */
/* */
/********************************************************************/
CSIOPTS = CSICLDI || CSIRESUM || CSIS1CAT || CSIRESRV
CSIFIELD = CSIFILTK || CSICATNM || CSIRESNM || CSIDTYPS || CSIOPTS
CSIFIELD = CSIFIELD || CSINUMEN || CSIFLD1

/********************************************************************/
/* */
/* INITIALIZE AND BUILD WORK ARE OUTPUT PART OF PARAMETER LIST */
/* */
/********************************************************************/
WORKLEN = 64000 /*@01C*/
DWORK = '0000FA00'X || COPIES('00'X,WORKLEN-4) /*@01C*/

/********************************************************************/
/* */
/* INITIALIZE WORK VARIABLES */
/* */
/********************************************************************/
RESUME = 'Y'
PREVNAME = '' /* NO PREVIOUS NAME @01A*/
CATNAMET = SUBSTR(' ',1,44)
DNAMET = SUBSTR(' ',1,44)

/********************************************************************/
/* */
/* SET UP LOOP FOR RESUME (IF A RESUME IS NCESSARY) */
/* */
/********************************************************************/
DO WHILE RESUME = 'Y'

/********************************************************************/
/* */
/* ISSUE LINK TO CATALOG GENERIC FILTER INTERFACE */
/* */
/********************************************************************/
ADDRESS LINKPGM 'IGGCSI00 MODRSNRC CSIFIELD DWORK'

RESUME = SUBSTR(CSIFIELD,150,1) /* GET RESUME FLAG FOR NEXT LOOP */
USEDLEN = C2D(SUBSTR(DWORK,9,4)) /* GET AMOUNT OF WORK AREA USED */
POS1=15 /* STARTING POSITION */

/********************************************************************/
/* */
/* PROCESS DATA RETURNED IN WORK AREA */
/* */
/********************************************************************/
DO WHILE POS1 < USEDLEN /* DO UNTIL ALL DATA IS PROCESSED*/
IF SUBSTR(DWORK,POS1+1,1) = '0' /* IF CATALOG, PRINT CATALOG HEAD*/
THEN DO
CATNAME=SUBSTR(DWORK,POS1+2,44)
IF CATNAME
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Feb 05, 2003 1:18 am    Post subject: Reply with quote

Akshaj, If I'm not wrong, all u want is to capture the list of datasets which start with the qualifier "abc.def.*". U can do this very easily.

The following Command will list all the datasets which start with the name/qualifier ABC.XYZ

Make sure not to use '*' in the name. U can get the name from the user with a '*' and then before using the following command, strip of the '.*' or '*' from the name. No Embedded * also are allowed.

Code:

  DIRECTORY = 'ABC.XYZ'

 CALL   OUTTRAP   "NAMELIST." 
"LISTD" DIRECTORY "LEVEL"     
 CALL   OUTTRAP   "OFF"       

 COUNT = 1                                       
 DO WHILE COUNT <= NAMELIST.0                   
      SAY STRIP(NAMELIST.COUNT)     
      COUNT = COUNT + 5       
 END                             


In the output of the above code, every 5th element will be the actual Dataset name. The other 4 rows will show the details of the datasets such as DSORG, VOLUME, ... This is the reason I'm incrementing the counter by 5. If u wish to see all the details increment the counter by 1.

The above code does not list any Datasets with the name exactly matching 'ABC.XYZ'. If u want that to be listed then u need to manually check for that as shown below.

Code:

IF SYSDSN(DIRECTORY) = 'OK' THEN         
 DO                               
      SAY DIRECTORY
 END


Hope this is what u want. Embarassed
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Feb 05, 2003 2:56 am    Post subject: Reply with quote

I never knew about the LEVEL parm on LISTDS but I tried it and it has a couple of serious drawbacks. It causes the data sets to be recalled if they are migrated. So that can take a very long time if the files are on tape. It also is subject to the TSO prefix in the profile so your example will not work if the profile has a prefix (unless that is what you intended). Finally, it looks like it probably updates the last referenced date, so it may mess up your backup or data set expiration procedures. You'd be better off using something that just goes against the catalog only and not the VTOC ( so use SVC 26, CSI, LMDLIST, LISTCAT, etc).

Personally, I don't like solutions that trap TSO command output because they are dependent on listing formats and those change occasionally. Invoking commands also can have unwanted side effects (like the ones listed above). I'd rather use documented programming interfaces such as APIs (as in IGGCSIRX) or chasing control blocks if those control blocks are gaurenteed by IBM to be stable from release to release. You have complete control over the input, output and side effects that way, and they will almost always perform orders of magnitude better.
Back to top
View user's profile Send private message Visit poster's website
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Wed Feb 05, 2003 4:11 am    Post subject: Reply with quote

I think it's OK to trap TSO output, as long as it's safe to do so.

Code:

/* REXX - display TSO help in browse */                         
                                                               
  arg cmd .                                                     
                                                               
  call outtrap 'Help.'                                         
                                                               
  "HELP" cmd                                                   
                                                               
  address 'ISPEXEC' "VGET (ZTEMPN) ASIS"                       
                                                               
  "EXECIO "Help.0" DISKW "ztempn" ( STEM Help. FINIS"           
                                                               
  address 'ISPEXEC' "LMINIT DATAID(BROWSEID) DDNAME("ZTEMPN")" 
  address 'ISPEXEC' "BROWSE DATAID(&BROWSEID)"                 
  address 'ISPEXEC' "LMFREE DATAID(&BROWSEID)"                 


I outtrap the LISTA dsn MEMBERS because LM services are so slow in REXX. Can't fault them in a compiled program, lightning quick...
_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group