MainframeSupports
tip week 19/2010:

When you during your daily work need to see which members a PDS consists of, you use a lot of different possibilities in ISPF. If you are going to build your own application which finds the member names for you it instantly becomes a lot more complicated. There is a bunch of ISPF services that produces member lists and they are not too complicated to implement in REXX. Unfortunately it is a lot harder to use ISPF services from COBOL or PL/I. And if you need to produce a member list in batch, ISPF is very difficult to use.

IBM has of course made some utilities that produces member lists, but they were coded a long time ago so they seem very old fashioned to use. They typically require you to know which volume your PDS resides on. Who worries about such details after the invention of SMS. Then I discovered a TSO command that is able to produce a member list. In batch you can use it like this:

//MEMLIST  EXEC PGM=IKJEFT01
//SYSTSIN  DD *
LISTDS 'MY.PDS.DATASET' MEMBERS
/*
//SYSTSPRT DD DISP=(NEW,CATLG),SPACE=(TRK,(1,1),RLSE),
//         LRECL=80,RECFM=FB,BLKSIZE=0,DSN=MY.MEMBER.LIST

If you use this piece of JCL please remember to make a DELETE step for dataset MY.MEMBER.LIST. You can also execute LISTDS as a TSO command from the ISPF command line and you can trap the output. The output in MY.MEMBER.LIST looks something like this:

READY
LISTDS 'MY.PDS.DATASET' MEMBERS
MY.PDS.DATASET
--RECFM-LRECL-BLKSIZE-DSORG
  FB    80    27920   PO

--VOLUMES--
  VOL001
--MEMBERS--
  FIRSTMEM
  ...
  LASTMEM
READY
END

You need to code some kind of interpretation of the output dataset before you get to the member list, but all in all it is a lot easier than coding ISPF services in COBOL or PL/I, not to mention executing the resulting program in batch using ISPF.

Previous tip in english        Sidste danske tip        Tip list