A demo of ISPF dynamic area. It handles scrolling.
/*                                                                    rexx     
 Demo ISPF panel using dynamic scrollable area                                 
  It changes the color of the text if line cmd is 1, 2, 3 or 4                  
 
  See the panel source at the end                                              
                                                                               
 Input is 3 rexx stems, pos 1 in each stem is the panel attribute              
  psel   selection field                                                       
  pmbr   member name - leading text                                            
  ptxt   just some text                                                        
                                                                               
 Panel attributes                                                              
  x'11' input  color turq caps off hilite uscore                               
  x'12' input  color yellow caps off hilite uscore                             
  x'13' input  color red caps off  hilite uscore                               
  x'14' output color turq caps off                                             
  x'15' output color green caps off                                            
  x'16' output color pink caps off                                             
  x'17' output color white caps off                                            
                                                                               
 Control and reference variables                                               
  dpascsrwt panel width                                                        
  dpaarea   dynamic area                                                       
  dpacsrp   cursor pos in field                                                
  dpacsrf   fieldname of cursor                                                
*/                                                                             
                                                                               
 parse value '111213'x   with pai1 +1 pai2 +1 pai3                             
 parse value '14151617'x with pao1 +1 pao2 +1 pao3 +1 pao4                     
 dpascrwt=80                                                                   
 address ispexec "control errors return"                                       
 address ispexec                                                               
 "vget (zscrmaxd zscrmaxw)"                                                    
                                                                               
 Call Load                                                                     
 pcsr    = 1                                                                   
 Call Display                                                                  
 say 'End...'                                                                  
 exit 0                                                                        
                                                                               
Display:                                                                       
 dpatop=1            /* position in data */                                    
 pnlareap=6          /* line in panel where the area is found */               
 pnlaread=zscrmaxd-pnlareap     /* area depth */                               
 do forever                                                                    
   /* format screen area */                                                    
   if dpatop>pseln-pnlaread+1 then dpatop=pseln-pnlaread+1                     
 /*if dpatop>pseln then dpatop=pseln */                                        
   if dpatop<1 then dpatop=1                                                   
   dpaarea=''                                                                  
   do n=dpatop to pseln                                                        
     dpaarea=dpaarea||left(left(psel.n,3)left(pmbr.n,9)ptxt.n,dpascrwt-1)||pao2
   end                                                                         
   /* control display, pull info */                                            
   "display panel(ISPDYN2#)"                                                   
   "vget (zverb zscrolla zscrolln)"                                            
   if rc>4 | wordpos(zverb,'END RETURN')>0 then return 0                       
                                                                               
   /* handle linecmd */                                                        
   lcn=0                                                                       
   do lcp=2 to zscrmaxd*dpascrwt by dpascrwt                     
     lcmd=strip(substr(dpaarea,lcp,2))                           
     lcn=lcn+1                                                   
     if lcmd<>'' then do                                         
     /*say 'lcmd at' lcn+dpatop-1'='lcmd*/                       
       n=lcn+dpatop-1                                            
       if wordpos(lcmd,'1 2 3 4')>0 then do                      
         ptxt.n=overlay(value('pao'lcmd),ptxt.n)                 
         psel.n=left(psel.n,1)                                   
       end                                                       
       else psel.n=left(psel.n,1)'?'lcmd                         
     end                                                         
   end                                                           
                                                                 
   /* handle scrolling */                                        
   if wordpos(zverb,'DOWN UP')>0 then do                         
     vs=space(zverb zscrolla,0) /* verb & scroll */              
     Select                                                      
       when vs='UPMAX'   then dpatop=1                           
       when vs='DOWNMAX' then dpatop=pseln -dpalvl+1             
       when zverb='UP'   then dpatop=dpatop-zscrolln             
       when zverb='DOWN' then dpatop=dpatop+zscrolln             
       otherwise nop                                             
     end /* select */                                            
   end /* scroll */                                              
 end /* panel processing */                                      
 exit xmsg('Logic error 1')                                      
                                                                 
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1)      
                                                                 
Load:                                                            
 parse value '' with psel. pmbr. ptxt.                           
 Call PipeData                                               
 if rc<>0 then exit xmsg('bad pipe rc' rc)                       
 do n=1 to data.0                                                
   psel.n  = pai1                                                
   pmbr.n  = pao1 || word(data.n,1)                              
   ptxt.n  = pao2 || right(n,3) subword(data.n,2)                
 end                                                             
 psel.0  = data.0                                                
 pseln   = data.0                                                
 drop data.                                                      
 return 0                                                        
                                                                 
Pipedata:                                                        
 q=100                                                           
 do n=1 to q                                                     
   data.n='LINE'n 'text for line' n                              
 end                                                             
 data.0=q                                                        
 return 0                                                        
                                                                 
/* panel                                                         
)Attr                                                            
 + type(text   ) color(green) caps(off)                          
 " type(text   ) color(blue ) caps(off)                          
 _ type(input  ) color(turq ) caps(on ) hilite(uscore)           
 | area(dynamic) extend(on) scroll(on)  /* required */           
 /* input 1 - 3 */                                               
 11 type(datain ) color(turq  ) caps(off) hilite(uscore)        
 12 type(datain ) color(yellow) caps(off) hilite(uscore)        
 13 type(datain ) color(red   ) caps(off) hilite(uscore)        
 /* text 1 - 4 */                                               
 14 type(dataout) color(turq  ) caps(off)                       
 15 type(dataout) color(green ) caps(off)                       
 16 type(dataout) color(pink  ) caps(off)                       
 17 type(dataout) color(white ) caps(off)                       
 /* text color override */                                      
 18 type(char)  color(white)                                    
)Body expand(\\) width(&dpascrwt)                               
%\ \Demo scrollable dynamic panel area\ \+                      
%ISPF cmd ==>_zcmd \ \+ +Scrl_scrl+                             
+                                                               
+                                                               
+                                                               
|dpaarea\ \|                                                    
)Init                                                           
 .cursor = &dpacsrf            /* set cursor in field        */ 
 .csrpos = &dpacsrp            /* set cursor pos in field    */ 
)Proc                                                           
 &dpacsrp = .csrpos            /* get cursor pos in field    */ 
 &dpacsrf = .cursor            /* get fieldname of cursor    */ 
 &dpalvl  = lvline(dpaarea)                                     
)End                                                            
*/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to