IBM Support

z/OS Connect EE JSON schema for C program fields maxLength value less by one of field length

Question & Answer


Question

Why are the JSON fields are being shortened by 1? I am running z/OS Connect Enterprise Edition (zCEE) on z/OS 2.2 at this level:

WebSphere Application Server 17.0.0.2, WAS FOR Z/OS 17.0.0.2, z/OS
Connect 03.00.04 (wlp-1.0.17.cl170220170523-1818)

I am setting up an example to show zCEE doing an API call to a C program in CICS Transaction Server for z/OS (CICS TS).

I created a simple C program that I can run in CICS TS V5.3, that takes a CommArea as input.

This shows the C structure that maps the CommArea for output:

    struct outputCommarea_v1 {
       char ca_output_field_1[10];
       char ca_output_field_2[20];
       int ca_output_number_1;
       long ca_output_number_2;
       char ca_cics_tran_id[4];
       char ca_userId[8];
       char ca_jobname[8];
       char ca_distributedName[246];
       char ca_realm[255];
     }output ;

Note for example this field - char ca_jobname[8];

I ran job to generate the sar file and in the generated JSON the above field is defined this way:

                   "ca_jobname":{
                      "type":"string",
                      "maxLength":7
                   }

You can see from above, that in the C code the field is defined as length of 8 bytes, but the JSON field is defined with max length of 7 bytes.

The result is that my code sets this field to the jobname of the CICS region, for example, CICS1234, but the resulting JSON output for this field is truncated to CICS123.

This same shortening of all character fields by one happens for all such fields.

Answer

The z/OS Connect EE V3 documentation topic Building a service archive file for the CICS service provider describes the "NULL" option for property characterVarying as follows:


Character fields are mapped to a JSON string and are processed as null-terminated strings. z/OS Connect EE adds a terminating null character when transforming from a JSON payload. The maximum length of the character string is calculated as one character less than the length indicated in the language structure. NULL is the default value for the characterVarying property for C and C++. This value does not apply to Enterprise and Other PL/I language structures.


Bill Bulfin
IBM zCEE Support

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGMGV","label":"CICS Transaction Server"},"Platform":[{"code":"PF035","label":"z\/OS"}],"Component":"","Version":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}},{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSNPJM","label":"IBM z\/OS Connect"},"Platform":[{"code":"PF035","label":"z\/OS"}],"Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Product Synonym

CICS/TS CICSTS CICS TS CICS Transaction Server;zCEE

Document Information

Modified date:
14 February 2023

UID

dwa1434192