定数と変数の部分参照

制限事項: このトピックは UNIX 環境にのみ適用されます。
  1. 中間コード・ファイルを作成します。 Windows:
    cobol demo5.cbl /anim /nognt;
    UNIX:
    cobol -a demo5.cbl
    このプログラムでは、部分参照によってレコード p1 に静的および動的にアクセスします。
  2. 次のコマンドを入力して、このプログラムで Scan64 を実行します。Windows:
    cblscan64 -m demo5
    UNIX:
    cobscan64 -m demo5
    これにより次のレポートが生成されます。
    Processing file 'demo5.int' 
    **Unsafe modification of pointer at (file: demo5.cbl, line: 12) 
      Modifier : P1 (file: demo5.cbl, def: 6)
      Pointer : PTR2-1 (file: demo5.cbl, def: 8) 
    
    **Unsafe modification of pointer at (file: demo5.cbl, line: 13) 
      Modifier : P1 (file: demo5.cbl, def: 6) 
      Pointer : PTR2-1 (file: demo5.cbl, def: 8)
    
    **Unsafe modification of pointer at (file: demo5.cbl, line: 13)
      Modifier : P1 (file: demo5.cbl, def: 6) 
      Pointer : PTR2-2 (file: demo5.cbl, def: 9) 
    
    **Unsafe modification of pointer at (file: demo5.cbl, line: 14) 
      Modifier : P1 (file: demo5.cbl, def: 6)
      Pointer : PTR2-1 (file: demo5.cbl, def: 8) 
    
    **Unsafe modification of pointer at (file: demo5.cbl, line: 14)
      Modifier : P1 (file: demo5.cbl, def: 6)
      Pointer : PTR2-2 (file: demo5.cbl, def: 9)
    
    Finished file 'demo5.int' - pointer problems could exist 

    行 11 の最初の静的な部分参照は、適切な処理として、レポートされていません。一方、行 12 の 2 番目の静的部分参照は ptr2-1 の最初のバイトを上書きするので、違反としてレポートされています。

    行 13 と 14 では、構文チェックでコンパイラには変数 refm の中身に関する情報がなく、レコード p1 内のどのポインタでも変更される可能性があります。このため、Scan64 は 2 つのポインタ ptr2-1 と ptr2-2 の可能性のある違反をレポートします。