ISPF 2.x, MVS38J, Tips

Pretty-TERMSIZE in MVS38J

Overview

ISPF v.2.2 (ISPF-like product from Wally Mclaughlin) provides two specific Z-variables to expose terminal size, ZSCREEND and ZSCREENW, screen depth and screen width, respectively. Each variable is 4-bytes, zero-filled.

For example, to display terminal size on a panel (e.g. primary menu, ISP@PRIM), one row (line) could be defined in the )BODY section as shown below:


         1         2         3         4         5         6         7         8  \
1...+....0....+....0....+....0....+....0....+....0....+....0....+....0....+....0  <-- Ruler for reference
%           This is a sample non-select panel           / /%Term  {z   %x{z    +  <-- )BODY section

with the appropriate .ZVARS setting (assuming no other &Z variables are defined)

 .ZVARS = '(ZSCREEND ZSCREENW)'

The menu would display terminal size as:


         1         2         3         4         5         6         7         8
1...+....0....+....0....+....0....+....0....+....0....+....0....+....0....+....0

            This is a sample non-select panel               Term   0027 x 0132 


Pretty it up!

One solution (I’m sure others exist…) is to apply some logic in the )INIT section of the panel. Remember, a limited set of statements are available for panel definition use.

The objective is to compose a final result where terminal size is displayed as:
TermSize – 27×132
where screen depth and width are concatenated with no leading zeros or embedded spaces with an ‘x’ separator.

The )BODY section of the one line changes to:


         1         2         3         4         5         6         7         8  \
1...+....0....+....0....+....0....+....0....+....0....+....0....+....0....+....0  <-- Ruler for reference
%           This is a sample non-select panel           / /%TermSize -^&SS     +  <-- )BODY definition

using variable &SS

Insert the following logic into the )INIT section:

)INIT
.
.
.
  &XX = TRUNC (&ZSCREEND, '0')  /* Trunc up to first 2 zeros */
  &SD = .TRAIL                                                 
  &XX = TRUNC (&SD, 1)                                         
  IF (&XX = 0)                                                 
    &SD = .TRAIL                                               
  &XX = TRUNC (&ZSCREENW, '0')  /* Trunc up to first 2 zeros */
  &SW = .TRAIL                                                 
  &XX = TRUNC (&SW, 1)                                         
  IF (&XX = 0)                                                 
    &SW = .TRAIL                                               
  &SS = '&SD.x&SW'              /* Screen Size var           */
.
.
.

The final result displayed on your 3270 terminal is:


         1         2         3         4         5         6         7         8
1...+....0....+....0....+....0....+....0....+....0....+....0....+....0....+....0

            This is a sample non-select panel               TermSize - 27x132 


Leave a Reply

Your email address will not be published. Required fields are marked *


CAPTCHA Image
Reload Image

This site uses Akismet to reduce spam. Learn how your comment data is processed.