MainframeSupports
tip week 26/2008:

As long as I can remember DSLIST has supported user made line commands. In this tip I will present the line command II which you will find hard to live without even though you did not miss it in the first place.

It is extremely easy and simple to create a line command for DSLIST. You just create a REXX with the name of the line command. Before creating it you have to ensure that it does not have the name of one of the DSLIST builtin line commands. II is not used by DSLIST so it is free. Your REXX will be executed when you type in its name as a line command next to a dataset in DSLIST and press Enter. The dataset name is made available to your REXX by using an ARG DSNAME. After the execution of this statement DSNAME holds the dataset name surrounded by hyphens (').

Now you have been introduced to the general concept of making line commands for DSLIST. Now I will show you an example. In DSLIST you may use the I line command next to a non VSAM dataset and it will display a panel with all sorts of information about the allocation of the dataset. If you type I next to a VSAM dataset ISPF will lead you through a completely useless dialog which will (after much trouble) execute a LISTCAT against the dataset. But it will a thousand times easier to use II instead. Just code a REXX named II like this:

/* REXX: II */
ARG DSNAME
DSNAME = STRIP(DSNAME, 'BOTH', '''')
LISTDD = 'LISTCAT0'
CALL MSG('OFF')
ADDRESS TSO "ALLOCATE FILE("LISTDD") UNIT(VIO) BLOCK(4096) REUSE"!!,
            " SPACE(1) BLKSIZE(4089) LRECL(125) RECFM(V B)"
IF RC = 0
THEN DO
  ADDRESS TSO "LISTCAT ENTRIES('"DSNAME"') ALL OUTFILE("LISTDD")"
  IF RC = 0
  THEN DO
    ADDRESS ISPEXEC "LMINIT DATAID(LISTID) DDNAME("LISTDD")"
    IF RC = 0
    THEN DO
      ADDRESS ISPEXEC "VIEW DATAID("LISTID")"
      ADDRESS ISPEXEC "LMFREE DATAID("LISTID")"
    END
  END
  ELSE
    CALL ISPF_MESSAGE 'DATASET DELETED',,
         'DATASET 'DSNAME' DELETED BY ANOTHER USER.'
  ADDRESS TSO "FREE FILE("LISTDD")"
END
ELSE
  CALL ISPF_MESSAGE 'ALLOCATION ERROR',,
       'ALLOC FAILED WITH RC='RC
EXIT

When you use II as line command next to a dataset the result of a LISTCAT ALL against the dataset will be displayed. It is not especially useful for non VSAM datasets, but used on a VSAM dataset it is a whole new ballgame compared to the I line command. Whether you will use VIEW or BROWSE to display the result is completely up to your taste. The REXX in the example will only work in one split session in ISPF so you have to work out your own way to make II work in more than one split session at the same time.

Previous tip in english        Sidste danske tip        Tip list