[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error: invalid expression on USAGE POINTER item
From: |
J Leslie Turriff |
Subject: |
Re: error: invalid expression on USAGE POINTER item |
Date: |
Mon, 15 May 2023 00:59:30 -0500 |
User-agent: |
KMail/1.9.10 |
Um... where is the second compile? And what version of COBOL are you
emulating?
In any case, AFAIK this is proper operation. As the IBM Z/OS Language
Reference V6.2 states,
|When the USAGE clause is not specified at either the group or elementary
level, a usage clause is
implied with:
| v Usage DISPLAY when the PICTURE clause contains only symbols other than G or
N
| v Usage NATIONAL when the PICTURE clause contains only one or more of the
symbol N and
the NSYMBOL(NATIONAL) compiler option is in effect
| v Usage DISPLAY-1 when the PICTURE clause contains one or more of the symbol
N and the
NSYMBOL(DBCS) compiler option is in effect
So effectively, USAGE defaults to one of the DISPLAY modes, so C-W
can't be used as a
POINTER variable.
Leslie
On 2023-05-14 19:02:44 Michael Potter wrote:
> Vincent Coen suggested I report this as a bug.
>
> Two compiles of same code:
>
> [okicks@vm-openkicks OC_GrpLvlPointer]$ cobc GRPPOINT.cbl
> GRPPOINT.cbl:20: error: invalid expression
>
> [okicks@vm-openkicks OC_GrpLvlPointer]$ cobc -V
> cobc (GnuCOBOL) 4.0-early-dev.0
> Copyright (C) 2022 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <https://gnu.org/licenses/gpl.html> This is free software; see the source
> for copying conditions. There is NO warranty; not even for MERCHANTABILITY
> or FITNESS FOR A PARTICULAR PURPOSE. Written by Keisuke Nishida, Roger
> While, Ron Norman, Simon Sobisch, Edward Hart Built Feb 10 2023
> 13:51:10
> Packaged Feb 10 2023 18:49:59 UTC
> C version "11.3.1 20220421 (Red Hat 11.3.1-2)"
>
> [okicks@vm-openkicks OC_GrpLvlPointer]$ cat GRPPOINT.cbl
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. GRPPOINT.
> AUTHOR. Replatform Technologies, LLC.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 A-W USAGE POINTER.
> 03 B-W USAGE POINTER.
> 03 C-W.
> LINKAGE SECTION.
> PROCEDURE DIVISION.
> DISPLAY 'IN GRPPOINT'
> SET B-W to NULL
> SET C-W to NULL
>
> IF B-W NOT = NULL
> DISPLAY "B NOT NULL"
> END-IF
> IF C-W NOT = NULL
> DISPLAY "C NOT NULL"
> END-IF
> STOP RUN
>
> ========================================
> pottmi@ubuntu ~/gitlab/cobolcompilertests/OC_GrpLvlPointer
> % cobc GRPPOINT.cbl
> GRPPOINT.cbl:9: error: PICTURE clause required for 'C-W'
> GRPPOINT.cbl:14: error: SET target 'C-W' is not numeric, an INDEX or a
> POINTER GRPPOINT.cbl:20: error: invalid expression
> pottmi@ubuntu ~/gitlab/cobolcompilertests/OC_GrpLvlPointer
> % cobc -V
> cobc (GnuCOBOL) 4.0-early-dev.0
> Copyright (C) 2021 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <https://gnu.org/licenses/gpl.html> This is free software; see the source
> for copying conditions. There is NO warranty; not even for MERCHANTABILITY
> or FITNESS FOR A PARTICULAR PURPOSE. Written by Keisuke Nishida, Roger
> While, Ron Norman, Simon Sobisch, Edward Hart Built Oct 13 2021
> 18:23:24
> Packaged Oct 14 2021 01:18:06 UTC
> C version "9.3.0"
> pottmi@ubuntu ~/gitlab/cobolcompilertests/OC_GrpLvlPointer
> % cat GRPPOINT.cbl
> IDENTIFICATION DIVISION.
> PROGRAM-ID. GRPPOINT.
> AUTHOR. Replatform Technologies, LLC.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 A-W USAGE POINTER.
> 03 B-W USAGE POINTER.
> 03 C-W.
> LINKAGE SECTION.
> PROCEDURE DIVISION.
> DISPLAY 'IN GRPPOINT'
> SET B-W to NULL
> SET C-W to NULL
>
> IF B-W NOT = NULL
> DISPLAY "B NOT NULL"
> END-IF
>
> IF C-W NOT = NULL
> DISPLAY "C NOT NULL"
> END-IF
>
> STOP RUN
> .
--
Platform: Linux
Distribution: openSUSE Leap 15.4 (x86_64)
- error: invalid expression on USAGE POINTER item, Michael Potter, 2023/05/14
- Re: error: invalid expression on USAGE POINTER item,
J Leslie Turriff <=
- Re: error: invalid expression on USAGE POINTER item, Ron Norman, 2023/05/15
- Re: error: invalid expression on USAGE POINTER item, Simon Sobisch, 2023/05/15
- Re: error: invalid expression on USAGE POINTER item, Michael Potter, 2023/05/15
- Re: error: invalid expression on USAGE POINTER item, Michael Potter, 2023/05/20
- Re: [GnuCOBOL-Dev] error: invalid expression on USAGE POINTER item, Ron Norman, 2023/05/22
Re: error: invalid expression on USAGE POINTER item, James K. Lowden, 2023/05/15