gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] USING BY CONTENT LENGTH OF


From: Tim Nixon
Subject: [open-cobol-list] USING BY CONTENT LENGTH OF
Date: Fri Feb 11 13:14:18 2005

To all:
We've found a problem. There is some Cobol code that is called like this
CALL 'foo' USING BY CONTENT LENGTH OF <var>
The cobol function 'foo' does not receive this value correctly (its
parameter type is binary 9(9)  or  PIC 9(9) COMP per IBM)
Through testing I found that more generally any call that used an integer BY
CONTENT failed, for example CALL 'foo" USING BY CONTENT 38. We did some
digging and came up with a fix for the issue of BY CONTENT with any numeric
in codegen.c. The line identified below was added to output_call  in the
second output args loop. 
case CB_CALL_BY_CONTENT:
          output_prefix ();
          if (CB_NUMERIC_LITERAL_P (x) || x == cb_null
added===>  ||CB_TREE_CATEGORY (x) == CB_CATEGORY_NUMERIC)
This additional test forces the code to recognize things line BY CONTENT 38
or BY CONTENT LENGTH OF <var> as numerics and they are then received in the
function correctly.

Initially, I thought passing just the LENGTH OF a variable (without by
CONTENT or VALUE) was also broken, then I realized that this is not allowed.

If there is a better fix for this let me know.


Tim Nixon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]