Skip to Main Content
IBM Z Software


This portal is to open public enhancement requests against IBM Z Software products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Delivered
Workspace COBOL Compilers
Created by Guest
Created on Mar 10, 2020

JSON GENERATE : Conditional SUPPRESS

JSON object, unlike copy cobol, are flexible : a JSON object can have non-mandatory name/value pairs missing.

Currently with JSON GENERATE :
- for a string, when the value is all space, a single space is kept.
- for a number, when the value is 0, and it's a standard/correct value.
- SUPPRESS removes the pair regardless of the value.

We would like to create JSON objects from a single Copy Cobol with the JSON GENERATE instruction, and each JSON object generated may or may not contains certain name/value pair.

Today's workaround implies :
- Using multiple copies cobol that must match each pattern of a JSON object.
- Making intricate IF/ELSE/IF instructions with JSON GENERATE and the SUPPRESS keyword.

The task is particularly gruesome when arrays are involved

We suggest :
- make it possible to condition the SUPPRESS keyword depending on the value of the pair (ALLSPACE, ZERO, LOWVALUE, NOITEMSINARRAY, e.g.)
- have a new keyword (NULLIFY e.g.)

Idea priority Medium
  • Guest
    Reply
    |
    May 18, 2021

    This RFE has been delivered in the following

    COBOL V6.3 November 2020 PTF: APAR PH30975 https://www.ibm.com/support/pages/apar/PH30975
    COBOL V6.2 December 2020 PTF: APAR PH32356 31172 https://www.ibm.com/support/pages/apar/PH32356
    COBOL November 2020 Runtime PTF: APAR 31172 https://www.ibm.com/support/pages/apar/PH31172

  • Guest
    Reply
    |
    Nov 4, 2020

    Is it possible also that to SUPPRESS ALL-FIELDS ALLSPACE ZERO?
    Instead of coding for each field that might be optional, consider all fields are optional and should be omitted if "empty". This is the industry standard for JSON used in API's. So we should be able to easily support it in our code without having to duplicate the entire structure in the GENERATE statement.

  • Guest
    Reply
    |
    Oct 15, 2020

    It would be necessary to consider Array/Occurs and object as well in this RFE.

    If we have this copy cobol :
    01 copyJSon
    05 amount pic 9(5).
    05 myObject.
    10 thing1 pic X(10).
    05 myArray occurs 10.
    10 thingA pic X(10).
    10 thingB pic X(10).

    I move all space to copyJSon.
    I only supply data for amount, myArray(1) and myArray(2).
    We would like that the generated outcome be like this :

    {
    "amount": 500,
    "myArray": [
    {"thingA":"Hello","thingB":"World"},
    {"thingA":"Details","thingB":"Comments"}
    }

    Suggestions :
    JSON GENERATE buffer FROM copyJSon
    NAME OF copyJSon is OMITTED
    SUPPRESS myObject ALLSPACE
    SUPPRESS myArray ALLSPACE
    END-JSON

  • Guest
    Reply
    |
    Sep 18, 2020

    We are implementing more and more RESTful-API‘s to enable different customer oriented applications accessing our mainframe-based busines functions. The API-consumers expect the optional attributes not to be included in the server responce if they don't have sensible content. Therefore we are forced to eliminate the „empty“ items by means of string manipulation functions after the generating of JSON-Output. This post processing is more complex because of UTF-8 encoding and lowes noticeably the advatage of using of JSON GENERATE.
    Furthemore, there are some interfaces to software products in our company that use boolean data type, so we need boolean support too.
    This features would essentially simplify the development of RESTful-API's in a mainframe COBOL environment and reduce costs and time Need.

  • Guest
    Reply
    |
    Sep 15, 2020

    Sorry, forgot to mention the missing Boolean support. This was part of our RfE 142045, which was closed as a duplicate of this.

  • Guest
    Reply
    |
    Sep 15, 2020

    ALLSPACE and ZERO seems to be very helpful. But LOWVALUE might also be a good option. Can you please check, if this is also possible?

  • Guest
    Reply
    |
    May 1, 2020

    We have accepted this RFE and will be updated further once put into plan. Thanks.

  • Guest
    Reply
    |
    Apr 24, 2020

    Thank you for your recent response. We are reviewing it and will respond shortly.

  • Guest
    Reply
    |
    Apr 22, 2020

    Hi,

    Having ALLSPACE and ZERO is sufficient and would be very helpful for us.

    For the NULLIFY keyword, it was just a mere suggestion and it might actually be confusing :
    - it would have meant "don't add this key/value in my generate JSON if its value is 0 or space or Low-Value"
    - it is not as clear as SUPPRESS myJsonAlphaZoneBecauseIts ALLSPACES or SUPPRESS myJsonNumericZoneBecauseIts ZERO

    Thanks,

  • Guest
    Reply
    |
    Apr 14, 2020

    Hi,

    Out of the cases you mentioned, we could possibly do the ALLSPACE and ZERO scenarios.
    May we know if this is sufficient?

    Also can you please clarify what you mean by "have a new keyword (NULLIFY e.g.)" ?

    Thanks.