Extending ZOAU to other languages
IBM® Z Open Automation Utilities provides a shared library interface that can be used for creating libraries in other languages, such as Node.js. The shared library interface is written in C as a 64-bit DLL that can function in both ASCII and EBCDIC modes.
The following files are included in the shared library.
File name | Usage | In which directory |
---|---|---|
zoautil.h |
C header file that provides the prototypes for the functions in the DLL | include |
vector.h |
C header file that defines the vector of function pointers for all functions available to be called | include |
zoautil.x |
Definition sidedeck | lib |
zoautil.so |
DLL, which is similar to a shared library | lib |
Calling a function in the vector
All functions in version 0x020000 have the same interface:
typedef int ZOAUtil_Fn3(const char* parms, size_t lparms, zoau_response ** response);
Not all languages guarantee NULL terminated strings, so the interface requires that you provide a string and string length for each parameter. This ensures that languages that do not naturally provide NULL terminated strings do not have to make copies of parameters to call the shared library services.
Arguments
Arguments | Description |
---|---|
parms and lparms | The parameters to pass to the utility being called |
zoau_response | The address of a pointer to a structure containing invocation results. See the zoautil.h file for structure format. |
Return code
The return code is always an integer. The value of the return code is consistent with the corresponding shell utility.
Example
The following example calls mvscmd
to run the ISRSUPC program, reading input from stdin, writing output to /tmp/out
, and writing errors to stderr.
unsigned int vrm = version();
vector = init(vrm);
zoau_response * response;
parms = "--pgm=isrsupc --args='DELTAL,LINECMP' --newdd='tst.in(new)' --olddd='tst.in(old)' --sysin=stdin --outdd=*";
rc = vector->mvscmd(parms, strlen(parms), &response);
if (!rc && response->stdout_response[0] != '\0' ) {
printf("%s\n", response->stdout_response);
}
free_response(response);
termrc = term(vector);
Possible interface change
To provide future performance enhancements to ZOAU, portions of the shared library will be changed in an upcoming release. This change will not impact the current shell or Python interfaces, but will introduce changes to the shared library interface used for creating libraries in other languages.