The Interface Mapper user interface for COBOL Program service interfaces is split into two parts. The left side shows COBOL LINKAGE section fields, and the right shows interface fields, reusable fields, and COBOL assignments.
The most straightforward way to create an interface field from a COBOL field is by dragging a COBOL field from the Linkage Section pane and dropping it onto the Interface Fields pane. This creates a mapping between the COBOL field and the new interface field. From the Interface Fields pane, you can further define the details for that field as it is used by the service interface.
The Type of interface field created is derived from the name of the reusable field. For example, if you create a reusable field named MyReusableField and then drag and drop it into the Interface Fields pane pane, the value in the Type column for that field is MyResuableField.
Interface Fields have three location options: Body, Path, or Query. Body means that the interface field corresponds to the body of the JSON message. Path and Query are for fields which correspond to the request URI used to invoke the operation. For Path fields, you specify the corresponding part of the URI by going to Operation > Properties and selecting the Path/HTTP tab. Query interface fields correspond to the query string at the end of a request URI. A Path or Query interface field must have a primitive data type, though it may have a nonzero Occurs value (which would be expressed in the actual URI as a comma-separated array). Note that a Path or Query interface field need not have a mapping if it is intended to only be used for output filtering, as described below.
At run time, the output response body is filtered by any path- and query-parameter values received in the URI whose parameter names match the name of an output field in the response body. For example, if an operation is defined with a path of /cars/{make} and an output body array of "car" items, and the run-time request URI is .../cars/ford?color=red&doors=4 (where "make", "color" and "doors" are all names of fields defined within "car"), then the response body array would exclude any instances of "car" whose "make", "color", and "doors" values don't match the URI-specified values. If there are two or more body fields with the same name, those fields can be differentiated in the query string by specifying one or more parent fields of the desired field separated with periods (e.g. car.color=red). Partial or incomplete values for filtering can be indicated by using an asterisk character (*) at the beginning and/or end of the value (e.g. color=red* would match both "red" and "reddish"). Case-sensitive filtering can be performed by wrapping the value in single quotes (e.g. color='Red'). Note that if you do not want a Path or Query interface field to act as a filter on the output message, ensure that its name does not match the name of any output Body interface field. Additionally, there are four special built-in query parameters that can provide further control over the contents of the response:
<group1> <field1>someValue1</field1> <field2>someValue2</field2> </ group1> < group1> <field1>someValue3</field1> <field2>someValue4</field2> </ group1>
JSON is different in that it provides explicit array syntax such that an array item is not a repeated item but rather a single item that contains repeated values. So, the same interface-field group array from above would look like the following in a JSON message. Note how "group1" is not repeated but rather appears only once and contains the individual array-element values, which appear as repeated {}-enclosed JSON objects.
"group1": [ { "field1":"someValue1", "field2":"someValue2" }, { "field1":"someValue3", "field2":"someValue4" } ]
For "group1" to be included in each repeated array element value in the JSON message (so that it would look more like the SOAP message), an extra interface-field group would be needed as a parent of the "group1" field in the Interface Mapper, and the nonzero occurs put on that extra parent field instead of on "group1". The resulting JSON message would then be as follows:
"extraGroup": [ { "group1": { "field1":"someValue1", "field2":"someValue2" } }, { "group1": { "field1":"someValue3", "field2":"someValue4" } } ]
For all service interfaces in general, a nonzero occurs property indicates that an interface field is an array. However, for JSON service interfaces in particular, when an interface field has specifically occurs 1, it will appear in the JSON message as a single object or primitive, without the JSON array syntax.