定数と変数の索引

制限事項: このトピックは UNIX 環境にのみ適用されます。
  1. 中間コード・ファイルを作成します。 Windows:
    cobol demo4.cbl /anim /nognt;
    UNIX:
    cob -a demo4.cbl
    このプログラムでは、レコード構造は次のようになります。
    • item1-1(2) と item1-3(2) は、それぞれ ptr2-notmod-1 と ptr2-notmod-2 によって再定義されます。
    • item1-2(2.1) と item1-2(2.2) は、ptr2-mod-1 と ptr2-mod-2 によって再定義されます。
  2. 次のコマンドを入力します。 Windows:
    cblscan64 -m demo4
    UNIX:
    cobscan64 -m demo4
    これにより次のレポートが生成されます。
    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
prt2-notmod-[12] については情報は何も生成されません。ただし、line 26 での item1-2 の静的索引は ptr2-mod-1 の危険な修正の警告を生成し、line 27 での item1-2 のランタイム索引は ptr2-mod-1 と ptr2-mod-2 の両方の警告を生成します。プログラムは変数索引を使用するので、Scan64 はどのポインタが実際に影響されるかを静的に判断できません。