拡張コピーブック ビュー

COBOL エディターでは、プログラムまたはコピーブックでコピーブックが参照される場所に、コピーブックの内容をインラインで表示する機能がサポートされます。次の機能があります。

コピーブックの表示

単一のコピーブックを表示するには

  • エディターで COPY 文の行を右クリックし、[Show "CpyFileName.cpy"] をクリックします。

    コピーブックが編集モードのインラインで表示されます。

ソース ファイルで参照されるすべてのコピーブックを表示するには、次の手順を実行します。

  • ファイルがエディターで開かれたら、COBOL ツールバーの Show all copybooks in the current source file をクリックするか、またはコードを右クリックして [Show All Copybooks] をクリックします。

    拡張コピーブックに含まれるコピーブックも表示されます。

注:
  • 書き込みアクセス権がないコピーブックは、読み取り専用モードで表示されます。これには、管理者の権限なしで Visual Studio を実行している場合のシステム コピーブックも含まれます。
  • COPY 文がある行で [Go To Definition] を使用すると、コピーブックの内容がインラインで表示されます。
  • COPY...REPLACING を使用して参照されるコピーブックの場合、[Show all copybooks] コマンド、[Go To Definition]、[Error List] ウィンドウからのエラーへの移動、[Find All References]、およびドロップダウンのタイプとメンバーを使用したナビゲーションは、コピーブックが元の内容で既に表示されていない限り、いずれも読み取り専用の拡張コピーブック ビュー内の項目を、置き換えられた値によって表示します。

置き換えられた値によるコピーブックの表示

COPY...REPLACING 文を使用して参照されるコピーブックの場合、元の内容を表示するか、または置き換えられた値による内容を表示できます。

  • エディターで、COPY...REPLACING 文の行を右クリックし、[Show "CpyFileName.cpy" with replaced values] をクリックします。

    コピーブックが置き換えられた値によって読み取り専用モードで表示されます。

編集モードに切り替えるには、[COPY] ビューを右クリックするか読み取り専用ビュー内を右クリックして、[Show "CpyFileName.cpy" for editing] をクリックします。

コピーブックの非表示

単一のコピーブックでは、次の手順を実行します。

  • エディターで COPY 文または拡張コピーブック ビュー内を右クリックし、[Hide "CpyFileName.cpy"] をクリックします。

現在のファイルですべてのコピーブックを非表示にするには

  • COBOL ツールバーの Hide all copybooks ([Hide all copybooks]) をクリックするか、またはエディターでソース ファイルを右クリックして [Hide all copybooks] をクリックします。

コピーブックの開始位置または終了位置への移動

エディターの拡張コピーブック ビューに表示されているコピーブックの開始位置に移動するには、次の手順を実行します。

  • 拡張コピーブックのコードを右クリックし、[Go To Start Of "CpyFileName.cpy"] をクリックします。

    COPY 文の行直後のコピーブックの最初の行にカーソルが移動します。

エディターの拡張コピーブック ビューで表示されているコピーブックの終了位置に移動するには

  • 拡張コピーブックのコードを右クリックし、[Go To End Of "CpyFileName.cpy"] をクリックします。

    カーソルがコピーブックの終了位置に移動します。

拡張コピーブック ビューでのコピーブック編集

拡張コピーブック ビューでコピーブックを編集できます。変更を保持するには、拡張コピーブック ビューでコピーブックを編集したファイルを保存する必要があります。これにより、変更を加えた後にコピーブックを非表示にしても変更は保存されます。

拡張コピーブック ビューでの編集またはエディターの単独のタブで開いた場合の編集のどちらでも、コピーブックを編集すると、コピーブックが表示される他のどの場所でも変更内容が自動で表示されます。

拡張コピーブック ビューでコピーブックに変更を加えた後にソース プログラムを閉じると、コピーブック ファイル自体で変更を保存するように指示されます。

