Cybersecurity
DevOps Cloud (ADM)
IT Operations Cloud
We are doing a conversion from HP COBOL to ACUCOBOL-GT. We have code in the copylib file like below:
001400 01 [1]LOCN-M.
LOCNM
001500 05 [1]LOCN-ID   ; PIC X(6).
LOCNM
001600 05 [1]DESCRIPTION P IC X(30)
LOCNM
001700 05 [1]LOCN-TYPE &nb sp; PIC X(4).
LOCNM
001800 05 [1]REP-DRD.
LOCNM
001900 10 [1]REP-DIVISION.
LOCNM
002000 15 [1]REP-DIVISION-1B PIC X(1).
LOCNM
002100 15 [1]REP-DIVISION-2B PIC X(1).
LOCNM
002200 10 [1]REP-REGION.
LOCNM
002300 15 [1]REP-REGION-1B PIC X(1).
LOCNM
And the copy replacing statement in the program is:
COPY LOCNM OF "." REPLACING ==[1]== BY ==LCM-==.
When compiled with the -cp option, a syntax error message is encountered and it looks like the copy replacing did not work:
line 5: syntax error scanning LOCN-M LOCNM,
line 6: syntax error scanning LOCN-ID LOCNM,
line 7: syntax error scanning DESCRIPTION LOCNM,
line 8: syntax error scanning LOCN-TYPE LOCNM,
line 9: syntax error scanning REP-DRD LOCNM,
line 10: syntax error scanning REP-DIVISION LOCNM,
line 11: syntax error scanning REP-DIVISION-1B LOCNM,
line 12: syntax error scanning REP-DIVISION-2B LOCNM,
line 13: syntax error scanning REP-REGION LOCNM,
line 14: syntax error scanning REP-REGION-1B LOCNM,
This compiles correctly with HP COBOL.
The [ ] delimiters are not valid delimiters recognized by the ACUCOBOL-GT compiler.
In addition to the use of single and double quotes to delimit the substring, the following delimiters are also allowed:
==(XYZ)==
==|XYZ|== (in HP COBOL compatibility mode)
==*XYZ*==
==:XYZ:==
==XYZ*==
==XYZ&==
==XYZ#==
Changing the copybook to look like this:
001200******************************************************************
LOCNM
001300*
LOCNM
001400 01 |1|LOCN-M.
LOCNM
001500 05 |1|LOCN-ID   ; PIC X(6).
LOCNM
001600 05 |1|DESCRIPTION P IC X(30).
LOCNM
001700 05 |1|LOCN-TYPE &nb sp; PIC X(4).
LOCNM
001800 05 |1|REP-DRD.
LOCNM
001900 10 |1|REP-DIVISION.
LOCNM
002000 15 |1|REP-DIVISION-1B PIC X(1).
LOCNM
002100 15 |1|REP-DIVISION-2B PIC X(1).
LOCNM
002200 10 |1|REP-REGION.
LOCNM
002300 15 |1|REP-REGION-1B PIC X(1).
LOCNM
and the copy replacing line to look like this:
copy LOCNM2 of "." replacing ==|1|== by ==LCM==.
no errors are encounted when compiling.