|

Chicago-Soft
ATTN: TSO Times
One Maple Street
Hanover, NH 03755
(603) 643-4002
information
@tsotimes.com

|
|
Quick Tip - Executing
DSNTEP2
by Robert Mala
Following is an ISPF
Edit Macro I developed for executing SQL through the DB2 supplied utility
DSNTEP2. The only modification needed is to change the '[dsntep2 library]'
to the PDS that has the DSNTEP2 program at your shop. I have found it
to save alot of time in running ad-hoc queries.
Download this exec
in text format (FA96QT3-DSN2.TXT)
/* REXX */
/************************************************************/
/* Description: Edit macro to submit current edit session to DSNTEP2 in foreground and browse the output.*/
/************************************************************/
address ISPEXEC "ISREDIT MACRO"
j = 0
/* Save the current non-excluded lines from the current edit session */
address ISPEXEC "ISREDIT (lines) = LINENUM .ZLAST"
do i = 1 to lines
address ISPEXEC "ISREDIT (status) = XSTATUS" i
if status = 'NX' then do
address ISPEXEC "ISREDIT (line) = LINE" i
parse value line with line ' '
if line \= '' then do
j = j + 1
sysin.j = line
end
end
end
/* Display a message if all the lines are excluded and exit */
if j = 0 then do
zedsmsg = 'All lines are excluded'
address ISPEXEC "SETMSG MSG(ISRZ001)"
exit
end
/* Allocate SYSIN and SYSPRINT ddnames to temporary files and write
the saved edit session lines to SYSIN */
"ALLOC DDNAME(SYSIN) NEW UNIT(DISK) SPACE(3) TRACKS REUSE"
"EXECIO * DISKW SYSIN (STEM sysin. FINIS"
"ALLOC DDNAME(SYSPRINT) NEW UNIT(DISK) SPACE(8,2) TRACKS REUSE"
"NEWSTACK"
/* Place the RUN and END commands on the data stack and execute DSN */
queue "RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) LIB('[dsntep2 library]')"
queue "END"
address TSO "DSN SYSTEM(DSN)"
"DELSTACK"
/* Browse the SYSPRINT file */
address ISPEXEC "LMINIT DATAID(DSID) DDNAME(SYSPRINT)"
address ISPEXEC "BROWSE DATAID(&DSID)"
address ISPEXEC "LMFREE DATAID(&DSID)"
/* Free the SYSIN and SYSPRINT ddnames */
"FREE DDNAME(SYSIN,SYSPRINT)"
zedsmsg = 'Macro completed'
address ISPEXEC "SETMSG MSG(ISRZ001)"
exit
Robert Mala, Edgeware,
Middlesex, London
|
 |

|