Sample REXX programs to demontrate some possibilities using the ISPPDAPS panel with dynamic display area. Sample 1 Colorized scrollable display with locate, filter and line commands. Sample 2 Scrollable display with enhanced locate. Sample 3 Secondary list from a subroutine. Sample REXX program 1 /* REXX Dynarea - Build colorized dynamic scrollable display with find and filter Demo program The program does a TSO LISTALC, pulls datasetnames and generates 2 screen lines per dataset, the first line with a select field. There is fixed top line for filtering lines. Line commands are supplied to either browse or ListCat the dataset. Primary commands Find [tt] Find next 'tt', reposition display. When no 'tt' then use previous value, if any. Select line commands B Browse dataset. L Listcat dataset - point-and-shoot command. See ISPFPDAS at http://harders-jensen.com for more samples. */ Signal on novalue name PgmNoVal Address ispexec "control errors return" filter='' /* init som vars */ /* get panel attr chars */ /* required */ pdascrw=80 Address Ispexec "Control nondispl enter" Address Ispexec "Display panel(ISPPDAPS)" Interpret pdaattr /* done */ /* make list of allocated datasets */ zz=outtrap('lst.') "lista status history" zz=outtrap('off') o=0 upfx=userid()'.' upfxl=length(upfx) do n=2 to lst.0 if left(lst.n,3)='IKJ' then iterate /* error msg */ o=o+1 /* bump output ptr */ if pos('.',lst.n)>0 & pos('?',lst.n)=0 then do /* dataset */ parse var lst.n dsn . if left(dsn,upfxl)=upfx then dsn= pda@ty || dsn else if left(dsn,5)='SYS1.' then dsn= pda@tp || dsn else dsn=pda@tg || dsn blst.o=pda@sf || ' ' || pda@tb || right(o,4,0) || dsn || pda@tb end else blst.o=pda@tb' 'right(o,4,0) || pda@tg || strip(lst.n,'t') || pda@tb alst.o=blst.o /* active list */ end alst.0=o blst.0=o drop lst. /* done */ /* Main */ pdaselc ='=L B' /* line sel cmds, L is PAS */ pdamax =alst.0 /* data # of lines */ pdapos=1 /* initial position */ do $main=1 to 999999 /* make panel */ pdaarea='' /* reset buffer */ Call Pdaline pda@tg'Filter 'pda@it || left(' ',40) || pda@tb Call Pdaline pda@tt'Prim-cmds'pda@tb'Find All' Call Pdaline '' pdafixn=3 /* # fixed lines */ pdavars='filter' /* fixed area vars */ do n=pdapos to alst.0 for pdamaxd /* add scrollables */ call Pdaline alst.n end /* display and check response */ pdahdr ='Test dynamic scrollable screen area - demo 1' savefilter=filter zcmd='' Address Ispexec "Display panel(ISPPDAPS)" if rc>8 then exit ispmsg('Bad rc from panel:' rc zerrlm)+8 if rc>0 then leave /* End or return command entered */ /* handle data from fixed (top) area */ if filter<>savefilter then do Call DoFilter filter iterate $main end /* handle select fields */ do while pdalcmdl<>'' parse var pdalcmdl cpos','cval','pdalcmdl dsn=word(translate(alst.cpos,' ',pda@all),2) select when cval='B' then address ispexec "browse dataset('"dsn"')" when cval='L' then call DoListCat(dsn) when cval='' then, /* reset previosly set */ alst.cpos=overlay(' ',alst.cpos,2,2) otherwise call ispmsg('??lc shouldnt come here') end end /* handle primary commands */ parse var zcmd cverb cdata select when zcmd='' then nop when abbrev('FIND',cverb,1) then Call DoFind /* Find data */ when abbrev('ALL',zcmd,1) then Call DoFilter /* show all */ otherwise call ispmsg '*Invalid command' zcmd end end exit 0 PgmNoVal: say '*Novalue raised for line' sigl '-' say strip(sourceline(sigl),'t') exit 12 IspMsg: parse arg zedlmsg address ispexec "setmsg msg(isrz000)" return 0 Pdaline: /* add line to screen bfr */ pdaarea=pdaarea || strip(arg(1),'t') || pda@nl /* add using new-line */ return 0 DoFind: if cdata='' & symbol('findsave')='VAR' then cdata=findsave if cdata='' then return ispmsg('Missing find argument') findsave=cdata do p=pdapos+1 to alst.0 until pos(cdata,alst.p)>0; end if p>alst.0 then return ispmsg(cdata 'not found') pdapos=p return 0 DoFilter: arg filter o=0 do p=1 to blst.0 if filter<>'' then if pos(filter,blst.p)=0 then iterate o=o+1 alst.o=blst.p end alst.0=o pdapos=1 return 0 DoListCat: procedure expose pdaattr /* L line command */ Interpret pdaattr arg dsn . zz=outtrap('lst.') "listc ent('"dsn"') all" zz=outtrap('off') /* build panel */ parse value lst.0 0 1 with pdamax pdafixn pdapos if pdamaxw>=121 then pdascrw=121 pdahdr='Listcat' dsn do until rc>0 parse value '' with zcmd pdaarea Call Pdaline '' /* fixed blank line at top */ pdafixn=1 /* for better looks */ do #=pdapos to lst.0 for pdamaxd Call Pdaline ' 'lst.# end Address Ispexec "Display panel(ISPPDAPS)" end if rc>8 then say 'Display rc' rc zerrlm return 0 Sample REXX program 2 /* REXX :doc Dynarea - Dynamic scrollable display with enhanced find. Demo program The program does a TSO LISTCAT for SYS1.* non-vsam datasets and create a selectable list. The demo demonstrates anhanced FIND with highnlighting of the search result. The previous FIND argument is saved so you can do a repeat find by just entering the FIND command by itself. another FIND is done. Primary commands Find [tt] | * [FIRST] [LAST] [NEXT] [PREV] Find first, last, previous or next tt. Default is next. Latest tt is used if left blank, this will force a search next. Note, FIND only works in the main list. RESet Reset FIND highlight Select line commands B Browse dataset. L Listcat dataset - point-and-shoot command. There is also a fixed data entry line. The data is not checked, it is there to demonstrate the features. :doc See the documentation for details. */ Signal on novalue name PgmNoVal Address ispexec "control errors return" Address Ispexec "vget (zscrmaxd zscrmaxw)" parse value '' with name /* init som vars */ /* get panel attr chars */ /* required */ pdascrw=80 Address Ispexec "Control nondispl enter" Address Ispexec "Display panel(ISPPDAPS)" Interpret pdaattr /* done */ /* make list of datasets */ zz=outtrap('lst.') "listc lvl(sys1) nonvsam" zz=outtrap('off') o=0 do n=1 to lst.0 if left(lst.n,4)='NONV' then do parse var lst.n . . dsn . o=o+1 /* bump output ptr */ blst.o=pda@sf || ' ' || pda@tb ||, right(o,4,0) || pda@tg || dsn || pda@tb alst.o=blst.o /* make active list */ end end alst.0=o blst.0=o if blst.0=0 then exit ispmsg('No datasetnames passed') drop lst. /* done */ /* Main */ pdaselc ='L B' /* line sel cmds */ pdapos=1 /* initial position */ pdamax =alst.0 /* data # of lines */ pdascrw=80 /* screen width */ pdahdr ='Test dynamic scrollable screen area - demo 2' do $main=1 to 999999 /* make panel */ pdaarea='' /* reset buffer */ Call Pdaline , left(pda@tt'Prim-cmds'pda@tb || 'Find RESet Where', pda@tt'Sel-cmds 'pda@tb || 'B L',pdascrw-12), || pda@tt'Count'pda@tb || right(alst.0,5,0) Call Pdaline '' Call Pdaline pda@tw'Sl Id Name' pdafixn=3 /* # fixed lines */ do n=pdapos to alst.0 for pdamaxd /* add scrollables */ call Pdaline alst.n end /* display and check response */ zcmd='' Address Ispexec "Display panel(ISPPDAPS)" if rc>8 then exit ispmsg('Bad rc from panel:' rc zerrlm)+8 if rc>0 then leave /* End or return command entered */ /* handle select fields */ do while pdalcmdl<>'' parse var pdalcmdl cpos','cval','pdalcmdl dsn=word(translate(alst.cpos,' ',xrange('01'x,'20'x)),2) select when cval='B' then do zerrlm='' address ispexec "browse dataset('"dsn"')" if rc>4 then call ispmsg 'Browse' dsn 'rc' rc zerrlm end when cval='L' then call DoListCat(dsn) when cval='' then, alst.cpos=overlay(' ',alst.cpos,2,2) /* lcmd cleared */ otherwise call ispmsg('??lc shouldnt come here') end end /* handle primary commands */ parse var zcmd cverb cdata select when zcmd='' then nop when abbrev('FIND',cverb,1) then Call DoFind cdata when abbrev('WHERE',cverb,1) then Call DoWhere cdata when abbrev('RESET',cverb,3) then Call DoReset otherwise call ispmsg '*Invalid command' zcmd end end exit 0 PgmNoVal: say '*Novalue raised for line' sigl '-' say strip(sourceline(sigl),'t') exit 12 Pdaline: /* add line to screen image */ pdaarea=pdaarea || strip(arg(1),'t') || pda@nl /* add using new-line */ return 0 /* FIND - Will highlight the found line and postion the cursor at the match. - Syntax: Find [text] | * [FIRST] [LAST] [NEXT] [PREV] Info saved between calls $lfp line nr (position) of latest succesful find $lfa argument of latest succesful find $lfd direction of latest succesful find $lfs stored dataline of latest succesful find */ DoFind: if symbol('$lfp')<>'VAR' then parse value 0 with $lfp $lfa $lfd $lfs arg fa fd='' n=words(fa) /* split direction from arg */ if n>1 then do if wordpos(word(fa,n),'FIRST LAST NEXT PREV')>0 then do fd=word(fa,n) fa=delword(fa,n) end end if left(fa,1)="'" then fa=strip(strip(fa),"b","'") if fa='*' | fa='' then do /* reuse latest arg? */ fa=$lfa if fd='' then fd=word($lfd 'NEXT',1) end if fa='' then return ispmsg('Missing argument') parse value fa';'fd with $lfa';'$lfd /* save for next time */ if wordpos(fd,'FIRST LAST')>0 then $lfd='' /* except if dir first/last */ fa=strip(fa) select when fd='FIRST' then parse value 1 alst.0 1 with ff ft fb . when fd='NEXT' then parse value $lfp+1 alst.0 1 with ff ft fb . when fd='PREV' then parse value $lfp-1 1 '-1' with ff ft fb . when fd='LAST' then parse value alst.0 1 '-1' with ff ft fb . otherwise parse value pdapos alst.0 1 with ff ft fb . end do p=ff to ft by fb if pos(fa,translate(alst.p))=0 then iterate if $lfp<>0 then alst.$lfp=$lfs /* reset previous find */ $lfp=p /* line nr */ $lfs=alst.p /* save line */ alst.p=overlay(pda@tw,alst.p,9) /* hilight result */ if p>pdapos+pdadpth-pdafixn | p'VAR' then return ispmsg('Nothing to reset') if $lfp=0 then return ispmsg('Nothing to reset') alst.$lfp=$lfs $lfp=0 return 0 IspMsg: parse arg zedlmsg address ispexec "setmsg msg(isrz000)" return 0 DoListCat: Procedure expose pdaattr /* L line command */ interpret pdaattr arg dsn . zz=outtrap('lst.') "listc ent('"dsn"') all" zz=outtrap('off') /* build panel */ parse value lst.0 0 1 with pdamax pdafixn pdapos if pdamaxw>=121 then pdascrw=121 pdahdr='Listcat' dsn do until rc>0 parse value '' with zcmd pdaarea Call Pdaline '' /* fixed blank line at top */ pdafixn=1 /* for better looks */ do #=pdapos to lst.0 for pdamaxd Call Pdaline ' 'lst.# end Address Ispexec "Display panel(ISPPDAPS)" end if rc>8 then say 'Display rc' rc zerrlm return 0 Sample REXX program 3 /* REXX :doc: Dynarea - Secondary list from a subroutine. Demo program Show internal documentation in a sub-menu. Primary commands (not really, except from the '?' command - the rest are just for show), Find [tt] | * [FIRST] [LAST] [NEXT] [PREV] Find first, last, previous or next tt. Default is next. Latest tt is used if left blank, this will force a search next. Note, FIND only works in the main list. RESet Reset FIND highlight SAY v SAY variable v ? Show doc Select line commands B Browse dataset. L Listcat dataset - point-and-shoot command. K Keep the linecommand (for testing). There is also a fixed data entry line. The data is not checked, it is there to demonstrate the features. :doc: See the documentation for details. */ Signal on novalue name PgmNoVal Address ispexec "control errors return" Address Ispexec "vget (zscrmaxd zscrmaxw)" parse value '' with name /* init som vars */ /* get panel attr chars */ /* required */ pdascrw=80 Address Ispexec "Control nondispl enter" Address Ispexec "Display panel(ISPPDAPS)" Interpret pdaattr /* done */ /* make main data list */ alst.1 =pda@tg'Doctor Who is a British science-fiction ' alst.2 =pda@tg'television programme produced by the BBC ' alst.3 =pda@tg'from 1963 to the present day. The programme ' alst.4 =pda@tg'depicts the adventures of the Doctor, a Time ' alst.5 =pda@tg'Lord a time-travelling humanoid alien. ' alst.6 =pda@tg' He explores the ' alst.7 =pda@tg'universe in his TARDIS, a sentient time-travelling ' alst.8 =pda@tg'space ship. Its exterior appears as a blue British ' alst.9 =pda@tg'police box, which was a common sight in Britain ' alst.10=pda@tg'in 1963 when the series first aired. Along with a ' alst.11=pda@tg'succession of companions, the Doctor combats a variety ' alst.12=pda@tg'of foes while working to save civilisations and help ' alst.13=pda@tg'people in need. ' alst.0=13 /* done */ /* Main */ pdapos=1 /* initial position */ pdamax =alst.0 /* data # of lines */ pdascrw=80 /* screen width */ pdahdr ='Demo dynamic list in a subroutine' pdafixn=0 /* # fixed lines */ do $main=1 to 999999 /* make panel */ pdaarea='' call pdaline pda@tt'Primary cmds - Help or ?' call pdaline '' pdafixn=2 /* # fixed lines */ do n=pdapos to alst.0 for pdamaxd /* add scrollables */ call Pdaline alst.n end /* display and check response */ zcmd='' Address Ispexec "Display panel(ISPPDAPS)" if rc>8 then exit ispmsg('Bad rc from panel:' rc zerrlm)+8 if rc>0 then leave /* End or return command entered */ /* handle primary commands */ parse var zcmd cverb cdata select when zcmd='' then nop when abbrev('HELP',zcmd,1) | zcmd='?' then Call DoHelp otherwise call ispmsg '*Invalid command' zcmd end end exit 0 PgmNoVal: say '*Novalue raised for line' sigl '-' say strip(sourceline(sigl),'t') exit 12 Pdaline: /* add line to screen image */ pdaarea=pdaarea || strip(arg(1),'t') || pda@nl /* add using new-line */ return 0 DoHelp: Procedure expose pdaattr /* HELP primary command */ Interpret pdaattr /* pull lines between 1st and 2nd ':doc:' */ #=0 do n=1 to sourceline() until sourceline(n)=':doc:';end do m=n+1 to sourceline() while sourceline(m)<>':doc:' #=#+1 hlp.#=pda@tg || strip(sourceline(m),'t') end hlp.0 =# parse value # 80 0 1 with pdamax pdascrw pdafixn pdapos pdahdr='Enhanced dynamic panel area help' do forever parse value '' with zcmd pdaarea Call Pdaline '' /* fixed blank line at top */ pdafixn=1 /* for better looks */ do #=pdapos to hlp.0 for pdamaxd Call Pdaline hlp.# end zcmd='' address ispexec "display panel(ISPPDAPS)" if rc>8 then exit xmsg('Display rc' rc zerrlm)+8 if rc>4 | wordpos(zcmd,'END RETURN')>0 then leave end return 0