For this example, use the demonstration file demo2.cbl.
-
Create the intermediate code file:
cobol demo2.cbl /anim /nognt;
This example contains calls to the library routines CBL_ALLOC_MEM or CBL_FREE_MEM; without call prototypes any pointers provided to these routines are effectively redefined to alphanumeric.
-
Run Scan64 on this program by entering the command:
cblscan64 demo2
This produces the following report:Processing file 'demo2.int'
**Possible unsafe modification of pointer in a 'BY REFERENCE' parameter
**in CALL 'CBL_ALLOC_MEM' statement at (file: demo2.cbl, line: 8)
Pointer : PTR (file: demo2.cbl, def: 5)
**Possible unsafe reference of pointer in a 'BY VALUE' parameter
**in CALL 'CBL_FREE_MEM' statement at (file: demo2.cbl, line: 11)
Pointer : PTR (file: demo2.cbl, def: 5)
Finished file 'demo1.int' - pointer problems could exist
-
However, you can specify that Scan64 should use the prototype file demoproto.cpy which defines the APIs CBL_ALLOC_MEM and CBL_FREE_MEM:
cblscan64 -t demoproto.cpy demo2
This produces the following report:Processing file 'demo2.int'
Finished file 'demo2.int' - pointer usage is OK
In this case, no messages are generated because
Scan64 knows that CBL_ALLOC_MEM and CBL_FREE_MEM expect pointers to be passed into them and there is no danger of them being treated as fixed size alphanumeric.