Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Copy contents of ISPF table

467 views
Skip to first unread message

John Routh

unread,
Jan 3, 2001, 2:05:58 PM1/3/01
to
Does anyone have a routine or utility that copies the contents or rows of an
ISPF table to a flat file?

Thanks,

John Routh
Canada Life Assurance
Toronto, Canada

Hunt, Bruce

unread,
Jan 3, 2001, 2:35:33 PM1/3/01
to
This is a Rexx that reads a table and writes to a flat file based on the
values. It could be changed easy enough. See if it anything you can use.
READTABL.TXT

W. Jensen

unread,
Jan 4, 2001, 12:24:53 PM1/4/01
to
Off the top of my head, so I haven't tried it (yet):

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

McGrath, Kevin , San Jose

unread,
Jan 4, 2001, 8:28:22 PM1/4/01
to
I've attached one of our production REXX execs (it runs in batch ISPF).
It reads a list of 17 tables, all with the same format, and writes them
all to a single sequential file. We currently process about 28K records,
write them all to the stack, then out to the sequential file. Off-hours

----------------------------------------------------------------------------

McGrath, Kevin , San Jose

unread,
Jan 4, 2001, 8:43:24 PM1/4/01
to
Here is an example. It runs in ISPF batch as a production job, and processes
28K records from 17 tables in 15 minute elapsed time. (Day - time runs are
almost as fast, so I suspect the time is ISPF overhead.)

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

APTSLIST.txt

Michael Cleary

unread,
Jan 5, 2001, 10:47:02 AM1/5/01
to
--- "McGrath, Kevin (San Jose)" <Kevin_L...@BMC.COM> wrote:
> 28K records from 17 tables in 15 minute elapsed time. (Day - time
> runs are
> almost as fast, so I suspect the time is ISPF overhead.)

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/

Doug Nadel

unread,
Jan 5, 2001, 12:34:25 PM1/5/01
to
Sounds like the overhead of the ISPF <--> Rexx variable pools. I'd bet that if you
try the same thing in CLIST (yea, I know), it will be much faster.
Apparently there is a lot of overhead in getting and setting ISPF variables in a Rexx
environment. For most things, like file tailoring or panel processing, it is
trivial, but for tables, especially ones with lots of variables per row, it can add
up.

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.

Stephen E. Bacher

unread,
Jan 5, 2001, 3:54:57 PM1/5/01
to
Here is a REXX exec that will display the contents of any table,
or write same to a file. Hope this is useful.

- 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

0 new messages