COBOL

COBOL

COBOL

COBOL is responsible for the efficient, reliable, secure, and unseen day-to-day operations of the world's economy.

 View Only
  • 1.  JSON GENERATE without top level name

    Posted Thu March 21, 2019 05:30 PM

    https://www-01.ibm.com/support/docview.wss?uid=swg1PH02251 allows for parsing of JSON with no "top level name".  Shouldn't JSON GENERATE allow generation of JSON without a top level name?  Most examples I see do not have a top level name.  Am I missing something?

    fswarbrick


  • 2.  Re: JSON GENERATE without top level name

    Posted Wed April 03, 2019 05:40 PM

    Thanks for your input and COBOL team has reviewed it.

     

    Currently, COBOL JSON GENERATE generates JSON texts always with a top level name because this preserves all information about the COBOL group. This could sometimes be useful if different processing are needed for different COBOL 01 records. In that case, we could use one program (in downstream processing, for example) receiving the JSON text, and following different logic path according to the top level name. Otherwise some control mechanism would be needed outside of the receiving program(s), and multiple programs might be needed. This could be less convenient.
     
    For cases where only one COBOL top level record requires JSON processing, the extra top level name should not cause any difficulty. Having said that, adding optional syntax to control this behaviour could reduce unnecessary information in the output.  We will consider this as a further enhancements to JSON, would you like to open an RFE for your tracking?
     

    Roy Bae


  • 3.  Re: JSON GENERATE without top level name

    Posted Wed April 03, 2019 05:59 PM

    I am not questioning the reason why you generate a top level name.  I am just saying that in some (many?) cases it could be that a JSON structure is already defined and we just have to conform to it.  If the defined structure does not have a top level name then JSON GENERATE needs to be able to conform to that.  Just in the same way that JSON PARSE has to handle the same situation.

    I'll open an RFE and post the number here.

    fswarbrick


  • 4.  Re: JSON GENERATE without top level name

    Posted Wed April 03, 2019 06:38 PM


  • 5.  Re: JSON GENERATE without top level name

    Posted Thu April 04, 2019 10:26 AM

    Thanks for the follow-up.

    Roy Bae


  • 6.  Re: JSON GENERATE without top level name

    Posted Thu December 12, 2019 08:24 PM

    Looks like this RFE has been implemented with APAR PH18641.  I haven't got the "fix" implemented yet, but from the documentation (https://www.ibm.com/support/knowledgecenter/en/SS6SG3_6.3.0/lr/ref/rlpsjsog.html) it appears to be exactly what I asked for.  Thank you very much!

    fswarbrick