Start of change

Syntax, linkage, and programming considerations

The z/OS Cloud Data Access services are available to many programs running in various address spaces. Many z/OS execution environments are supported, as well as various programming languages.

Programming interface files provided by the Cloud Data Access (CDA) services

Program language Programming interface file

Table 1 lists the programming interface files provided by the z/OS® Cloud Data Access parser.
Table 1. CDA parser programming interface
Programming language Programming interface file
C / C++ Include file GDKIC provided in SYS1.SIEAHDRV.H.
Assembler Include file GDKKASM provided in SYS1.MACLIB.
COBOL Include file GDKICOB provided in SYS1.MACLIB.

Calling formats

Table 2 lists specific calling formats for languages that can invoke the z/OS Cloud Data Access (CDA) parser callable services.
Table 2. Calling formats for the z/OS Cloud Data Access parser callable services
Programming language Calling format
C / C++ gdkapi_service_name (return_code,parm1,parm2,…) where the gdkapi_service_name is all lower case
Assembler GDKapiservice_name (return_code,parm1,parm2,…)

Linkage considerations

There are two ways for a compiled application to find the z/OS Cloud Data Access callable services:
Linkage stub method
(Recommended) Use the linkable stub routine GDKCSS from SYS1.CSSLIB to bind your object code. GDKCSS assumes a Language Environment already exists. If you want CDA to create and tear down a Language Environment for you, use GDKCSSNL to bind with your object code. If you attempt to use the z/OS Cloud Data Access services on a previous release of z/OS that does not support the z/OS Cloud Data Access Services, this method results in the service call receiving a return code of X'F02' (GDKK_UNSUPPORTED_RELEASE).
Start of changeDynamic Link Library End of change
Start of change(Recommended for AMODE31 C language callers) Use the GDKDLL31 side file found in SYS1.SIEASID when binding your object code. GDKDLL31 assumes that you are already in a Language Environment in AMODE 31, and the calling language is XLC. At runtime, the GDKDLL31 dynamic load library found in SYS1.SIEALNKE will be found and used by the appropriate API. When Binding your C code into a program, ensure that DYNAM=DLL is specified as a IEWL parameter.End of change
Start of changeRecommended for AMODE64 C language callers) Use the GDKDLL64 side file found in SYS1.SIEASID when binding your object code. GDKDLL64 assumes that you are already in a Language Environment in AMODE 64, and the calling language is XLC. At runtime, the GDKDLL64 dynamic load library found in SYS1.SIEALNKE will be found and used by the appropriate API. When Binding your C code into a program, ensure that DYNAM=DLL and AMODE=64 is specified as a IEWL parameter.End of change
Direct linkage method
Code the linkage to the z/OS DFSMSdfp Cloud Data Access services directly. This can be done if the program first confirms that the level of z/OS contains the CDA APIs.
The macros that define those names are:
  • SYS1.MACLIB(CVT)
  • SYS1.MACLIB(IHADFA)

The following example shows the assembler linkage:


