Constant and Variable Indexing

Restriction: This topic applies to UNIX environments only.
  1. Create the intermediate code file: Windows:
    cobol demo4.cbl /anim /nognt;
    UNIX:
    cob -a demo4.cbl
    In this program, the record structure is such that:
    • item1-1(2) and item1-3(2) are redefined by ptr2-notmod-1 and ptr2-notmod-2 respectively
    • item1-2(2,1) and item1-2(2,2) are redefined by ptr2-mod-1 and ptr2-mod-2
  2. Enter the command: Windows:
    cblscan64 -m demo4
    UNIX:
    cobscan64 -m demo4
    This produces the following report:
    Processing file 'demo4.int' 
    **Unsafe modification of pointer at (file: demo4.cbl, line: 26) 
      Modifier : ITEM1-2 (file: demo4.cbl, def: 13) 
      Pointer : PTR2-MOD-1 (file: demo4.cbl, def: 18) 
    
    **Unsafe modification of pointer at (file: demo4.cbl, line: 27) 
      Modifier : ITEM1-2 (file: demo4.cbl, def: 13)
      Pointer : PTR2-MOD-1 (file: demo4.cbl, def: 18) 
    
    **Unsafe modification of pointer at (file: demo4.cbl, line: 27) 
      Modifier : ITEM1-2 (file: demo4.cbl, def: 13)
      Pointer : PTR2-MOD-2 (file: demo4.cbl, def: 19)
    
    Finished file 'demo4.int' - pointer problems could exist
No information is generated for prt2-notmod-[12]; however, the static indexing for item1-2 at line 26 produces a warning of unsafe modification for ptr2-mod-1, and the run-time indexing of item1-2 at line 27 produces warnings for both ptr2-mod-1 and ptr2-mod-2. As the program uses variable indexing, Scan64 cannot determine statically which pointers are really affected.