MainframeSupports
tip week 21/2003:

There are tools for presenting all kinds of data like DB2-tables, flat files, VSAM-files and other stuff. What I miss is a tool to show me the contens of an ISPF-table in a clear way.

In the standard ISPF/PDF main menu there is an item no. 7 (Dialog Test) where you can manipulate with ISPF-tables, but there is no function to show or print the whole contens of a table with a row per line. I have been irritated by this fact a very long time, so at last I built a REXX to dump any ISPF-table on the ISPTLIB concatenation into a dataset or member.

I will uncover the important ingredients of this REXX. Then you can customize it to fulfil your needs, or you can write to me and ask for the final version.

/* REXX - FORMAT AN ISPF-TABLE INTO ROWS IN A STEM */
ARG ISPFTAB
ADDRESS ISPEXEC
"TBOPEN "ISPFTAB" NOWRITE"
"TBQUERY "ISPFTAB" KEYS(KEYFLDS) NAMES(NAMEFLDS)"
IF KEYFLDS ^= ''
THEN
  KEYFLDS = SUBSTR(KEYFLDS, 2, LENGTH(KEYFLDS) - 2)
IF NAMEFLDS ^= ''
THEN
  NAMEFLDS = SUBSTR(NAMEFLDS, 2, LENGTH(NAMEFLDS) - 2)
FLDS = KEYFLDS' 'NAMEFLDS
FLDSCOUNT = WORDS(FLDS)
ROW. = ''
ROWCOUNT = 0
"TBTOP "ISPFTAB
"TBSKIP "ISPFTAB
DO WHILE RC = 0
  ROWDATA = VALUE(WORD(FLDS, 1))
  DO FIELDNO = 2 TO FLDSCOUNT
    ROWDATA = ROWDATA'¤'VALUE(WORD(FLDS, FIELDNO))
  END
  ROWCOUNT = ROWCOUNT + 1
  ROW.ROWCOUNT = ROWDATA
  "TBSKIP "ISPFTAB
END
ROW.0 = ROWCOUNT
"TBEND "ISPFTAB
/* WRITE THE STEM ROW. TO SOMEWHERE ELSE */
EXIT

After the execution the stem ROW. holds the contens of the whole ISPF-table with a row in each element or entry of the stem. Every column is separated by a turtle/bomb (¤). The hard part about columns in an ISPF-table is that you don't know in advance the width of the columns. Therefore I have chosen to separate the columns with some kind of delimiter. All you have to do is to add some code to format the result in ROW. into a format suitable for your needs.

Real ISPF experts will immediately point out that I don't process all the columns, because every single row in an ISPF-table can have a variable number of extra columns. In this version of the REXX I have disregarded this detail, as the facility is very rarely used.

Previous tip in english        Sidste danske tip        Tip list