OpenCOBOL is amazingly complete ANSI85 + plus much of 2002. Some
OpenCOBOL only functions may help you with string processing.
Function TRIM()
Function SUBSTITUTE()
Function CONCATENATE()
Trim especially helps with calling NON-COBOL functions, for example:
STRING Trim(my-str-var) x"00" delimited by size into my-C-parm.
Call "my-C-Func" using my-C-parm.
or
Compute Actual-length-entered = Length(trim(mystring)).
Substitute works like INSPECT only better, because substitute strings
can vary in length.
Concatenate is like STRING, less verbiage.
Use the Compiler option -ffunctions-all so you won't need to include the
key word "FUNCTION" in your source code.
http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf
--
Mike
On 09/19/2012 09:38 AM, Robert W. Mills wrote:
> It is currently in pure OpenCOBOL 1.1.
>
> My routines that handle $include files and copy modules already use recursion. Will have a look at a recursive solution for handling the nested macros as well. Thanks for the suggestion.
>
> regards,
> Robert W.Mills
>
>
> On 19 Sep 2012, at 02:39 PM, Michael Anderson <[log in to unmask]> wrote:
>
>> On 09/18/2012 08:54 AM, Robert W. Mills wrote:
>>> After 4 years without them on OpenCOBOL & MicroFocus I decided to write my own preprocessor.
>>>
>>> The current version runs a bit slow (has to make 2 passes of the source file and uses an indexed work file) and can not handle nested macros
>> Depending on what language used for your preprocessor, it seem to me that "if" the macro handler is a separate function call, then you could add some recursive logic to it?
>>
>> * To join/leave the list, search archives, change list settings, *
>> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|