PDA

View Full Version : Token processing



Guest.Visitor
01-08-2002, 05:14 AM
Hi Chip, There is a LX macro included with Code that you may be able to modify to do what you are asking. I was able to change it to end my rpg IF & DO structures so hopefully with some tweaking it could work for COBOL too. Look for RPGENT.LX in the Macros folder. HTH Eric Dalton Health Care Software edalton@hcssupport.com "Chip Milosch" <cmilosch@ameritech.net> wrote in message news:a1eti0$1e1o$1@news.boulder.ibm.com... > Is there a way to 'trap' the processing of tokens inside of the Code Editor? > I want to be able to catch instances of the user inputing certain COBOL > verbs such as Perform, String, etc. The idea would be to see that Perform > was entered, and optionally create a corresponding End-Perform statement > below, aligned to the same column as Perform. Of course to do this I also > need to know what column Perform appears in. > > thanks. > > chip milosch > cmilosch@ameritech.net > > >

Chip Milosch
01-08-2002, 06:48 AM
Is there a way to 'trap' the processing of tokens inside of the Code Editor? I want to be able to catch instances of the user inputing certain COBOL verbs such as Perform, String, etc. The idea would be to see that Perform was entered, and optionally create a corresponding End-Perform statement below, aligned to the same column as Perform. Of course to do this I also need to know what column Perform appears in. thanks. chip milosch cmilosch@ameritech.net

Guest.Visitor
01-16-2002, 05:45 AM
Below is a macro that does something like what you want but in RPG. You should be able to convert it to work with COBOL. -- ------------------------------------------------------ Scott P. Johnson Applications Development Team Coordinator Microcomputer Development Specialist IBM Certified Specialist - AS/400 RPG Programmer Highsmith Inc. W5527 Hwy 106, PO BOX 800 Fort Atkinson, WI 53538-0800 TEL: 920-563-9571 FAX: 920-563-7395 sjohnson@highsmith.com www.highsmith.com ------------------------------------------------------ /*----------------------------------------------------------------------------*/ /* EXPANDIT Macro */ /* Original Programmer: Larry Paque */ /* Echo Service Company */ /* */ /* Modified by: Scott P. Johnson */ /* */ /* This macro will perform the following functions: */ /* Expand IF statements to include ENDIF (and ELSE) */ /* Expand DO statements to include ENDDO */ /* Expand SELECT statements to include WHEN, OTHER, and ENDSL */ /* Expand BEGSR statements to include ENDSR and comment area */ /* */ /* */ /* Assign Key Action in RPGLE400.LXU */ /* 'set action.S-C-E MACRO EXPANDIT FULL' */ /* OR */ /* 'SET ACTIONBAR.E~xtras.Expander MACRO EXPANDIT FULL' */ /* 'SET ACCELERATOR. S-C-E' */ /*----------------------------------------------------------------------------*/ if translate(arg(1)) = "FULL" then full = "YES" startline = 0 lineinfo = "" /* Set default new line number */ 'extract element into startline' newline= startline + 1 /* Set default new column number */ newcolumn = 26 /* Read the current line */ 'extract content into lineinfo' /* Process for IF statements */ if translate(substr(lineinfo,26,2)) = "IF" then do 'insert C ' if full = "YES" then do 'insert *' 'insert C Else ' 'insert C ' 'insert *' end 'insert C EndIf ' 'insert *' end /* Process for DO statements */ if translate(substr(lineinfo,26,2)) = "DO" then do if full = "YES" then do newline = startline + 2 'insert *' end 'insert C ' if full = "YES" then 'insert *' 'insert C EndDo ' 'insert *' end /* Process for SELECT statements */ if translate(substr(lineinfo,26,6)) = "SELECT" then do newline = startline + 2 newcolumn = 36 'insert *' 'insert C When Xxxxx = Yyyyy' 'insert C ' 'insert *' 'insert C Other ' 'insert C ' 'insert *' 'insert C EndSl ' 'insert *' end /* Process for BEGSR statements to be the form of: */ /* * */ /* *================================================= ==============* */ /* /TITLE ????????????????????????????? */ /* *================================================= ==============* */ /* CSR xxxxxxxxxx BEGSR */ /* *---------------------------------------------------------------* */ if translate(substr(lineinfo,26,5)) = "BEGSR" then do newline = startline + 8 'find element 'startline - 1 'insert *' 'insert *================================================= ==============*' 'insert /TITLE ????????? ' 'insert *================================================= ==============*' 'find element 'startline + 4 'insert *---------------------------------------------------------------*' 'insert *' 'insert *' 'insert C' 'insert *' 'insert C EndSr ' 'insert *' end /* Place the cursor */ 'find element 'newline 'set cursorcol 'newcolumn /* End of REXX procedure */ exit