I used OUTRAP to capture the output but the OUTRAP is not capturing the data
/* REXX */
SAY "ENTER HLQ"
PARSE UPPER PULL DSN1
ADDRESS TSO
X = OUTTRAP('VAR.')
"HLIST DSNAME('"DSN1"') BCDS"
SAY 'THE NO OF LINES TRAPPED IS' VAR.0
LINES = VAR.0 + 1
DO I=LINES TO VAR.0
SAY VAR.I
END
X = OUTTRAP('OFF')
IF RC > 0 THEN
SAY 'YOUR O/P IS WRITTEN'
ELSE
SAY 'SORRY SOME ERROR HAS OCCURED' RC
EXIT
SAY "ENTER HLQ"
PARSE UPPER PULL DSN1
ADDRESS TSO
X = OUTTRAP('VAR.')
"HLIST DSNAME('"DSN1"') BCDS"
SAY 'THE NO OF LINES TRAPPED IS' VAR.0
LINES = VAR.0 + 1
DO I=LINES TO VAR.0
SAY VAR.I
END
X = OUTTRAP('OFF')
IF RC > 0 THEN
SAY 'YOUR O/P IS WRITTEN'
ELSE
SAY 'SORRY SOME ERROR HAS OCCURED' RC
EXIT
Please let me knwo if corrections required or cant we capture the data of HLIST commands using OUTTRAP?