)ATTR DEFAULT(%+_) FORMAT(MIX) /* MODIFIED ISRBROB */ /*--------------------------------------------------------------------*/ /* SIMPLE BROWSE PANEL TO HIGHLIGHT REXX */ /*--------------------------------------------------------------------*/ /* If this panel is named HIBROWSE then invoke browse as */ /* ISPEXEC BROWSE DATASET(dataset-name) PANEL(HIBROWSE) */ /*--------------------------------------------------------------------*/ Y TYPE(CHAR) COLOR(YELLOW) G TYPE(CHAR) COLOR(GREEN) R TYPE(CHAR) COLOR(RED) W TYPE(CHAR) COLOR(WHITE) B TYPE(CHAR) COLOR(BLUE) 05 TYPE(PT) ~ TYPE(FP) 0A TYPE(NT) ` TYPE(NEF) PADC(USER) ! TYPE(VOI) PADC(USER) @ AREA(DYNAMIC) EXTEND(ON) SCROLL(ON) 01 TYPE(DATAOUT) INTENS(LOW) 02 TYPE(DATAOUT) 0B TYPE(DATAOUT) FORMAT(DBCS) OUTLINE(L) 0C TYPE(DATAOUT) FORMAT(EBCDIC) OUTLINE(L) 0D TYPE(DATAOUT) FORMAT(&MIXED) OUTLINE(L) 10 TYPE(DATAOUT) INTENS(LOW) FORMAT(DBCS) OUTLINE(L) 11 TYPE(DATAOUT) INTENS(LOW) FORMAT(EBCDIC) OUTLINE(L) 12 TYPE(DATAOUT) INTENS(LOW) FORMAT(&MIXED) OUTLINE(L) )BODY EXPAND(//) WIDTH(&ZWIDTH) CMD(ZCMD) ~BROWSE !Z/ / ~Line!Z ~Col!Z + ~Command ===>`Z/ / ~Scroll ===>`Z + @ZDATA,SHADOW/ / @ @/ / @ @/ / @ )INIT .ZVARS = '(ZTITLE ZLINES ZCOLUMS ZCMD ZSCBR)' .HELP = ISR1B000 &ZCMD = ' ' VGET (ZSCBR) PROFILE /* Fill Scroll Vars if */ IF (&ZSCBR = ' ') &ZSCBR = 'PAGE' /* Blank with Page */ IF (&ZMEMB ^= ' ') &ZTITLE = '&ZDSNT(&ZMEMB)&ZLEVEL ' /* OZ91708 */ IF (&ZMEMB = ' ') &ZTITLE = '&ZDSNT&ZLEVEL ' &MIXED = MIX IF (&ZPDMIX = N) &MIXED = EBCDIC &SHADOW=&ZDATA *REXX(ZDATA,SHADOW,ZWIDTH) /* Specify keywords to highlight */ keywords='call overlay pos length do end while until words subword' keywords=keywords 'copies translate xrange if then by to substr' /* Set up translate table of valid keyword characters */ trtable='ABCDEFGHIJKLMNOPQRSTUVWXYZ$#@0123456789_' trtable=translate(xrange('00'x,'FF'x),,trtable,' ') /* Make a copy of zdata with only alphanumerics. This will be used */ /* as the reference string for finding keywords. */ zdatacopy=translate(zdata) zdatacopy=translate(zdatacopy,,trtable,' ') /* Remove non-Kwd chars */ /* Look at the copy, finding keywords and update shadow accordingly */ keywords=translate(keywords) shadow=copies('G',length(shadow)) do a = 1 to words(keywords) keyword=subword(keywords,a,1) wordlen=length(keyword) position=pos(keyword,zdatacopy) do while position>0 zdatacopy=overlay(' ',zdatacopy,position,wordlen) if substr(zdatacopy,position-1,1)=' ' & , substr(zdatacopy,position+wordlen,1)=' ' then shadow =overlay('R',shadow ,position,wordlen,'R') position=pos(keyword,zdatacopy) end end /* Now highlight quoted strings and comments. Multilevel comments */ /* are supported, but this example assumes no continuation of */ /* strings or comments off of the screen. */ squote=0 dquote=0 comment=0 do a = 1 to length(zdata) if squote+dquote>0 then shadow=overlay('W',shadow,a,1) else do if substr(zdata,a,2)='/*' then comment=comment+1 if comment>0 & substr(zdata,a,2)='*/' then do shadow=overlay('BB',shadow,a,2) comment=max(0,comment-1) end end if comment>0 then shadow=overlay('B',shadow,a,1) if comment=0 then if dquote=0 & substr(zdata,a,1)= "'" then squote=1-squote /* Turn on or off squote */ else if squote=0 & substr(zdata,a,1)= '"' then dquote=1-dquote /* Turn on or off dquote */ if squote+dquote>0 then shadow=overlay('W',shadow,a,1) if comment>0 then shadow=overlay('B',shadow,a,1) end /* Finally, turn the top of data and bottom of data to default color */ do a = 1 to length(zdata) by zwidth if substr(zdata,a,3)='***' then /* Assume this is top/Bot of data */ shadow=overlay(' ',shadow,a,zwidth,' ') end *ENDREXX )REINIT &SHADOW=&ZDATA *REXX(ZDATA,SHADOW,ZWIDTH) /* Specify keywords to highlight */ keywords='call overlay pos length do end while until words subword' keywords=keywords 'copies translate xrange if then by to substr' /* Set up translate table of valid keyword characters */ trtable='ABCDEFGHIJKLMNOPQRSTUVWXYZ$#@0123456789_' trtable=translate(xrange('00'x,'FF'x),,trtable,' ') /* Make a copy of zdata with only alphanumerics. This will be used */ /* as the reference string for finding keywords. */ zdatacopy=translate(zdata) zdatacopy=translate(zdatacopy,,trtable,' ') /* Remove non-Kwd chars */ /* Look at the copy, finding keywords and update shadow accordingly */ keywords=translate(keywords) shadow=copies('G',length(shadow)) do a = 1 to words(keywords) keyword=subword(keywords,a,1) wordlen=length(keyword) position=pos(keyword,zdatacopy) do while position>0 zdatacopy=overlay(' ',zdatacopy,position,wordlen) if substr(zdatacopy,position-1,1)=' ' & , substr(zdatacopy,position+wordlen,1)=' ' then shadow =overlay('R',shadow ,position,wordlen,'R') position=pos(keyword,zdatacopy) end end /* Now highlight quoted strings and comments. Multilevel comments */ /* are supported, but this example assumes no continuation of */ /* strings or comments off of the screen. */ squote=0 dquote=0 comment=0 do a = 1 to length(zdata) if squote+dquote>0 then shadow=overlay('W',shadow,a,1) else do if substr(zdata,a,2)='/*' then comment=comment+1 if comment>0 & substr(zdata,a,2)='*/' then do shadow=overlay('BB',shadow,a,2) comment=max(0,comment-1) end end if comment>0 then shadow=overlay('B',shadow,a,1) if comment=0 then if dquote=0 & substr(zdata,a,1)= "'" then squote=1-squote /* Turn on or off squote */ else if squote=0 & substr(zdata,a,1)= '"' then dquote=1-dquote /* Turn on or off dquote */ if squote+dquote>0 then shadow=overlay('W',shadow,a,1) if comment>0 then shadow=overlay('B',shadow,a,1) end /* Finally, turn the top of data and bottom of data to default color */ do a = 1 to length(zdata) by zwidth if substr(zdata,a,3)='***' then /* Assume this is top/Bot of data */ shadow=overlay(' ',shadow,a,zwidth,' ') end *ENDREXX REFRESH(ZCMD,ZSCBR,ZDATA,ZLINES,ZCOLUMS,ZTITLE) )PROC &ZCURSOR = .CURSOR &ZCSROFF = .CSRPOS VPUT (ZSCBR) PROFILE /* */ &ZLVLINE = LVLINE(ZDATA) )END