Output from the TSO DSN Command

Lentine Chuck O

Output from the TSO DSN Command
I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck

Kenneth Kornblum

Re: Output from the TSO DSN Command
(in response to Lentine Chuck O)
Chuck,

I haven't personally tried this with the DSN processor, but I think you can
use the REXX OUTTRAP function to capture the DSN output and then process the
lines captured with an EXECIO yourself.

Hope this helps,
Ken Kornblum
Product Developer
BMC Software

-----Original Message-----
From: Lentine Chuck O [mailto:[login to unmask email]
Sent: Wednesday, October 06, 1999 2:07 PM
To: [login to unmask email]
Subject: [DB2-L] Output from the TSO DSN Command


I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck

Michael McCarthy

Re: Output from the TSO DSN Command
(in response to Kenneth Kornblum)
Chuck,

Before executing your DSN command in REXX, issue the OUTTRAP command to
capture the screen output to a stem variable.
An example would be: DUMMY = OUTTRAP('STEM.'). After the DSN command, you can
use OUTTRAP('OFF') to reset the output to the screen. In CLIST you will need to
set &SYSOUTTRAP to the number of lines you wish to capture, and use &SYSOUTLINE
to retrieve them.

-Mike.





Lentine Chuck O <[login to unmask email]> on 10/06/99 03:06:57 PM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>

To: [login to unmask email]
cc: (bcc: Michael McCarthy/DTC)
Subject: [DB2-L] Output from the TSO DSN Command




I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck

Gary V Scarcella

FW: Output from the TSO DSN Command
(in response to Michael McCarthy)
FYI, Here's a REXX exec named DSNX and DSNXSAY you can use as an example to
run DSN commands. May need to be modified for your particular environment
and DB2 subsystem names.

/*.REXX */
/*.*******************************************************************/
/*.DSNX: EXECUTE DB2 DSN COMMANDS & OUTPUT TO DISPLAY VIA EDIT */
/*.*******************************************************************/
/*.THIS EXEC IS A CUSTOMIZED VARIATION OF THE TSOX EXEC, WHICH CAN */
/*. BE USED FOR ALL TSO/IDCAMS/TSS COMMANDS. */
/*.*******************************************************************/
/*.FORMAT: DSNX SYSTEM */
/*.WHERE SYSTEM = S(SSID) */
/*.IF SYSTEM NOT PROVIDED THEN DEFAULT OR PROMPT FOR CORRECT SSID */
/*.NOTE: ARS SUBSYSTEMS GIVEN PREFERENCE FOR DEFAULT SSID */
/*. DSNX ? < RUN 'TSO HELPX' FOR THIS EXEC >*/
/*.*******************************************************************/
/*.E.G. DSNX */
/*.E.G. DSNX S(PPN) */
/*.*******************************************************************/
/*.YOU WILL BE PROMPTED TO ENTER DSN COMMAND(S) */
/*.THEY SHOULD FOLLOW NORMAL DB2 DSN COMMAND FORMAT EXCEPT: */
/*.LIMIT(*) WILL BE APPENDED TO -DIS DB() IF NOT PRESENT */
/*.*******************************************************************/
/*.DSN COMMANDS MAY BE PREFIXED WITH S(SSID) TO OVERRIDE SSID */
/*.THIS ALLOWS YOU TO RUN AGAINST MULTIPLE SUBSYSTEMS CONCURRENTLY */
/*.E.G. DSNX S(DSN) */
/*.E.G. -DIS UTIL(*) */
/*.E.G. S(UTST) -DIS UTIL(*) */
/*.E.G. S(PTST) -DIS UTIL(*) */
/*.*******************************************************************/
ARG PARMS /* THIS MUST BE THE 1ST COMMAND IN ORDER TO ACCEPT PARMS */
TRACE OFF
PARMS = STRIP(PARMS,B)
TSOENV = SYSVAR(SYSENV) /* FORE OR BACK */
IF (PARMS = '?' ) & TSOENV = 'FORE'
THEN DO
EXECNAME = SYSVAR(SYSICMD)
ADDRESS TSO "HELPX " EXECNAME
EXIT 0
END

DSNXPARM = STRIP(PARMS,B)
EXITRC = 0
SAY;SAY;SAY;SAY
MVSID = STORAGE(D2X(C2D(STORAGE(10,4))+340),4)
IF DSNXPARM = ''
THEN DO
CALL GETSSID
END
ELSE DO
PARSE VAR DSNXPARM "S" . "(" SSID ")"
SELECT
WHEN SSID = "DB2T" THEN OK = 'YES'
WHEN SSID = "DB2P" THEN OK = 'YES'
WHEN SSID = "DSN" THEN OK = 'YES'
WHEN SSID = "UTST" THEN OK = 'YES'
WHEN SSID = "PTST" THEN OK = 'YES'
WHEN SSID = "PPN" THEN OK = 'YES'
WHEN SSID = "FIN" THEN OK = 'YES'
WHEN SSID = "FDP1" THEN OK = 'YES'
WHEN SSID = "DB2E" THEN OK = 'YES'
WHEN SSID = "PIN" THEN OK = 'YES'
WHEN SSID = "FDT1" THEN OK = 'YES'
OTHERWISE DO
SAY "INVALID DB2 SSID:" SSID
CALL GETSSID
IF MVSID a= "AE82"
THEN DO
SAY "WOULD YOU LIKE TO RUN WITH DB2 SSID:" SSID" (Y/N)"
PULL ANSWER .
IF ANSWER = 'N' THEN EXIT 12
END
END
END /* SELECT */
END

HQUAL = USERID()
RANDOM#3= RANDOM(100,999) /* PRODUCE A RANDOM 3 DIGIT NUMBER */
RANDOM#4= RANDOM(1000,9999) /* PRODUCE A RANDOM 4 DIGIT NUMBER */
RANDOM# = RANDOM#3 || RANDOM#4 /* PRODUCE A RANDOM 7 DIGIT NUMBER */

EDITFILE = "'" || HQUAL || "." || MVSID || ".DSNX" ,
|| ".T" || RANDOM# || "'"

SAY "ENTER DB2 DSN COMMAND(S) BELOW FOR SSID:" SSID
SAY "ENTER NULL LINE OR 'END' TO EXIT THE DSN PROCESSOR"
COMMANDLINE = ''
DSNCOMMAND. = ''
DSNPARM. = "S("||SSID||")"
DSNCTR = 0

DO UNTIL COMMANDLINE = "END" | COMMANDLINE = "" | COMMANDLINE = "/*"
PULL COMMANDLINE
COMMANDLINE = STRIP(COMMANDLINE,B)
IF COMMANDLINE = "END" | COMMANDLINE = "" | COMMANDLINE = "/*"
THEN LEAVE
ELSE DO
DSNCTR = DSNCTR + 1
IF LEFT(COMMANDLINE,2) = "S("
THEN DO
PARSE VAR COMMANDLINE "S(" TEMPSSID ")" COMMANDLINE
DSNPARM.DSNCTR = "S("||TEMPSSID||")"
END
DSNCOMMAND.DSNCTR = STRIP(COMMANDLINE,B)
END
SAY DSNPARM.DSNCTR DSNCOMMAND.DSNCTR /* ECHO COMMAND LINE */
END /* DO UNTIL COMMANDLINE = "END" | ETC. */

/* INHIBIT MSG DISPLAY */
X = OUTTRAP("OUTPUT",0)
ADDRESS TSO "FREE F(DSNXDD)"
IF SYSDSN(EDITFILE) a= 'DATASET NOT FOUND'
THEN ADDRESS TSO "DELETE " EDITFILE
ADDRESS TSO "ALLOC F(DSNXDD) DA("EDITFILE") NEW SPACE(1,1) ",
"TRACK RECFM(F B) LRECL(132) "
ALLOCRC = RC
IF ALLOCRC > 0
THEN DO
SAY "ERROR ALLOCATING DSNX OUTPUT FILE"
EXIT 12
END

TRAP = OUTTRAP("DSNX.") /* SETUP TRAP VARIABLE (DEFAULT=CONCAT) */
DO I = 1 TO DSNCTR
IF LEFT(DSNCOMMAND.I,4) = "-DIS",
& ( LEFT(WORD(DSNCOMMAND.I,2),2) = "DB",
| LEFT(WORD(DSNCOMMAND.I,2),8) = "DATABASE" ),
& POS('LIMIT(',DSNCOMMAND.I) = 0
THEN DSNCOMMAND.I = DSNCOMMAND.I "LIMIT(*)"
/* SAY "* INSTREAM COMMENT" <== NOT CAPTURED IN TRAP VARIABLE */
CALL DSNXSAY LEFT(DSNPARM.I,7) DSNCOMMAND.I
/*-----------------------*/
QUEUE DSNCOMMAND.I
QUEUE "END"
SAY "EXECUTING: DSN" DSNPARM.I DSNCOMMAND.I
ADDRESS TSO DSN DSNPARM.I
/*-----------------------*/
DSNRC = RC
IF DSNRC > 0
THEN SAY "NON-ZERO RETURN CODE ("||DSNRC||") FROM ABOVE COMMAND"
END /* DO I = 1 TO DSNCTR */

TRAP = OUTTRAP(OFF) /* TURNOFF OUTTRAP */
DSNXCTR = DSNX.0

ADDRESS MVS "EXECIO" DSNXCTR "DISKW DSNXDD (FINIS STEM DSNX."

EDITMACRO = "EDITRSET"
EDITMACRO = STRIP(EDITMACRO,B)
ADDRESS ISPEXEC "EDIT DATASET("EDITFILE") MACRO("EDITMACRO")"

/* INHIBIT MSG DISPLAY */
X = OUTTRAP("OUTPUT",0)
IF SYSDSN(EDITFILE) a= 'DATASET NOT FOUND'
THEN ADDRESS TSO "DELETE " EDITFILE
ADDRESS TSO "FREE F(DSNXDD)"
/* RESTART MSG DISPLAY */
X = OUTTRAP("OFF")

EXIT EXITRC


/*--------------------------------------------------------------------*/
GETSSID:
/*--------------------------------------------------------------------*/
MVSID = STORAGE(D2X(C2D(STORAGE(10,4))+340),4)
SSID = ''
SELECT
WHEN MVSID = "AE20" THEN SSID = "DB2T"
WHEN MVSID = "AE23" THEN SSID = "DB2P"
WHEN MVSID = "AE82" THEN SSID = "DSN"
WHEN MVSID = "AE84" THEN SSID = "UTST"
WHEN MVSID = "AE81" THEN SSID = "PPN"
WHEN MVSID = "AE37" THEN SSID = "FIN"
WHEN MVSID = "AE41" THEN SSID = "FDP1"
OTHERWISE DO
SAY "DB2 SSID ID NOT KNOWN FOR SESSION MVS ID" MVSID
SAY "EXITING WITH RETURN CODE = 107"
EXIT 107
END
END /* SELECT */

IF MVSID = "AE82"
THEN DO
SAY "PLEASE SELECT ENVIRONMENT TO RUN DSN COMMAND PROCESSOR IN"
SAY "1. DSN - DEVELOPMENT (OR HIT ENTER TO DEFAULT)"
SAY "2. PTST - PRODUCTION FIX"
PULL CHOICE .
SELECT
WHEN CHOICE = 1 THEN SSID = "DSN"
WHEN CHOICE = 2 THEN SSID = "PTST"
OTHERWISE SSID = "DSN"
END /*SELECT*/
END

RETURN


/*.REXX */
/*.*******************************************************************/
/*.DSNXSAY: ECHO DB2 DSN COMMANDS */
/*.*******************************************************************/
/*.THIS IS USED BY THE DSNX EXEC WHICH HAS OUTTRAP ON TO CAPTURE THIS */
/*.*******************************************************************/
ARG DSNCOMMAND
TRACE OFF
SAY
SAY ,
"*--------------------------------------------------------------------*"
SAY DSNCOMMAND
SAY ,
"*--------------------------------------------------------------------*"
EXIT 0


Gary Scarcella
Internet address: [login to unmask email]


> ----------
> From: Lentine Chuck O[SMTP:[login to unmask email]
> Reply To: DB2 Data Base Discussion List
> Sent: Wednesday, October 06, 1999 3:06 PM
> To: [login to unmask email]
> Subject: Output from the TSO DSN Command
>
> I would like to write a CLIST or a REXX command to issue the -DISPLAY
> DATABASE(XYZ) LIMIT(*) command and have the output written to a file
> instead
> of displayed on the screen. If I run the command in batch the output goes
> to the SYSTSPRT file. So I tried allocating that file to a dataset but
> the
> data still displayed on the screen. So I tried allocating SYSPRINT and
> SYSTERM to files but the data still displayed on the screen. Has anyone
> successfully captured the command output from a DSN command in a dataset?
> If so, how did you do it?
>
> Chuck
>

Rick Creech

Re: Output from the TSO DSN Command
(in response to Gary V Scarcella)
I fyou want to do it from batch, here is the JCL:

//STEP01 EXEC PGM=IKJEFT01
//STEPLIB DD DSN=DB2.DBT1.SDSNLOAD,DISP=SHR
//SYSTSPRT DD DSN=DB2.DBT1.GBPOOL.INFO,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(1,1)),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSUDUMP DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(DBT1)
-DISPLAY GBPOOL(GBP0) GDETAIL(*)
-DISPLAY GBPOOL(GBP1) GDETAIL(*)
END
//

Rick Creech



>From: "Kornblum, Kenneth" <[login to unmask email]>
>Reply-To: DB2 Data Base Discussion List <[login to unmask email]>
>To: [login to unmask email]
>Subject: Re: Output from the TSO DSN Command
>Date: Wed, 6 Oct 1999 14:23:29 -0500
>
>Chuck,
>
>I haven't personally tried this with the DSN processor, but I think you can
>use the REXX OUTTRAP function to capture the DSN output and then process
>the
>lines captured with an EXECIO yourself.
>
>Hope this helps,
>Ken Kornblum
>Product Developer
>BMC Software
>
>-----Original Message-----
>From: Lentine Chuck O [mailto:[login to unmask email]
>Sent: Wednesday, October 06, 1999 2:07 PM
>To: [login to unmask email]
>Subject: [DB2-L] Output from the TSO DSN Command
>
>
>I would like to write a CLIST or a REXX command to issue the -DISPLAY
>DATABASE(XYZ) LIMIT(*) command and have the output written to a file
>instead
>of displayed on the screen. If I run the command in batch the output goes
>to the SYSTSPRT file. So I tried allocating that file to a dataset but the
>data still displayed on the screen. So I tried allocating SYSPRINT and
>SYSTERM to files but the data still displayed on the screen. Has anyone
>successfully captured the command output from a DSN command in a dataset?
>If so, how did you do it?
>
>Chuck
>
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Tim Lowe

Re: Output from the TSO DSN Command
(in response to Rick Creech)
Ken,
Excellent idea. I have used this a few times. I works very well. Example:

/************************** REXX **************************************/
Queue "-DIS thread(*)"
Queue "END"
Y = OUTTRAP(DB2CMND.,"*","NOCONCAT")
"DSN S("DB2t")"
rc_xx = rc ; if rc_xx > 8 then do;say 'rc=' rc_xx ;exit 4 ; end
Y = OUTTRAP("OFF")
DO I = 1 TO DB2CMND.0
SAY '!!!' DB2cmnd.I
END
exit 0

I hope this helps.

Thanks,
Tim







"Kornblum, Kenneth" <[login to unmask email]> on 10/06/99 02:23:29 PM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>








To: [login to unmask email]

cc: (bcc: Tim Lowe/sfm/spc)



Subject: Re: Output from the TSO DSN Command








Chuck,

I haven't personally tried this with the DSN processor, but I think you can
use the REXX OUTTRAP function to capture the DSN output and then process the
lines captured with an EXECIO yourself.

Hope this helps,
Ken Kornblum
Product Developer
BMC Software

-----Original Message-----
From: Lentine Chuck O [mailto:[login to unmask email]
Sent: Wednesday, October 06, 1999 2:07 PM
To: [login to unmask email]
Subject: [DB2-L] Output from the TSO DSN Command


I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck

Harold Lee

Re: Output from the TSO DSN Command
(in response to Tim Lowe)
Try this; it works on my system. Just change the SSID's that you check for.

Duane

/* REXX - DISPDB ***************************************************/
/* */
/* DISPLAY DATABASE AND THREAD INFORMATION FOR THE SSID INDICATED */
/* */
/********************************************************************/
CLEAR
/*ARG SSID */
SAY "ENTER SSID"
PULL SSID
CALL CHKSSID
IF SSIDOK = "NOGO" THEN
DO
SAY "SSID IS REQUIRED - PLEASE ENTER A VALID SSID"
CALL GETSSID
END
QUEUE "-DISPLAY DB(*) SPACE(*) RESTRICT"
QUEUE "-DISPLAY DB(*) SPACE(*) LIMIT(*)"
QUEUE "-DISPLAY THREAD(*)"
QUEUE "END"
X=OUTTRAP("DBNFO.",,"NOCONCAT")
ADDRESS TSO "DSN SYSTEM("||SSID||")"
X=OUTTRAP("OFF")
/* */
/* PROCESS DATABASE INFORMATION */
/* */
DO I = 1 TO DBNFO.0
SAY DBNFO.I
END
EXIT
/********************************************************************/
/* CHECK THE SSID ENTERED FOR VALIDITY */
/********************************************************************/
CHKSSID:
IF SSID \= "" THEN
DO
SELECT
WHEN SSID = "DB2B"
THEN SSIDOK = "OK"
WHEN SSID = "DB2C"
THEN SSIDOK = "OK"
WHEN SSID = "DB2A"
THEN SSIDOK = "OK"
WHEN SSID = "DB2E"
THEN SSIDOK = "OK"
OTHERWISE
SSIDOK = "NOGO"
END
END
ELSE
SSIDOK = "NOGO"
RETURN
/********************************************************************/
/* GET THE SSID */
/********************************************************************/
GETSSID:
DO FOREVER
SAY "CHOOSE FROM: DB2B, DB2C, DB2A, DB2E"

PULL SSID
CALL CHKSSID
IF SSIDOK = "OK" THEN
DO
CLEAR
LEAVE
END
CLEAR
SAY "SSID IS REQUIRED - PLEASE ENTER A VALID SSID"
END
RETURN

> -----Original Message-----
> From: Lentine Chuck O [SMTP:[login to unmask email]
> Sent: Wednesday, October 06, 1999 12:07 PM
> To: [login to unmask email]
> Subject: Output from the TSO DSN Command
>
> I would like to write a CLIST or a REXX command to issue the -DISPLAY
> DATABASE(XYZ) LIMIT(*) command and have the output written to a file
> instead
> of displayed on the screen. If I run the command in batch the output goes
> to the SYSTSPRT file. So I tried allocating that file to a dataset but
> the
> data still displayed on the screen. So I tried allocating SYSPRINT and
> SYSTERM to files but the data still displayed on the screen. Has anyone
> successfully captured the command output from a DSN command in a dataset?
> If so, how did you do it?
>
> Chuck

Dan S Brogdon

Re: Output from the TSO DSN Command
(in response to Harold Lee)
We have a batch job that does a display , i.e.
-DIS BPOOL(BP0) DETAIL(INTERVAL) LIST(*) LSTATS
via TSO, then parse/format the output, then load it to a DB2 table for
analysis, (doing the same for GDETAIL and MDETAIL for several
n-way plexes.) The last step executes QMF for a formated report.

DB2 Subsystem Support
American Express

Scott Goodell

Re: Output from the TSO DSN Command
(in response to Dan S Brogdon)
I added a few lines to Tim Lowe's exec to allow the output to be browsed instead
of scroll off. Thought I'd share it.

/************************** REXX **********************************/
PARSE ARG SSID CMD
QUEUE CMD
QUEUE "END"
Y = OUTTRAP(DB2CMND.,"*","NOCONCAT")
"DSN S("SSID")"
RC_XX = RC ; IF RC_XX > 8 THEN DO;SAY 'RC=' RC_XX ;EXIT 4 ; END
Y = OUTTRAP("OFF")
"ALLOC F(TEMPDS) STORCLAS(STANDARD) AVGREC(U) SPACE(300 0),
RECFM(F B) LRECL(80) DSORG(PS) REUSE"
"EXECIO " DB2CMND.0 " DISKW TEMPDS (STEM DB2CMND. FINIS"
ADDRESS "ISPEXEC"
"LMINIT DATAID(DDVAR) DDNAME(TEMPDS)"
"BROWSE DATAID(&DDVAR)"
"LMFREE DATAID(DDVAR)"
ADDRESS "TSO"
"FREE F(TEMPDS)"
EXIT 0






[login to unmask email] on 10/06/99 03:06:27 PM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>

To: [login to unmask email]
cc: (bcc: Scott Goodell/CDR/BSM/MCI)
Subject: Re: Output from the TSO DSN Command




Ken,
Excellent idea. I have used this a few times. I works very well. Example:

/************************** REXX **************************************/
Queue "-DIS thread(*)"
Queue "END"
Y = OUTTRAP(DB2CMND.,"*","NOCONCAT")
"DSN S("DB2t")"
rc_xx = rc ; if rc_xx > 8 then do;say 'rc=' rc_xx ;exit 4 ; end
Y = OUTTRAP("OFF")
DO I = 1 TO DB2CMND.0
SAY '!!!' DB2cmnd.I
END
exit 0

I hope this helps.

Thanks,
Tim







"Kornblum, Kenneth" <[login to unmask email]> on 10/06/99 02:23:29 PM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>








To: [login to unmask email]

cc: (bcc: Tim Lowe/sfm/spc)



Subject: Re: Output from the TSO DSN Command








Chuck,

I haven't personally tried this with the DSN processor, but I think you can
use the REXX OUTTRAP function to capture the DSN output and then process the
lines captured with an EXECIO yourself.

Hope this helps,
Ken Kornblum
Product Developer
BMC Software

-----Original Message-----
From: Lentine Chuck O [mailto:[login to unmask email]
Sent: Wednesday, October 06, 1999 2:07 PM
To: [login to unmask email]
Subject: [DB2-L] Output from the TSO DSN Command


I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck

Ran Abeykoon

Re: Output from the TSO DSN Command
(in response to Scott Goodell)
Chuck,

As others suggested you can capture the output of DB2 commands into a data set
using the REXX OUTTRAP command. However it's a longer way of achieving the
desired result.
The best and the cleanest way to capture the output is by allocating a data set
to a file called DSNTRACE which DB2 uses to write the results of DB2 commands.
But remember to use the TEST(0) option when connecting to the DB2 sub system to
guarantee the output is written to DSNTRACE file. I've used this technique and
developed extremely useful utilities for a number of organisations to train
inexperienced DB2 personnel. The basic coding is as follows.

ACCESS_DB2 :
"FREE F(DSNTRACE)"
IF SYSDSN(USERID().DSNTRACE) ¬= 'OK' THEN
"ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) " ,
"UNIT(SYSDA) RECFM(F B) LRECL(0) BLKSIZE(13300) " ,
"SPACE(1,1) CYLINDER NEW REU"
ELSE
"ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) SHR REU"
NEWSTACK
QUEUE '-DIS DB(XYZ) SPACE(*) LIMIT(*)'

QUEUE 'END'
QUEUE ''
"DSN SYSTEM("SSID") TEST(0)"
CONRC = RC
DELSTACK
"ISPEXEC BROWSE DATASET("USERID()".DSNTRACE)"

If you need any further details, please contact me personally.

Regards,

Ran Abeykoon
Technical Consultant/AMPLUS




Date: Wed, 6 Oct 1999 15:06:57 -0400
From: Lentine Chuck O <[login to unmask email]>
Subject: Output from the TSO DSN Command

I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck

Ran Abeykoon

Re: Output from the TSO DSN Command
(in response to Ran Abeykoon)
Chuck,
A small correction to my previous reply. Please use TEST(1) instead of TEST(0)
when connecting to DB2 sub system. Also if you don't want the output written to
both screen and the DSNTRACE data set use MSG('OFF') REXX command which stops
messages written directly to the screen.


Regards,

Ran Abeykoon
Technical Consultant/AMPLUS




As others suggested you can capture the output of DB2 commands into a data set
using the REXX OUTTRAP command. However it's a longer way of achieving the
desired result.
The best and the cleanest way to capture the output is by allocating a data set
to a file called DSNTRACE which DB2 uses to write the results of DB2 commands.
But remember to use the TEST(0) option when connecting to the DB2 sub system to
guarantee the output is written to DSNTRACE file. I've used this technique and
developed extremely useful utilities for a number of organisations to train
inexperienced DB2 personnel. The basic coding is as follows.

ACCESS_DB2 :
"FREE F(DSNTRACE)"
IF SYSDSN(USERID().DSNTRACE) ¬= 'OK' THEN
"ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) " ,
"UNIT(SYSDA) RECFM(F B) LRECL(0) BLKSIZE(13300) " ,
"SPACE(1,1) CYLINDER NEW REU"
ELSE
"ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) SHR REU"
NEWSTACK
QUEUE '-DIS DB(XYZ) SPACE(*) LIMIT(*)'

QUEUE 'END'
QUEUE ''
"DSN SYSTEM("SSID") TEST(0)"
CONRC = RC
DELSTACK
"ISPEXEC BROWSE DATASET("USERID()".DSNTRACE)"

If you need any further details, please contact me personally.

Regards,

Ran Abeykoon
Technical Consultant/AMPLUS




Date: Wed, 6 Oct 1999 15:06:57 -0400
From: Lentine Chuck O <[login to unmask email]>
Subject: Output from the TSO DSN Command

I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck

Jim Keohane

Re: Output from the TSO DSN Command
(in response to Ran Abeykoon)
Ran,

Does DSN ... TEST(0) write to DSNTRACE any more info than one would see when
running same code under non-TSO batch via Call Attach Facility (CAF) with

//DSNTRACE DD SYSOUT=....

Thanks! - Jim

Ran Abeykoon wrote:

> Chuck,
>
> As others suggested you can capture the output of DB2 commands into a data set
> using the REXX OUTTRAP command. However it's a longer way of achieving the
> desired result.
> The best and the cleanest way to capture the output is by allocating a data set
> to a file called DSNTRACE which DB2 uses to write the results of DB2 commands.
> But remember to use the TEST(0) option when connecting to the DB2 sub system to
> guarantee the output is written to DSNTRACE file. I've used this technique and
> developed extremely useful utilities for a number of organisations to train
> inexperienced DB2 personnel. The basic coding is as follows.
>
> ACCESS_DB2 :
> "FREE F(DSNTRACE)"
> IF SYSDSN(USERID().DSNTRACE) ¬= 'OK' THEN
> "ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) " ,
> "UNIT(SYSDA) RECFM(F B) LRECL(0) BLKSIZE(13300) " ,
> "SPACE(1,1) CYLINDER NEW REU"
> ELSE
> "ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) SHR REU"
> NEWSTACK
> QUEUE '-DIS DB(XYZ) SPACE(*) LIMIT(*)'
>
> QUEUE 'END'
> QUEUE ''
> "DSN SYSTEM("SSID") TEST(0)"
> CONRC = RC
> DELSTACK
> "ISPEXEC BROWSE DATASET("USERID()".DSNTRACE)"
>
> If you need any further details, please contact me personally.
>
> Regards,
>
> Ran Abeykoon
> Technical Consultant/AMPLUS
>
> Date: Wed, 6 Oct 1999 15:06:57 -0400
> From: Lentine Chuck O <[login to unmask email]>
> Subject: Output from the TSO DSN Command
>
> I would like to write a CLIST or a REXX command to issue the -DISPLAY
> DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
> of displayed on the screen. If I run the command in batch the output goes
> to the SYSTSPRT file. So I tried allocating that file to a dataset but the
> data still displayed on the screen. So I tried allocating SYSPRINT and
> SYSTERM to files but the data still displayed on the screen. Has anyone
> successfully captured the command output from a DSN command in a dataset?
> If so, how did you do it?
>
> Chuck

--
Jim Keohane
Brigadier Consultant

LockStar, Inc.
777 Passaic Avenue
Clifton, NJ 07012

Tel: (973) 249-9410 Ext. 231
Fax: (973) 249-9257
http://www.lockstar.com

May those who love us, love us
And those that don't love us,
May God turn their hearts.
And if he doesn't turn their hearts,
May he turn their ankles
So we'll know them by their limping.

- - - Old Gaelic Blessing

Ran Abeykoon

Re: Output from the TSO DSN Command
(in response to Jim Keohane)
Jim,
Yes,you're right. CAF writes diagnostic trace messages if you allocate a
DSNTRACE data
set either dynamically or by including a //DSNTRACE DD statement in your JCL,
FYI,
following is more details from the IBM Manuals regarding the use of the TEST
parameter.

TEST(integer)
integer specifies the last two digits of the module name in order to
trace a single DSN module. Specify a number greater than 100 to trace
all DSN modules. DSN trace information messages are written to the
TSO SYSTSPRT DD statement, and optionally, to the DSNTRACE DD
statement.

Regards,

Ran Abeykoon
Technical Consultant/AMPlus

Date: Fri, 8 Oct 1999 11:24:26 -0700
From: Jim Keohane <[login to unmask email]>
Subject: Re: Output from the TSO DSN Command

Ran,

Does DSN ... TEST(0) write to DSNTRACE any more info than one would see when
running same code under non-TSO batch via Call Attach Facility (CAF) with

//DSNTRACE DD SYSOUT=....

Thanks! - Jim


Chuck,
A small correction to my previous reply. Please use TEST(1) instead of TEST(0)
when connecting to DB2 sub system. Also if you don't want the output written to
both screen and the DSNTRACE data set use MSG('OFF') REXX command which stops
messages written directly to the screen.


Regards,

Ran Abeykoon
Technical Consultant/AMPLUS


As others suggested you can capture the output of DB2 commands into a data set
using the REXX OUTTRAP command. However it's a longer way of achieving the
desired result.
The best and the cleanest way to capture the output is by allocating a data set
to a file called DSNTRACE which DB2 uses to write the results of DB2 commands.
But remember to use the TEST(0) option when connecting to the DB2 sub system to
guarantee the output is written to DSNTRACE file. I've used this technique and
developed extremely useful utilities for a number of organisations to train
inexperienced DB2 personnel. The basic coding is as follows.

ACCESS_DB2 :
"FREE F(DSNTRACE)"
IF SYSDSN(USERID().DSNTRACE) ¬= 'OK' THEN
"ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) " ,
"UNIT(SYSDA) RECFM(F B) LRECL(0) BLKSIZE(13300) " ,
"SPACE(1,1) CYLINDER NEW REU"
ELSE
"ALLOC F(DSNTRACE) DA("USERID()".DSNTRACE) SHR REU"
NEWSTACK
QUEUE '-DIS DB(XYZ) SPACE(*) LIMIT(*)'

QUEUE 'END'
QUEUE ''
"DSN SYSTEM("SSID") TEST(0)"
CONRC = RC
DELSTACK
"ISPEXEC BROWSE DATASET("USERID()".DSNTRACE)"

If you need any further details, please contact me personally.

Regards,

Ran Abeykoon
Technical Consultant/AMPLUS




Date: Wed, 6 Oct 1999 15:06:57 -0400
From: Lentine Chuck O <[login to unmask email]>
Subject: Output from the TSO DSN Command

I would like to write a CLIST or a REXX command to issue the -DISPLAY
DATABASE(XYZ) LIMIT(*) command and have the output written to a file instead
of displayed on the screen. If I run the command in batch the output goes
to the SYSTSPRT file. So I tried allocating that file to a dataset but the
data still displayed on the screen. So I tried allocating SYSPRINT and
SYSTERM to files but the data still displayed on the screen. Has anyone
successfully captured the command output from a DSN command in a dataset?
If so, how did you do it?

Chuck