Thursday, February 18, 2016

TSO WHOHAS code in REXX

Sometimes we face job abends, or job waiting for resource owing to the fact that some datasets get into contention with some other jobs or some user is using that particular file. Most of the organizations use TSO WHOHAS command to check the user holding the dataset. In this post we will see the piece of code in REXX which makes the command work.

/* REXX*/
DSNAME = ARG(1)
IF DSNAME = ' ' THEN DO
          SAY  'ENTER DATASET NAME'
PARSE UPPER EXTERNAL DSNAME
END
ADDRESS TSO
IF SYSDSN("'"DSNAME"'") <>  'OK' THEN DO
    SAY "DATASET DOES NOT EXIST"
    ADDRESS ISREDIT
    EXIT
END
ADDRESS TSO "ISRDDN E  ' "DSNAME" ' "
EXIT
Simple piece of code and it uses ISRDDN utility. It is an IBM utility which lists all the allocated DDNAME for your current TSO session.

Without the rexx code also , we even can execute the command
TSO ISRDDN ENQ 'Data-set Name'
and it will show the corresponding information

No comments:

Post a Comment