ENTMF 

Appendix E - Suppressing Population of COBOL Items During Parsing

Consider the following JSON text string:

{"msg":{"SND":9,"pid":1289,"txt":"Hello World!"}}

If you pass the string into the following COBOL program, you can suppress any of the sub-ordinate items (of msg) from being matched when the JSON PARSE statement is executed:

       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.

As a result of executing the JSON PARSE statement, the matching of pid is suppressed, and its previous value (1300) is retained. Suppressing a data item produces a non-exception code of 2.