TRY ブロックを使用すると、実行時に発生する可能性のある例外についてコードのセクションをテストできます。CATCH ブロックでは、TRY ブロックの実行時に例外が発生した場合に処理する例外のタイプを指定する必要があります。FINALLY ブロックを使用すると、例外が発生したかどうかにかかわらず、TRY ブロックの後にコードのセクションを実行できます。
*> The example below shows that you can declare e at the point of use.
*> It is in scope until the end-try.
try
display "exception test"
catch e as type Exception
display e::Message
end-try
ローカル変数のサンプルも参照してください。これらのサンプルは、Start > All Programs > Micro Focus Visual COBOL > Samples 、 の場合JVM COBOL 言語リファレンスの場合 (Windows) または $COBDIR/demo (UNIX)。 に用意されています。