cob demo1.cbl
cobscan64 demo1This produces the following report:
Processing file 'demo1.int' **Unsafe modification of pointer at (file: demo1.cbl, line: 9) Pointer : PP (file: demo1.cbl, def: 6) Finished file 'demo1.int' - pointer problems could exist
Look at the source for demo1.cbl. Line 9 of the program contains the following:
move low-values to ppg
This modification of the group item containing the pointer pp is unsafe, as the memory occupied by the pointer pp is treated as an alphanumeric data item. In this case, since low-values is being moved, no changes are necessary. However, it would be better practice to change the code at line 9 to:
set pp to null
It can be difficult in COBOL to identify the point at which a pointer is modified. Use the Scan64 -m option to help you identify code that modifies pointers.
For example:
cobscan64 -m demo1
produces:
Processing file 'demo1.int' **Unsafe modification of pointer at (file: demo1.cbl, line: 9) Modifier : PPG (file: demo1.cbl, def: 5) Pointer : PP (file: demo1.cbl, def: 6) Finished file 'demo1.int' - pointer problems could exist