Top Tip – SEUCOLOR by Nick Barnes

Nick Barnes, System Analyst of South Africa writes: I saw you had a thing on changing source colours, I didn’t see anything on your site pertaining to this but I found that using exit point was quicker to use since you can do it while editing source.

Anyway all the program does is if function key 8 is pressed in SEU it will change the source line to a blue commented line or if function key 7 is pressed it will change the line to a white commented line only in RPG or RPGLE we dont use that much CL here nor many comments in CL.

All you have to do is compile the program and register the exit point with ADDEXITPGM

ADDEXITPGM EXITPNT(QIBM_QSU_LCMD) FORMAT(EXTP0100) PGMNBR(*LOW) PGM(“YOUR_LIBRARY”/”WHATEVER_YOU_CALLED_IT”)

Just thought it might be seen as additional material.

HERE IS THE CODE:

 

      *
      * Header information
      *
     D HeaderInfo      DS                  BASED(Parm1)
     D  RecLength              1      4B 0
     D  CursorRRN              5      8B 0
     D  CursorPos              9     12B 0
     D  CCSID                 13     16B 0
     D  Records               17     20B 0
     D  MemberName            21     30
     D  FileName              31     40
     D  LibraryName           41     50
     D  MemberType            51     60
     D  CmdKey                61     61
     D  Mode                  62     62
     D  SplitSess             63     63
     D  Res                   64     64
      *
      * Return Codes
      *
     DReturnInfo       DS                  BASED(Parm2)
     D RetCode                 1      1
     D Res2                    2      4
     D OutRecs                 5      8B 0
     D InsertSequence          9     15
     D Res3                   16     37
      *
      * Line Command and Text
      *
     D LinInfomation   DS                  BASED(Parm3)
     D  Command1               1      7
     D  Return1                8     20
     D  Text1                 21    100
     D  Command2             101    107
     D  Reutrn2              108    120
     D  Text2                121    200
      *
      * Entry Parameters declarations
      *
     D Parm1           S               *
     D Parm2           S               *
     D Parm3           S               *
      *
     C     *Entry        Plist
     C                   Parm                    Parm1
     C                   Parm                    Parm2
     C                   Parm                    Parm3
      *
     C                   Exsr      DoProcess
     C                   Seton                                        LrRt
      **********************************************************************
     C     DoProcess     BEGSR
      *    ===================
     C                   Select
      *
      * When F7 is used
      *
     C                   When      CmdKey='7' and CurSorPos<>0
      * Get Line1 Text and change color to White
     C                   Eval      %Subst(Text1:6:2)=X'22'+'*'
      * Show that data was changed
     C                   Exsr      #UpInf
      *
      * When F8 is used
      *
     C                   When      Cmdkey='8' and CursorPos<>0
      * Change Color to Blue
     C                   Eval      %Subst(Text1:6:2)=X'3a'+'*'
      * Show that data was changed
     C                   Exsr      #UpInf
     C                   EndSl
      *
     C                   EndSr
      *=====================================================================
      * Return codes set to update
      *=====================================================================
     C     #UpInf        BegSr
      *    ===================
     C                   Eval      OutRecs=1
     C                   Eval      Retcode='0'
     C                   EndSr

Editors comments:

Thanks Nick! This works great, and with a F6 being available there is always scope for at least one more colour. Good work fella!

Posted on