© serviceprofessionalgmbh

The user's acceptance of a dialog is of prevailingly importance. Ideally the user himself should be the designer of the panel layout. He ought to define for instance which table colums are displayed, their width and order. Wherever it applies a left / right scroll on the viewed panel as known from the editor should be implemented.

It would be beyond the scope to demomstrate every possibility. Here the handling of dynamic model sets is explained. Not coded in this example but easy to include is the option to enable to user to adjust table width, sort order and so on via the ISPF profile pool. If no such adjustments are found there, the defaults pre-defined in the program are enforced. An extention for sort options or filtered displays (TBSCAN results) wouldn't require witchcraft either.

The demo program allows a choice of four possible views which can be selected by the command SET n (where n is a value between 1 and 4). For views which exceed the screen the logical screen is allowed (scolling would be nice) and the user is informed by an optical indication.

Have fun !


Programm

/* REXX
*/
address ispexec
"control errors return"
call set_variables
call table_create
call table_fill
"tbdispl &table panel(tpandyn1)"
do while rc < 8
   parse var zcmd pcmd parms
   select
      when pcmd = "SET" then call set_display
      otherwise nop
   end
   "tbdispl &table panel(tpandyn1)"
end
"tbend &table"
exit

table_create:
   "tbend &table"
   "tbcreate &table names(&t§names)"
return

table_fill:
   I = 0
   I=I+1;lname.i ="Mooshammer"
         fname.i ="Ludwig"
         plz.i   ="80333"
         ort.i   ="München"
         str.i   ="Theatinerstrasse 4"
         telf.i  ="089 / 1234567"
         telm.i  ="0171 / 1234567"
         fax.i   ="01212 / 510111239"
         age.i   ="67"
   I=I+1;lname.i ="Wittemann"
         fname.i ="Karlheinz"
         plz.i   ="82319"
         ort.i   ="Starnberg"
         str.i   ="Schulstrasse 3b"
         telf.i  ="+49-8151-21448"
         telm.i  ="+49-172-8936881"
         fax.i   ="+49-8151-28792"
         age.i   ="48"
   I=I+1;lname.i ="Schrumpelhut"
         fname.i ="Jeremias"
         plz.i   ="70191"
         ort.i   ="Stuttgart-Hauptbahnhof"
         str.i   ="Räpplenstrasse 19"
         telf.i  ="+49-711-20212810"
         telm.i  =""
         fax.i   ="+49-711-20121111"
         age.i   ="36"
   do J = 1 to I
      "tbvclear &table"
      lname   = lname.j
      fname   = fname.j
      ort     = ort.j
      str     = str.j
      telfest = telf.j
      telmobil= telm.j
      fax     = fax.j
      age     = age.j
      "tbadd &table"
   end
   "tbtop &table"
return

set_display:
   if datatype(parms) <> "NUM"   then return
   if head.parms = "HEAD."parms  then return
   call set_header_and_model parms
return

set_header_and_model:
   arg IDX
   header ="°LCMD"
   models ="§LCMD"
   do i = 1 to words(head.idx)
      h = word(head.idx,i)
      m = word(mset.idx,i)
      l = word(flen.idx,i)
      l_row = length(header)
      if l_row + l + 3 > ZSCRMAXW then do
         if l_row  + 7 < ZSCRMAXW then do
            tmp = ZSCRMAXW - l_row - 4
            h = left(h,tmp)">>"
            l = ZSCRMAXW - l_row - 2
         end
         else do
            header = left(header,ZSCRMAXW-3)">>"
            leave
         end
      end
      header = header"°"left(h,l)"~"
      models = models"{"left(m,l)"+"
   end
return

set_variables:
   var#shar = "" ,
              "ZSCRMAXD" ,  /* Screen-Höhe                      */
              "ZSCRMAXW" ,  /* Screen-Breite                    */
              ""
   "vget (&var#shar) shared"

   TABLE = "T"reverse(userid())
   t§names = "lname fname ort str telfest telmobil fax age"

   head.1 = "Nachname Vorname Wohnort Strasse Festnetz Mobil Fax Alter"
   mset.1 = "lname    fname   Ort     str     telfest  telmobil fax age"
   flen.1 = "20       15      30      20      16       16       18  5"

   head.2 = "Nachname    Wohnort    Strasse"
   mset.2 = "lname       Ort        str"
   flen.2 = "20          40         20"

   head.3 = "Nachname    Festnetz   Mobil     Fax"
   mset.3 = "lname       telfest    telmobil  fax"
   flen.3 = "15          16         16        18"

   head.4 = "Vorname     Nachname   Alter"
   mset.4 = "fname       lname      age"
   flen.4 = "15          20         5"

   call set_header_and_model 3
return



Panel TPANDYN1

)attr
   # area(dynamic) scroll(off)       extend(off)
   ° type(dataout) hilite(uscore)
   ~ type(dataout)
   § type(input)   color(red)      padc('.')
   { type(output)  color(blue)
   } type(output)  color(red)
   [ type(output)  color(green)
   ] type(output)  color(yellow)
)body expand(\\)
---------< Demo-Panel mit variablen Model-Sets >\-\
%Command ==>_zcmd \ \%Scroll ==>_samt+
+
#header                                                                        #
)model clear(LCMD)
&models
)init
   if (&SAMT = &Z)
      &samt = CSR
)reinit
)proc
   /* Hier wäre Platz für Verify und mehr...
)help
)end

back to REXX with ISPF