Thanks,
John Routh
Canada Life Assurance
Toronto, Canada
address ispexec
"tbquery" tbl "names(vl) keys(kl)"
vl = vl kl /* combine lists */
/* make comma-delimited model */
do i=1 to words(vl)-1
mdl = word(vl,i)"','"
end
mdl = mdl"','"word(vl,i+1)
"vget (vl)" /* make addressability */
do forever
"tbskip" tbl
if rc>0 then leave
interpret "queue" mdl
end
address TSO "execio" queued() "diskw sysut2 (finis"
rgds
Willy
----------------------------------------------------------------------------
To invoke this, we put this in SYSIN:
PROFILE PRE(whatever)
ISPSTART CMD(APTSLIST)
LOGOFF
Good luck!
Kevin McGrath
BMC Software
San Jose, CA
All opinions are my own, and do not represent BMC Software, etc.....
-----Original Message-----
From: John Routh [mailto:John_...@CANADALIFE.COM]
Sent: Wednesday, January 03, 2001 11:01 AM
To: ISP...@listserv.nd.edu
Subject: Copy contents of ISPF table
Interpretive ISPF applications are always dogs compared to compiled or
assembled ones. I have seen in most cases, that ISPF is actually very
optimized for what it provides (my compliments to the developers).
In your case, is the REXX EXEC compiled or interpretive? Many moons
ago we had a monster application written in REXX that sped up more than
10 fold when compiled.
Also, design and actual I/O factor in quite heavily to elapsed time.
Cheers...
Michael
__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/
Often, the recommendation is to break out heavy table processing like this, and write
just that code in CLIST or COBOL or whatever (calling the processor via SELECT CMD or
SELECT PGM to get the environment correct, of course).
-Doug
Doug Nadel
----------------------------------------
ISPF and OS/390 Tools & Toys page:
http://somebody.home.mindspring.com/
Mail containing HTML or any attachments, including vcf files, is
automatically discarded. If you need to send me an attachment,
please let me know so that I can change my email filters.
- seb
--- cut here ---
/* REXX */
trace off
signal on failure
signal on halt
signal on novalue
parse value "" with ,
cdate ctime udate utime user rowcreat rowcurr rowupd tableupd ,
service retcode status1 status2 status3 library ,
keys names rownum keynum namenum position
/* XPROC is available from the CBT tape. Or else use something like:
*
* parse upper arg tablename args
* parse var args . "LIB( library ")" .
* parse var args . "LIBRARY( library ")" .
* parse var args . "OUTPUT( outputdataset ")" .
* parse var args . "OUTPUTDATASET( outputdataset ")" .
* if wordpos("NOOPEN",args)=0 then noopen=""; else noopen="NOOPEN"
*
*/
"XPROC 1 TABLENAME NOOPEN OUTPUTDATASET() LIBRARY()"
if rc <> 0 then do
say ,
"Usage: SHOWTABL tablename {NOOPEN OUTPUT(filename) LIBRARY(ddname)}"
exit 1
end
address ISPEXEC "CONTROL ERRORS RETURN"
if noopen = "" then do
/*
* address ISPEXEC "TBCLOSE" tablename
* if rc <> 0 then say "TBCLOSE rc = " rc
*/
zerrsm = ""
if library <> "" then ,
address ISPEXEC "TBOPEN" tablename "LIBRARY("library")"
else ,
address ISPEXEC "TBOPEN" tablename
if translate(zerrsm) = "TABLE ALREADY OPEN" then nop
else if rc = 8 then do
say "Table does not exist:" tablename
exit 8
end
else if rc > 0 then signal ispferror
end
if outputdataset <> "" then do
if sysdsn(outputdataset) <> "OK" then do
address tso ,
"ALLOC DA("outputdataset") NEW BLOCK(6233) SPACE(11 10)" ,
"RECFM(V B) LRECL(255) BLKSIZE(6233) DSORG(PS)"
if rc <> 0 then exit rc
end
address tso "ALLOC FI(SHOWTABL) REU OLD DA("outputdataset")"
if rc <> 0 then exit rc
"newstack"
end
call ispf "TBSTATS" tablename ,
"CDATE(CDATE) CTIME(CTIME) UDATE(UDATE) UTIME(UTIME)",
"USER(USER) ROWCREAT(ROWCREAT) ROWCURR(ROWCURR)",
"ROWUPD(ROWUPD) TABLEUPD(TABLEUPD) SERVICE(SERVICE)",
"RETCODE(RETCODE) STATUS1(STATUS1) STATUS2(STATUS2)",
"STATUS3(STATUS3) LIBRARY(LIBRARY)"
call out
call out "Data from TBSTATS"
call out
call out "Creation date......." cdate
call out "Creation time......." ctime
call out "Date last updated..." udate
call out "Time last updated..." utime
call out "Last updated by....." user
call out "Rows at creation...." rowcreat
call out "Current rows........" rowcurr
call out "Rows updated........" rowupd
call out "Table updates......." tableupd
/*
call out "Last ISPF service..." service
call out "Last ISPF retcode..." retcode
call out "Status in input library........" status1
call out "Status in logical screen......." status2
call out "Status of write availability..." status3
call out "Alternate input library........" library
*/
call ispf "TBQUERY" tablename ,
"KEYS(KEYS) NAMES(NAMES) ROWNUM(ROWNUM) KEYNUM(KEYNUM)" ,
"NAMENUM(NAMENUM) POSITION(POSITION)"
call out
call out "Data from TBQUERY"
call out
call out "Key variables............." keys
call out "Row variables............." names
call out "Number of rows............" rownum
call out "Number of key variables..." keynum
call out "Number of row variables..." namenum
/*
call out "Current row number........" position
*/
if keynum = 0 then call dump_unkeyed_table tablename, names
else call dump_keyed_table tablename, names, keys
halt:
if noopen = "" then do
call ispf "TBCLOSE" tablename
end
if outputdataset <> "" then do
howmanylines = queued()
queue ""
"EXECIO * DISKW SHOWTABL (FINIS)"
execiorc = rc
"delstack"
if execiorc = 0 then say "Wrote" howmanylines "lines to" outputdataset
else say "Failed to write to" outputdataset", rc="execiorc
end
exit 0
dump_unkeyed_table: procedure expose outputdataset
parse arg tablename, variablenames
variablenames = translate(variablenames," ","()")
variablecount = words(variablenames)
call ispf "TBTOP" tablename
do forever
call ispf "TBSKIP" tablename
if result = 8 then leave
parse value "" with savename rowid position
call ispf "TBGET" tablename ,
"SAVENAME(SAVENAME) ROWID(ROWID) POSITION(POSITION)"
if result > 0 then leave
call out
call out "Table row" position ", rowid:" rowid+0
call out
call out "savename...." savename
call out "rowid......." rowid
call out "position...." position
call out
call out "Row variables:"
call out
do variableindex = 1 to variablecount
call showvar word(variablenames,variableindex)
end
extensionvariablenames = translate(savename," ","()")
extensionvariablecount = words(extensionvariablenames)
if extensionvariablecount > 0 then do
call out
call out "Extension variables:"
call out
do extensionindex = 1 to extensionvariablecount
call showvar word(extensionvariablenames,extensionindex)
end
end
end
return 0
dump_keyed_table: procedure expose outputdataset
parse arg tablename, variablenames, keyvariablenames
variablenames = translate(variablenames," ","()")
variablecount = words(variablenames)
keyvariablenames = translate(keyvariablenames," ","()")
keyvariablecount = words(keyvariablenames)
call ispf "TBTOP" tablename
do forever
parse value "" with savename rowid position
call ispf "TBSKIP" tablename ,
"SAVENAME(SAVENAME) ROWID(ROWID) POSITION(POSITION)"
if result = 8 then leave
call out
call out "Table row:" rowid+0
/*
call out
call out "savename...." savename
call out "rowid......." rowid
call out "position...." position
*/
call out
call out "Key variables:"
call out
do keyvariableindex = 1 to keyvariablecount
call showvar word(keyvariablenames,keyvariableindex)
end
call out
call out "Row variables:"
call out
do variableindex = 1 to variablecount
call showvar word(variablenames,variableindex)
end
extensionvariablenames = translate(savename," ","()")
extensionvariablecount = words(extensionvariablenames)
if extensionvariablecount > 0 then do
call out
call out "Extension variables:"
call out
do extensionindex = 1 to extensionvariablecount
call showvar word(extensionvariablenames,extensionindex)
end
end
end
return 0
showvar: parse arg variable
call out left(variable,16,".") || value(variable)
return 0
out: parse arg outstring
if outputdataset = "" then say outstring
else do
if outstring = "" then queue " "
else do
do while length(outstring) > 250
junk = left(outstring,250)
queue junk
outstring = substr(outstring,251)
end
queue outstring
end
end
return
ispf: parse arg icmd
zerrsm =
zerrlm =
zerrhm =
zerralrm =
address ispexec icmd
irc = rc
if irc >= 9 then do
say word(icmd,1)": rc = " rc
if zerrsm <> "" then signal ispferror
end
return irc
ispferror:
ispfrc = rc
address ISPEXEC "DISPLAY PANEL(ISPTERM)"
exit ispfrc