L        R05,CVTPTR         
L        R10,CVTDFA(,R05)   
L        R12,DFADFVAD(,R10) 
L        R05,240(,R12) 
L        @15,8+4*GDK_serv_xxxxx(,R05)
BASR     @14,@15
In the example, xxxxx represents the last five letters of the service you want to call. This requires that the GDKKASM assembler macro be included. If you attempt to call the Cloud Data Access APIs on a previous release of z/OS that does not support the APIs, this method may result in the application receiving an abend X'019'.
If using the Direct Linkage method, some APIs require an existing Language Environment. To facilitate better performance when using the I/O APIs via the Direct Linkage method, it is assumed that a Language Environment exists. It is also assumed that one will not be created or destroyed upon entry or exit to the API. A Language Environment preinitialization environment can be used (PIPI) for this requirement.
Start of changeAPI Entry Offset from DFVCDAVTEnd of change Start of changeAPI NameEnd of change Start of changeLanguage Environment RequirementEnd of change
Start of change12 (C)End of change Start of changeGDKDELEnd of change Start of changeYESEnd of change
Start of change16 (10)End of change Start of changeGDKGETEnd of change Start of changeYESEnd of change
Start of change20 (14)End of change Start of changeGDKGETPEnd of change Start of changeYESEnd of change
Start of change24 (18)End of change Start of changeGDKLISTEnd of change Start of changeYESEnd of change
Start of change28 (1C)End of change Start of changeGDKWRITEEnd of change Start of changeYESEnd of change
Start of change32 (20)End of change Start of changeGDKKEYADEnd of change Start of changeNOEnd of change
Start of change36 (24)End of change Start of changeGDKKEYDLEnd of change Start of changeNOEnd of change
Start of change40 (28)End of change Start of changeGDKKEYGREnd of change Start of changeNOEnd of change
Start of change44 (2C)End of change Start of changeGDKKEYSREnd of change Start of changeNOEnd of change
Start of change48 (30)End of change Start of changeGDKMSGTREnd of change Start of changeNOEnd of change
Start of change52 (34)End of change Start of changeGDKGENEnd of change Start of changeYESEnd of change
Start of change56 (38)End of change Start of changeGDKGENNEnd of change Start of changeNOEnd of change
Start of change60 (3C)End of change Start of changeGDKINITEnd of change Start of changeYESEnd of change
Start of change64 (40)End of change Start of change*End of change Start of change*End of change
Start of change68 (44)End of change Start of changeGDKTERMEnd of change Start of changeYESEnd of change
Start of change72 (48)End of change Start of change*End of change Start of change*End of change
Start of change76 (4C)End of change Start of changeGDKVALDEnd of change Start of changeYESEnd of change
Start of change80 (50)End of change Start of changeGDKVALDNEnd of change Start of changeNOEnd of change
Start of change84 (54)End of change Start of changeGDKQUERYEnd of change Start of changeYESEnd of change
Start of change88 (58)End of change Start of changeGDKQRYNEnd of change Start of changeNOEnd of change
Start of change92 (5C)End of change Start of changeGDKMSGTLEnd of change Start of changeYESEnd of change
Start of changeStart of change96 (60)End of changeEnd of change Start of changeStart of changeGDKLISTLEnd of changeEnd of change Start of changeStart of changeYESEnd of changeEnd of change
Start of changeStart of change100 (64)End of changeEnd of change Start of changeStart of changeGDKKYSRLEnd of changeEnd of change Start of changeStart of changeYESEnd of changeEnd of change

Linkage considerations for high-level language programming

Callers must ensure that the proper linkage is made to the Cloud Data Access (CDA) Application Programming Interface (API) services. The supplied IDF files for the various high-level languages contain the necessary definitions that ensure that the parameter list passed to the CDA API has the high-order bit turned on for the last parameter. For example, for C, the linkage must be specified as OS linkage, such as:
#pragma linkage(HWTHxxxx_CALLTYPE,OS)

The GDKIC C header file includes this pragma.

Linkage considerations for assembler language programming

Callers must also use the following linkage conventions:

  • Register 1 must contain the address of a parameter list that is a list of consecutive words, each containing the address of a parameter to be passed. The last word in this list must have a 1 in the high-order (sign) bit.
  • Register 13 must contain the address of an 18-word save area.
  • Register 14 must contain the return address.
  • Register 15 must contain the entry point address of the service being called.
  • If the caller is running in AR ASC mode, access registers 1, 13, 14, and 15 must all be set to zero.
  • On return from the service, general and access registers 2 - 14 are restored (registers 0, 1 and 15 are not restored).

Compilation consideration

The DFSMSdfp CDA product provides one or more sample programs in most of the supported languages to aid in the creation of applications that use the APIs. Refer to the sample JCL jobs in the prolog section of the sample of your language choice for the recommended compiler and linking options. The DFSMSdfp CDA API programming sample programs can be found in SYS1.SAMPLIB with the 3 character ID of GDK. For example, GDKIC1 is a sample C program.

Code page consideration

All input data into the Cloud Data Access services, except for body data, is assumed to be in EBCDIC encoding (code page 1047) before making any Cloud Data Access service call. The z/OS Client Web Enablement Toolkit converts any required data to meet any RFC code page standards when sending or receiving HTTP header data. Data specified in the requested body or received in the response body is treated as-is unless the application requests conversion of the data. Optional parameters on the GDKGET or GDKWRITE APIs allow for override of the default local code page, IBM-1047, and remote code page ISO8859-1.

Environmental considerations

