IF TGRAC-GRAC-PNTR NOT = NULLS
TGRAC-GRAC-PNTR is not defined in your example code.
Given the example would not the group-level LOAD-BLLS also be assigned a POINTER definition ?
Seems like a strange data structure.
My own practice, I would not assign a definition (pointer, comp-3, comp, etc) to a group level.
Ralph
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"The USAGE clause can be specified for a data description entry with any level-number other than 66 or 88.
"When specified at the group level, the USAGE clause applies to each elementary item in the group. The usage of elementary items must not contradict the usage of a group to which the elementary items belongs."
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"The USAGE clause can be specified for a data description entry with any level-number other than 66 or 88.
"When specified at the group level, the USAGE clause applies to each elementary item in the group. The usage of elementary items must not contradict the usage of a group to which the elementary items belongs."
"The USAGE clause can be specified for a data description entry with any level-number other than 66 or 88.
"When specified at the group level, the USAGE clause applies to each elementary item in the group. The usage of elementary items must not contradict the usage of a group to which the elementary items belongs."
Where is TGRAC-GRAC-PNTR defined, and how is it defined in COBOL?
Could it possibly be in a copybook somewhere, or could it possibly be a special register in a non-GnuCOBOL compiler? Is it possible that TGRAC-GRAC-PNTR is misspelled or not defined in the compile unit?
I don't see any reason for that statement to fail, based on this test program named testpntr.cbl which I ran in Windows MinGW32 GnuCOBOL 3.1.2:
IDENTIFICATIONDIVISION.PROGRAM-ID.testpntr.ENVIRONMENTDIVISION.DATADIVISION.WORKING-STORAGESECTION.01WS-BELL-CHARPICX(01)VALUEX'07'.01TGRAC-GRAC-PNTRUSAGEISPOINTER.PROCEDUREDIVISION.DISPLAY"Hello, World! "WS-BELL-CHAR***CALL"C$SLEEP"USING001continueafter0.500secondsDISPLAY"One more time "WS-BELL-CHARMOVENULLSTOTGRAC-GRAC-PNTRDISPLAYTGRAC-GRAC-PNTRIFTGRAC-GRAC-PNTRNOT=NULLSDISPLAY"TGRAC-GRAC-PNTR IS NOT NULLS"ELSEDISPLAY"TGRAC-GRAC-PNTR IS EQUAL TO NULLS!"END-IFSTOPRUN.
Microsoft Windows [Version 10.0.19045.2965] Sun 05/14/2023 1:04:48
C:\COBOL>testpntr
Hello, World!
One more time
0x00000000
TGRAC-GRAC-PNTR IS EQUAL TO NULLS!
I also tested it under 64bit MSYS2 GnuCOBOL 3.2-rc2 for Windows and the results were only different in the width of the displayed pointer:
Microsoft Windows [Version 10.0.19045.2965] Sun 05/14/2023 1:09:16
C:\COBOL>testpntr
Hello, World!
One more time
0x0000000000000000
TGRAC-GRAC-PNTR IS EQUAL TO NULLS!
Microsoft Windows [Version 10.0.19045.2965] Sun 05/14/2023 1:09:21
C:\COBOL>
Last edit: Arnold Trembley 2023-05-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried a variation of testpntr.cbl where the pointer is defined as follows:
01 MY-POINTERS USAGE IS POINTER.
05 TGRAC-GRAC-PNTR.
And this compile FAILED with "invalid expression" when the pointer is compared to NULLS.
I also tried with VALUE NULLS and with PIC X(08) VALUE NULLS (which I know would work on IBM COBOL for MVS). The only additional information was to report an error for a Picture clause on a pointer, which also was allowed in IBM COBOL.
So it would appear that you have found a GnuCOBOL bug where USAGE POINTER does not work at the group level. I know it does work in IBM mainframe COBOL.
But if you specify USAGE POINTER at the elementary level in your data definition, it should work.
Kind regards,
Last edit: Arnold Trembley 2023-05-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The use of a group level usage clause is valid at 01 etc.
So if your code looks like this it is correct and the compiler is
showing a bug :
01 A USAGE POINTER.
03 B.
03 C.
Remind us, what is the version and platform of the Cobol compiler ?
You should report this problem as a bug but specify the compiler version
it is found in.
On 14/05/2023 02:27, pottmi wrote:
COBOL Crew,
Any suggestions on this error?
Is this something that should be "fixed" in GnuCOBOL or is it just
obtuse code that should be changed?
Can anyone recommend a change that would work?
Also, is there an option that instructs cobc to output the offending
line of code?
On Tue, May 9, 2023 at 10:28 AM pottmi pottmi@users.sourceforge.net wrote:
Hereisthestrangething....Iusethatvariableinmanyotherplacesinthecodeanditcompilesjustfine.Onlythe"IF TGRAC-GRAC-PNTR NOT = NULLS"isthrowingthaterror.Thisisacouplemillionlinesofcodesochangingthecodeisnotmyfirstchoice.OnTue,May9,2023at2:01AMArnoldTrembleyarn79@users.sourceforge.netwrote:IBMCOBOLsupportsusageatthegrouplevel,whichappliestoallelementaryitemsinthegroup.https://www.ibm.com/docs/en/cobol-zos/6.3?topic=entry-usage-clause"The USAGE clause can be specified for a data description entrywithanylevel-numberotherthan66or88."When specified at the group level, the USAGE clause applies toeachelementaryiteminthegroup.Theusageofelementaryitemsmustnotcontradicttheusageofagrouptowhichtheelementaryitemsbelongs."
I have this code:
The NOT = NULLS line fails with:
error: invalid expression
Is there some option I can turn on that will allow a POINTER to be
compared with NULL?
This compiles on Mainframe and Micro Focus.
IF TGRAC-GRAC-PNTR NOT = NULLS
TGRAC-GRAC-PNTR is not defined in your example code.
Given the example would not the group-level LOAD-BLLS also be assigned a POINTER definition ?
Seems like a strange data structure.
My own practice, I would not assign a definition (pointer, comp-3, comp, etc) to a group level.
Ralph
IBM COBOL supports usage at the group level, which applies to all elementary items in the group.
https://www.ibm.com/docs/en/cobol-zos/6.3?topic=entry-usage-clause
"The USAGE clause can be specified for a data description entry with any level-number other than 66 or 88.
"When specified at the group level, the USAGE clause applies to each elementary item in the group. The usage of elementary items must not contradict the usage of a group to which the elementary items belongs."
Here is the strange thing....
I use that variable in many other places in the code and it compiles
just fine. Only the "IF TGRAC-GRAC-PNTR NOT = NULLS" is throwing
that error.
This is a couple million lines of code so changing the code is not my
first choice.
On Tue, May 9, 2023 at 2:01 AM Arnold Trembley
arn79@users.sourceforge.net wrote:
COBOL Crew,
Any suggestions on this error?
Is this something that should be "fixed" in GnuCOBOL or is it just
obtuse code that should be changed?
Can anyone recommend a change that would work?
Also, is there an option that instructs cobc to output the offending
line of code?
On Tue, May 9, 2023 at 10:28 AM pottmi pottmi@users.sourceforge.net wrote:
Where is TGRAC-GRAC-PNTR defined, and how is it defined in COBOL?
Could it possibly be in a copybook somewhere, or could it possibly be a special register in a non-GnuCOBOL compiler? Is it possible that TGRAC-GRAC-PNTR is misspelled or not defined in the compile unit?
I don't see any reason for that statement to fail, based on this test program named testpntr.cbl which I ran in Windows MinGW32 GnuCOBOL 3.1.2:
And the results were:
GnuCOBOL Compile Returncode = 0
1 file(s) copied.
1 file(s) copied.
Microsoft Windows [Version 10.0.19045.2965] Sun 05/14/2023 1:04:48
C:\COBOL>testpntr
Hello, World!
One more time
0x00000000
TGRAC-GRAC-PNTR IS EQUAL TO NULLS!
I also tested it under 64bit MSYS2 GnuCOBOL 3.2-rc2 for Windows and the results were only different in the width of the displayed pointer:
cobc -x -Wall -fnotrunc -t C:\Users\Arnold\AppData\Local\Temp\testpntr.lst -o C:\Users\Arnold\AppData\Local\Temp\testpntr.exe testpntr.cbl
GnuCOBOL Compile Returncode = 0
1 file(s) copied.
1 file(s) copied.
Microsoft Windows [Version 10.0.19045.2965] Sun 05/14/2023 1:09:16
C:\COBOL>testpntr
Hello, World!
One more time
0x0000000000000000
TGRAC-GRAC-PNTR IS EQUAL TO NULLS!
Microsoft Windows [Version 10.0.19045.2965] Sun 05/14/2023 1:09:21
C:\COBOL>
Last edit: Arnold Trembley 2023-05-14
I tried a variation of testpntr.cbl where the pointer is defined as follows:
And this compile FAILED with "invalid expression" when the pointer is compared to NULLS.
I also tried with VALUE NULLS and with PIC X(08) VALUE NULLS (which I know would work on IBM COBOL for MVS). The only additional information was to report an error for a Picture clause on a pointer, which also was allowed in IBM COBOL.
So it would appear that you have found a GnuCOBOL bug where USAGE POINTER does not work at the group level. I know it does work in IBM mainframe COBOL.
But if you specify USAGE POINTER at the elementary level in your data definition, it should work.
Kind regards,
Last edit: Arnold Trembley 2023-05-14
Pottmi has created an official BUG report for this problem, and I have added a comment because it is broken in GC 3.1.2 and GC 3.2 rc2.
https://sourceforge.net/p/gnucobol/bugs/883/
The use of a group level usage clause is valid at 01 etc.
So if your code looks like this it is correct and the compiler is
showing a bug :
01 A USAGE POINTER.
03 B.
03 C.
Remind us, what is the version and platform of the Cobol compiler ?
You should report this problem as a bug but specify the compiler version
it is found in.
On 14/05/2023 02:27, pottmi wrote: