Handling Variable Arrays in WSDL and JSON - Native COBOL

When a WSDL file or JSON schema has variable-sized (commonly unbounded) arrays, the size of the interface structures in the generated service or client might be large and could exceed allowable compiler limits, especially when such arrays are nested. The solution is to configure array handling to dynamically allocate these variable-sized arrays at run time. When a variable array has been specified for dynamic allocation, the generated main or enclosing interface structure does not contain the variable array, but instead uses a COBOL pointer to point to a separate area in memory where the array is located. A numeric field located immediately before the COBOL pointer indicates the size of the array. The Inline-Array-Size-Limit field on the Generate Web Service dialog box enables you to specify a numerical value, from 0 (zero) to 32767 inclusive, that specifies the minimum size at which a variable array is generated as a separate structure for dynamic allocation. For example, if your generated service or client program with copybooks become impractically large or uncompilable when generated with the default Inline-Array-Size-Limit of 0, meaning no arrays are dynamically allocated, then try generating with Inline-Array-Size-Limit set to 1 or 2. See the Generate Web Service dialog box for additional details.

Note: The imtkmake command's inlineoccurslimit parameter is the command-line equivalent of the Inline-Array-Size-Limit field on the Generate Web Service dialog box. See the imtkmake command topic for details.

Examples

WSDL and JSON Schema contents
Variable array in WSDL:
<element name="in_0_5" minOccurs="1" maxOccurs="5">
   <simpleType>
      <restriction base="string">
         <length value="8"/>
      </restriction>
   </simpleType>
</element>
Variable array in a JSON schema:
{
   "in_0_5":
   {
      "type": "array",
      "maxItems": 5,
      "minItems": 1,
      "items":
      {
         "type": "string",
         "maxLength": 8
      }
   }
}
Generated data structures
Default generation:
All array structures are generated into the main structure.
05 in-0-5-occurs   pic 9(9) comp-5.
05 in-0-5          pic x(8) occurs 5.
Dynamic allocation generation:
Structures for the array size and a pointer to the array in memory are generated into the main structure:
05 in-0-5-occurs   pic 9(9) comp-5.
05 in-0-5-cont0001 pointer.

The array is generated into a separate group structure:

01 cont0001-in-0-5.
  03 in-0-5        pic x(8) occurs 1 count in in-0-5-occurs.