The following environmental considerations apply:
OMVS segment
(Required) The CDA APIs use z/OS Web Enablement Toolkit services, which use TCP/IP sockets and Cryptographic Services System SSL services. Because these services require a z/OS UNIX (POSIX) environment, the CDA APIs run with a Language Environment POSIX(ON) environment. A POSIX(ON) environment requires the user ID associated with the address space using the CDA API services to have an OMVS segment defined and associated with it. See the appropriate security product documentation, as applicable to your installation, for instructions on how to define an OMVS segment to a user.
z/OS UNIX limit of processes with a POSIX(ON) environment and its effect on concurrent connections:
z/OS UNIX limits the number of concurrent POSIX(ON) environments that can be defined to a single address space. Since each CDA API call attempts to initialize a new POSIX(ON) environment (because of the environmental requirements listed earlier), each connection gets implicitly dubbed by Language Environment. (Dub means to make a z/OS address space known to z/OS UNIX System Services. Once dubbed, an address space is considered to be a process.) If multiple connections are wanted from the same application (address space), a consideration of the dubbing configuration for the address space in which the CDA API service is running may be necessary.

The dubbing behavior that z/OS UNIX takes is customizable by using the z/OS UNIX set dub default service (BPX1SDD or BPX4SDD). If the dub default for the address space is set to DUBPROCESS, this allows concurrent subtasks to each have their own POSIX(ON) environment, which allows multiple connections from within the same address space, provided that each subtask has at most one connection.

z/OS Language Environment Heap runtime option considerations:
The CDA API service obeys the current Language Environment Runtime HEAP option for storage management. Applications can customize the HEAP storage option for their execution environment as needed. IBM does not recommend using a primary heap size that is smaller than 32K.
z/OS Language Environment Runtime Environment REUSE (RTEREUS) option consideration:
COBOL applications running in Information Management System (IMS) should not use the RTEREUS(ON) runtime option. For more information, see RTEREUS (COBOL only) in z/OS Language Environment Customization.

Security considerations

There are several aspects of security to consider at both the connection level and the request level. Connection security: Considerations for connection security include:
TCP/IP stack and security product control
A CDA API application connecting to a server is limited by security profiles and definitions that are already in effect on the system where the application resides. Powerful controls, such as z/OS Communications Server NetAccess, in conjunction with security profiles defined using the SERVAUTH class, can be used to control network access authority, TCP/IP stack access authority, port access authority, and more. These security definitions can be configured to be as granular as required by an installation. For more information, see z/OS Communications Server: IP Configuration Guide and z/OS Communications Server: IP Configuration Reference.

Large data body considerations

Under some circumstances, applications require a large data body to be sent on a single request or received on a corresponding response. In these cases, you can supply a streaming send exit that conforms to the requirements for the z/OS Client Web Enablement Toolkit streaming exit, which can be used to provide the request body as an ordered sequence of contiguous pieces of data whose number, size, and location are completely at the discretion of the exit. Similarly and independently, applications that expect a very large response body can supply a streaming receive exit to accept the response body as an ordered sequence of contiguous pieces of data of unpredictable number and size.

Problem determination considerations

Problem determination in an application can be challenging. Here are a few debugging options that can aid in the debugging of your application.

In the config.json file, stored in the ~/gdk/ directory, two options are available:
log-level
Can be used to indicate the logging level during CDA API processing. CDA API logging is written to stderr. When executing in a JCL environment, stderr is defined by the C MSGFILE environment variable. The default is a DD named SYSOUT. For more information, see Config file.
web-toolkit-logging
Requests logging from the z/OS Client Web Enablement Toolkit. Output is written to stdout. Specify true to request logging. The special key, unredacted may be specified to request unredacted output in the log.

A Diagnostic area may be passed to the CDA API via pointer in the list of Optional Parms. This diagnostic area (diagArea) is passed to the z/OS Client Web Enablement Toolkit, where they may place a return code and text for errors encountered during their processing. For more information, see z/OS client web enablement toolkit.

Recovery considerations

The Cloud Data Access Services runs in the address space of the application. In addition, all the storage needed by the CDA API is obtained in the application's address space. Because every application has its own programming environment, it is impossible for the CDA API to predict the recovery environment required by the application.

When the CDA API attempts to access application-provided parameters and those parameters are either inaccessible, point to an inaccessible location, or specify a length that goes beyond the available storage obtained by the application, an abend occurs.
Note: Language Environment callers can see a Language Environment-specific abend code other than 0C4. Under certain circumstances, the Language Environment message, CEE3501S The module xxxxxxxx was not found, can appear in standard output, where xxxxxxxx is the application program's Language Environment condition handler. The calling Language Environment program still receives control with the failing API return code and diagArea information.
End of change