XML 対応レコードの作成後は、プログラムの手続き部から、それらのレコードにアクセスする必要があります。この用途には通常の COBOL 動詞を使用でき、これらの動詞の XML 構文拡張も使用できます。詳細については、「XML 構文拡張」を参照してください。
手続き部で widgets.xml ファイルの内容を出力するプログラムの例を次に示します。
$set p(prexml) endp
select xml-stream assign "widgets.xml"
organization is xml
document-type is "widgets.xsd"
file status is file-status-spec.
xd xml-stream.
copy "widgets.cpy".
data division.
working-storage section.
01 file-status-spec PIC S9(9).
procedure division.
open output xml-stream
write widgets
display file-status-spec
close xml-stream
stop run.