Creating a CICS service for C or top-down

If you cannot use the z/OS® Connect API toolkit to create your CICS® service because, for example, you have a C program, your source of input is JSON schema, or you do not have access to the z/OS Connect API toolkit, you can manually prepare the required properties file that the build toolkit needs to generate the service archive.

zosConnect-2.0 Applies to zosConnect-2.0.

Note: The use of BAQLS2JS and BAQJS2LS to generate service archives is not supported when using the CICS service provider.

The service archive created by the build toolkit can be deployed by copying it to the services directory.

Service archives can be created from either existing language structures or from JSON schemas. The following tables describe the build toolkit properties, including those which are specific to starting with either language structures or JSON schemas. Define the following properties to build your service archive:
Table 1. Common properties for CICS service provider
Property Importance Description
provider Required Must be set to cics to build a service archive for the CICS service provider.
name Required The name of the service.
version Required The version of the service.
description Optional A description of the service.
connectionRef Required The id of the zosconnect_cicsIpicConnection element that defines the connection to CICS. See Notes 1 and 2.
language Required The language of the CICS program. Valid values are COBOL|C|CPP|PLI-ENTERPRISE|PLI-OTHER.
program Required The CICS program to invoke.
programInterface Required The program interface for the CICS program. Valid values are COMMAREA|CHANNEL. This value must be set to CHANNEL to use context containers. See Table 4.
ccsid Optional Specifies the CCSID that is used at run time to encode character data in COMMAREA and BIT container application data structures. The default is 037 (EBCDIC).
characterVarying Optional Specifies how character fields in the language structure are mapped. A character field in COBOL is a Picture clause of type X, for example PIC(X) 10; a character field in C/C++ is a character array. You can select these options:
NO
Character fields are mapped to a JSON string and are processed as fixed-length fields. The maximum length of the data is equal to the length of the field. This value does not apply to Enterprise and Other PL/I language structures.
NULL
Character fields are mapped to a JSON string and are processed as null-terminated strings. z/OS Connect 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.
COLLAPSE
Character fields are mapped to a JSON string. Trailing white space in the field is not included in the JSON payload. The request JSON payload is parsed to remove all leading, trailing, and embedded white space. COLLAPSE is the default value for the characterVarying property for COBOL and PL/I.
BINARY
Character fields are mapped to a JSON string containing base64 encoded data and are processed as fixed-length fields.
Messages with the DFH prefix might refer to this property as CHAR-VARYING.
dataScreening Optional Specifies whether application supplied data is screened for errors. The default is ENABLED.
ENABLED
Any application-supplied runtime data that is inconsistent with the language structure, is treated as an error and message DFHPI1010 is issued. An error response is returned to the application.
DISABLED
Data values in application-supplied runtime data that are inconsistent with the language structure are replaced by default values. For example, a zero replaces a bad value in a numeric field. Message DFHPI1010 is not issued and a normal response is returned to the application. This feature can be used to avoid INVALID_PACKED_DEC and INVALID_ZONED_DEC error responses that are generated from uninitialized output fields.
Messages with the DFH prefix might refer to this property as DATA-SCREENING.
dataTruncation Optional Specifies if variable length data is tolerated in a fixed-length field structure. The default is DISABLED.
ENABLED
If the data is less than the fixed length that CICS is expecting, z/OS Connect rejects the truncated data and issues an error message.
DISABLED
If the data is less than the fixed length that CICS is expecting, z/OS Connect tolerates the truncated data and processes the missing data as null values.
Messages with the DFH prefix might refer to this property as DATA-TRUNCATION.
languageStructureCodePage Optional Specifies the Java™ character set name for the source language structures specified by requestStructure, responseStructure or referenced from a channel description document. For example, for IBM® Latin-1 EBCDIC, the value is IBM037. When this property is used both the requestStructure and responseStructure must name members in the same partitioned dataset.
structure Optional Specifies the names of the high-level language structures that are contained in the file or partitioned data set members that are specified in the requestStructure and responseStructure, or generatedRequestStructure and generatedResponseStructure properties. This property is valid only for C and C++ languages. The value of this parameter has the format (request,response). For example the value (ReqStruct,RespStruct) would specify a request structure named ReqStruct in the file or PDS specified by requestStructure and a response structure named RespStruct in the file or PDS specified by responseStructure. The default request structure name is DFHREQUEST and the default response structure name is DFHRESPONSE.
transid Optional A CICS transaction name. This property will override the transid set on the connection for this service. Additionally this property can be set on the service element. The usage of this property varies depending on the type of connection to CICS and the transidUsage property. For more information, see zosconnect_cicsIpicConnection and Sub elements. See Note 3.
transidUsage Optional Specifies how the transid property value is used. This property only applies to CICS IPIC connections and will override the transidUsage set on the zosconnect_cicsIpicConnection for this service. Additionally this property can be set on the service element. For more information, see zosconnect_cicsIpicConnection and Sub elements.
EIB_ONLY
The transid property specifies the name of the CICS transaction that appears in the CICS exec interface block (EIB); the EIBTRNID field contains the value of the transid property. The called CICS program runs under the default mirror transaction CSMI.
EIB_AND_MIRROR
The transid property specifies the name of the CICS transaction under which the called CICS program runs. The transaction must be defined in the CICS region, and the transaction definition must specify the mirror program, DFHMIRS. The value specified by the transid property is available to the called CICS program for querying the transaction ID. The value of the transid property also appears in the EIBTRNID field of the CICS EIB.
See Note 3.
useContextContainers Optional Valid values are true or false:
true
Context containers are sent to CICS.
false
Context containers are not sent to CICS.

useContextContainers can only be used when programInterface is set to CHANNEL

For more information, see Context containers.

httpHeaders Optional A comma-separated list of header names to include in the BAQHTTPHEADERS context container if they are present on the HTTP request. For example, httpHeaders=MyHeader,SecondHeader.

httpHeaders can only be used when useContextContainers is set to true.

If you generate the service archive from a language structure, as indicated by the requestStructure property, the following properties are also available.
Table 2. Properties specific to generating a service archive from a language structure
Property Importance Description
requestStructure Required Specifies the relative or absolute path to the file containing the language structure for the request, or the channel description document file describing the request channel. See notes 4, 5, and 7.
responseStructure Required Specifies the relative or absolute path to the file containing the language structure for the response or the channel description document file describing the response channel. See notes 4, 5, and 7.
characterOccurs Optional Specifies how character arrays in the language structure are mapped. For example, PIC X OCCURS 20 . This property is only for use by COBOL language. The default is STRING.
ARRAY
Character arrays are mapped to a JSON array. This means that every character is mapped as an individual JSON value.
STRING
Character arrays are mapped to an JSON string. This means that the entire COBOL array is mapped as a single JSON string.
Messages with the DFH prefix might refer to this property as CHAR-OCCURS.
characterUsage Optional In COBOL, the national data type, PIC N, can be used for UTF-16 or DBCS data. This setting is controlled by the NSYMBOL compiler option. You must set the characterUsage property on the build toolkit to the same value as the NSYMBOL compiler option to ensure that the data is handled appropriately. This is typically set to characterUsage=NATIONAL when you use UTF-16.
DBCS
Data from PIC ( n ) fields is treated as DBCS encoded data.
NATIONAL
Data from PIC ( n ) fields is treated as UTF-16 encoded data.
The default is NATIONAL. Messages with the DFH prefix might refer to this property as CHAR-USAGE.
dateTime Optional Specifies if potential ABSTIME fields in the high-level language structure are mapped as timestamps.
PACKED15
Packed decimal fields of length 15 (8 bytes) are treated as CICS ABSTIME fields, and mapped as timestamps.
UNUSED
Packed decimal fields of length 15 (8 bytes) are not treated as timestamps.
The default is UNUSED.
truncateNullArrays Optional Specifies how structured arrays are processed.
ENABLED
z/OS Connect will attempt to recognize empty records within an array (See truncateNullArrayValues for more information about identifying empty records). If five consecutive empty array records are detected, the array is truncated at the first such record when generating JSON. This truncation capability is only enabled for arrays with structured content, arrays of simple primitive fields are not subject to truncation. Truncation of arrays can result in a more concise representation of the data in JSON, but is not without risk. If five consecutive data records are misidentified as uninitialised storage (perhaps because they legitimately contain low values), data loss can be experienced. If truncateNullArrays is enabled and truncateNullArrayValues is not set, then the default value for truncateNullArrayValues is used.
DISABLED
z/OS Connect will not attempt to truncate arrays.
The default is DISABLED. Messages with the DFH prefix might refer to this property as TRUNCATE-NULL-ARRAYS
truncateNullArrayValues Optional Specifies which values are treated as empty for truncateNullArrays processing. If all of the bytes of storage within a record of a structured array contain nulls then the entire record is considered to be empty. One or more of the NULL, SPACE and ZERO values can be specified in a comma separated list. Any matching combination of the selected bytes within a structured array record will cause the entire record to be identified as empty. If truncateNullArrayValues has a value defined, then truncateNullArrays must be ENABLED.
NULL
The null character (0x00) is treated as empty.
SPACE
An SBCS EBCDIC Space (0x40) is treated as empty.
ZERO
An unsigned zoned decimal zero (0xF0) is treated as empty.
The default is NULL. Messages with the DFH prefix might refer to this property as TRUNCATE-NULL-ARRAY-VALUES.
If you generate the service archive from a JSON schema, as indicated by the requestSchema property, the following properties are also available.
Table 3. Properties specific to generating a service archive from a JSON schema
Property Importance Description
requestSchema Required Specifies the relative or absolute path to the JSON schema for the request. See notes 5 and 6.
responseSchema Required Specifies the relative or absolute path to the JSON schema for the response. See notes 5 and 6.
generatedRequestStructure Required Specifies the relative or absolute path to the file or PDS that contains the high-level language structures for the request that is generated from the JSON schema. See notes 4 and 5.
generatedResponseStructure Required Specifies the relative or absolute path to the file or PDS that contains the high-level language structures for the response that is generated from the JSON schema. See notes 4 and 5.
characterMultiplier Optional

Specifies the number of bytes to allow for each character. The value of this property can be a positive integer in the range of 1 - 2147483647. All nonnumeric character-based mappings, are subject to this multiplier. Binary, numeric, zoned, and packed decimal fields are not subject to this multiplier.

This property can be useful if, for example, you are planning to use DBCS characters where you might opt for a multiplier of 3 to allow space for potential shift-out and shift-in characters around every double-byte character at run time.

When you set ccsid=1200 (indicating UTF-16), the only valid values for characterMultiplier are 2 or 4. When you use UTF-16, the default value is 2. Use characterMultiplier=2 when you expect application data to contain characters that require 1 UTF-16 encoding unit. Use characterMultiplier=4 when you expect application data to contain characters that require 2 UTF-16 encoding units.

Note: Setting characterMultiplier to 1 does not preclude the use of DBCS characters, and setting it to 2 does not preclude the use of UTF-16 surrogate pairs. However, if wide characters are routinely used then some valid values will not fit into the allocated field. If a larger characterMultiplier value is used, it can be possible to store more characters in the allocated field than are valid in the JSON. Care must be taken to conform to the appropriate range restrictions.

The default is 1. Messages with the DFH prefix might refer to this property as CHAR-MULTIPLIER.

characterVaryingLimit Optional Specifies the maximum size of binary data and variable-length character data that is mapped to the language structure. If the character or binary data is larger than the value specified in this property, it is mapped to a container and the container name is used in the generated language structure. The value can range from 0 to the default 32767 bytes.
characterWhitespace Optional Specifies how white space in values of type string is handled by z/OS Connect.
COLLAPSE
Leading, trailing, and embedded white space is removed and all tabs, new lines, and consecutive spaces are replaced with single space characters.
REPLACE
Any tabs or new lines are replaced with the appropriate number of spaces.
PRESERVE
Retains any white space in the data value.
The default value is COLLAPSE.
dateTime Optional Specifies how JSON date-time format properties are mapped to the language structure.
PACKED15
JSON date-time format properties are processed as a time stamp and is mapped to CICS ABSTIME format.
STRING
JSON date-time format properties are processed as text.
The default is PACKED15.
defaultCharacterMaxLength Optional Specifies the default array length of character data in characters for mappings where no length is implied in the JSON schema. The value of this property can be a positive integer in the range of 1 - 2147483647. The default is 255.
inlineMaxOccursLimit Optional

Specifies whether inline variable repeating content is used based on the maxItems JSON schema keyword. Variably repeating content that is mapped inline is placed in the current container with the rest of the generated language structure. The variably repeating content is stored in two parts, as a counter that stores the number of occurrences of the data and as an array that stores each occurrence of the data. The alternative mapping for variably repeating content is container-based mapping, which stores the number of occurrences of the data and the name of the container where the data is placed. Storing the data in a separate container has performance implications that might make inline mapping preferable.

The value of inlineMaxOccursLimit can be a positive integer in the range of 0 - 32767. A value of 0 indicates that inline mapping is not used. A value of 1 ensures that optional elements are mapped inline. If the value of the maxOccurs property is greater than the value of inlineMaxOccursLimit, container-based mapping is used; otherwise inline mapping is used.

When deciding whether you want variably repeating lists to be mapped inline, consider the length of a single item of recurring data. If few instances of long length occur, container-based mapping is preferable; if many instances of short length occur, inline mapping is preferable.