注: 拡張コピーブック ビューでは、置き換えられた値によって表示される、COPY...REPLACING 文を使用して参照されるコピーブックを編集することはできません。この場合、拡張コピーブック ビューは読み取り専用です。それらのコピーブックを開いて編集するには、COPY...REPLACING 文の行を右クリックし、[Show "CpyFileName.cpy" for editing] をクリックします。

エディターの単独タブでのコピーブックの編集

エディターの単独タブで COBOL ソース内からコピーブックを開くには、次の手順を実行します。

  • COPY 文を含んでいるソース コードの行を右クリックし、[Open "CopybookName" in New Window] をクリックします。

    エディターの単独のタブでコピーブックが開き編集できます。

エディターの単独タブで開いているコピーブックを閉じると、そのコピーブックが表示されていたすべてのソース ファイルでそのコピーブックの拡張コピーブック ビューが非表示になります。拡張コピーブック ビューを再び表示する必要がある場合、手動で開く必要があります。

拡張コピーブック ビューでのデバッグのサポート

デフォルトで、デバッガーは拡張コピーブック ビューでインラインでステップ実行しながらデバッグを行います。この動作は、[ツール > オプション > デバッグ > COBOL] から変更できます。

拡張コピーブック ビューでのデバッグのサポートには次の機能が含まれています。

  • 拡張コピーブック ビューで、ブレークポイントと COBOL 監視ポイントを通常の方法で直接コピーブック ファイルに設定できます。
  • デバッグ時に、拡張コピーブック ビュー内でステップ実行できます。IDE では、ステップインしたとき、またはコピーブックのブレークポイントにヒットしたとき、コピーブックが自動で展開されます。
  • 拡張コピーブック ビュー内でピンされたデータ ヒントを表示できます。
  • 拡張コピーブック ビュー内で、[Quickwatch] および [Add Watch] コマンドを使用できます。
  • いくつかのデバッガー コマンド、例えば [Show Next Statement]、[Run To Cursor]、[Set Next Statement] などを、拡張コピーブック ビューのコンテキスト メニューから実行できます。
注: 拡張コピーブック ビューには、次の制限事項が適用されます。
  • The expanded copybook view displays bookmarks in copybooks and commands for bookmarks such as enable or disable are supported. However, using Next/Previous and the Bookmark window will open the standalone copybook file rather than inline view.
  • It is not possible to edit copybooks referenced through a COPY... REPLACING statement in expanded copybook view when the view shows the replaced values. In this case, the expanded copybook view is read-only.
  • The read-only status of expanded copybooks is not preserved when you close the project. Next time you open the project, the copybook is shown in the Expanded Copybook view but not as read-only.
  • If you used the OF or IN phrases with a COPY statement, it is not possible to show the corresponding copybook in the Expanded Copybook view or open it using the Open "CopybookName" in New Window command if the copybook is stored in a library file (where you have used the COPYLBR Compiler directive).
  • Navigating to items in the expanded copybook view is not supported from the Class View or using the Navigate To command.
  • References to file locations in the output windows such as pointing to the build output, or in the results received by Find in Files, do not point to items in the expanded copybook view.
  • Selecting the currently selected statement in the call stack in an expanded copybook may show the actual copybook. You can use the Show Next Statement command of the debugger to return the actual expanded copybook position.
  • The Breakpoints window always shows the line number of a breakpoint within the file containing it, not the line number within expanded copybook view.
  • The Call Stack, Threads and IntelliTrace windows all display line numbers corresponding to the file containing the statement, not the line number within expanded copybook view.
  • If you move the caret to an invalid position in the expanded copybook view, the Set Next Statement command will display an ‘Unable to set the next statement to this location’ error message and the copybook will be opened as a separate document.
  • When stepping through .NET COBOL code, if the next statement to step onto is within the same class or program, and on the same line number, but in a different source file, the debugger steps over that statement. For example, if you try to step from line 10 of Program1.cbl to line 10 of Copybook1.cpy, the debugger steps over the statement in the copybook.