The demonstration program demo3.cbl shows how prototypes are used to create implicit definitions of pointers within scanned programs, and how incompatible parameters are reported.
cob -a demo3.cblThe parameter to which you should pay attention in this program is the ptrnum-g group item. Without prototypes for the various calls used within this program this source file pass through Scan64 without problems.
cobscan64 demo3This produces the following report:
Processing file 'demo3.int' Finished file 'demo3.int' - pointer usage is OK
cobscan64 -m -t demoproto.cpy demo3gives:
Processing file 'demo3.int' **Possible unsafe modification of 'BY REFERENCE' pointer parameter **in CALL 'CBL_ALLOC_MEM' statement at (file: demo3.cbl, line: 10) Modifier : PTRNUM-G (file: demo3.cbl, def: 5) Pointer : MEM-PTR a formal parm (file: demoproto.cpy, def: 17, ref: 29, no: 1) in CALL prototype of CBL_FREE_MEM (file: demoproto.cpy, def:28) as implicitly def'd by CALL at (file: demo3.cbl, line: 10) **Possible unsafe modification of 'BY VALUE' pointer parameter **in CALL 'CBL_FREE_MEM' statement at (file: demo3.cbl, line: 13) Modifier : PTRNUM-G (file: demo3.cbl, def: 5) Pointer : MEM-PTR a formal parm (file: demoproto.cpy, def: 17, ref: 29, no: 1) in CALL prototype of CBL_FREE_MEM (file: demoproto.cpy, def:28) as implicitly def'd by CALL at (file: demo3.cbl, line: 13) **Unsafe modification of pointer at (file: demo3.cbl, line: 17) Modifier : PTRNUM (file: demo3.cbl, def: 6) Pointer : MEM-DUMMY-PTR (file: demoproto.cpy, def: 19) of formal parm MEM-DUMMY-PTR-G (file: demoproto.cpy, def: 18, ref: 32, no: 1) in CALL prototype of CBL_DUMMY_ALLOC_MEM (file: demoproto.cpy, def:31) as implicitly def'd by CALL at (file: demo3.cbl, line: 15) Finished file 'demo3.int' - pointer problems could existThis report contains two kinds of warning: