次の JSON テキスト文字列があるとします。
{"msg":{"SND":9,"pid":1289,"txt":"Hello World!"}}
この文字列を次の COBOL プログラムに渡すと、JSON PARSE 文の実行時に従属項目 (msg の項目) を照合しないように抑制できます。
Identification division. Program-id. jparse1. Data division. Working-storage section. 01 msg. 03 snd usage comp-1. 03 pid pic 9999 usage display. 03 txt pic x(12). Linkage section. 01 json-str pic x(53). Procedure division using json-str. move 1300 to pid. display "Parsing....". JSON PARSE json-str into msg with DETAIL SUPPRESS pid END-JSON. if snd equal to 9 then DISPLAY "PID is " pid DISPLAY "Message text is '" txt "'" end-if. display "JSON-STATUS is " JSON-STATUS. goback. End program jparse1.
この JSON PARSE 文を実行すると、pid の照合が抑制され、前の値 (1300) のまま保持されます。データ項目を抑制すると、非例外コード 2 が生成されます。