The default is 1.

mappingOverrides Optional Specifies whether the default behavior is overridden when generating language structures. One or more of the options can be specified in a comma-separated list.
SAME-AS-MAPPING-LEVEL
This option generates language structures in the default style.
UNDERSCORES-AS-HYPHENS
For COBOL only. This option converts any underscores in the JSON schema to hyphens, rather than the character X, to improve the readability of the generated COBOL language structures. If any field name clashes occur, the fields are numbered to ensure that they are unique.
INTEGER-AS-PIC9
For COBOL only. This option generates language structures that contain integer values from the JSON schema as numerals rather than alphanumeric characters.
LESS-DUP-NAMES
This option generates non-structural structure field names with _value at the end of the name to enable direct referencing to the field. For example, in the following PL/I language structure, when mappingOverrides=LESS-DUP-NAMES is specified, level 12 field streetName is suffixed with _value:

09 streetName,
12 streetName CHAR(255) VARYING
UNALIGNED,
12 filler BIT (7),
12 attr_nil_streetName_value BIT (1),
The resulting structure is as follows:

09 streetName,
12 streetName_value CHAR(255) VARYING
UNALIGNED,
12 filler BIT (7),
12 attr_nil_streetName_value BIT (1),
The default is UNDERSCORES-AS-HYPHENS for COBOL and SAME-AS-MAPPING-LEVEL for other languages.
nameTruncation Optional Specifies whether JSON names are truncated from the left or the right. The build toolkit truncates JSON names to the appropriate length for the high-level language specified; by default names are truncated from the right.
RIGHT
Names are truncated from the right.
LEFT
Names are truncated from the left.
wideComp3 Optional Controls the maximum size of the packed decimal variable length in the generated COBOL or PL/I language structure.
YES
build toolkit supports the maximum size of 31 when generating the COBOL language structure type COMP-3.
NO
build toolkit limits the packed decimal variable length to 18 when generating the COBOL language structure type COMP-3. If the packed decimal size is greater than 18, message DFHPI9022W is displayed to indicate that the specified type is being restricted to a total of 18 digits.
The default is NO.

Sample properties file for the CICS service provider using a C structure


name=service2
provider=cics
version=1.0
description=An example CICS service for a C structure
program=CICSPGM3
connectionRef=cicsConn
language=C
programInterface=COMMAREA
characterVarying=NO
structure=(CommAreaDetail,CommAreaDetail)
requestStructure=/u/myhome/REQUEST
responseStructure=/u/myhome/RESPONSE

Sample properties file for the CICS service provider using JSON


provider=cics
name=service3
version=1.0
description=An example CICS service
program=CICSPROG
language=COBOL
programInterface=CHANNEL
requestSchema=request.json
responseSchema=response.json
generatedRequestStructure=request.cpy
generatedResponseStructure=response.cpy
connectionRef=cicsConn
Note:
  1. CICS services can only be deployed by adding them to the services directory. CICS .sar files reference a zosconnect_cicsIpicConnection element in the server.xml configuration file.
  2. The service is initialized separately from the zosconnect_cicsIpicConnection element, so the service might show as available but without a connection. If the connection is not available to the CICS service either because it is not configured or there is a configuration error, the following message is logged when the service is invoked:
    BAQR0655E: Service {0} in service archive file {1} references the CICS 
    connection {2} which is either not defined or defined incorrectly.
  3. Specifying the transid or transidUsage properties when creating a service archive will override the equivalent attributes on the connection the service uses. The properties transid and transidUsage can additionally be defined on a service element under the zosconnect_services element of the server.xml configuration file to set different transactions in different environments with a single service archive. For more information, see Sub elements.
  4. If you run the build toolkit on z/OS to generate a service archive for a CICS COMMAREA program, the values requestStructure and responseStructure can be a UNIX System Services file or a member of a partitioned dataset. To specify a member of a partitioned dataset use the syntax //'partitionDatasetName(member)'. If you run the build toolkit on z/OS to generate a service archive for a CICS channel program, these values must specify a channel description document. The location attribute of the structure element in the channel description document can also support a UNIX System Services file or a member of a partitioned dataset. See the languageStructureCodePage property to indicate the code page of the z/OS partitioned dataset member
  5. If you do not specify an absolute path for the referenced file, the build toolkit uses a relative path from the directory in which the zconbt command is run.
  6. All JSON schema files must use UTF-8 encoding.
  7. Language structure files must use the default code page for the system where the build toolkit is run.

You can now use the build toolkit to create the service archive. For more information, see Generating service archives for DevOps.