API Extensibility Sample Files
To help you get started with the API extensibility feature, the following sample files are
provided in the AD installation package:
- COBOL program files
- The sample COBOL programs that contain API calls. You can find the program files in the
Cobol folder.
- SQLCALL1.cbl
- The main COBOL program. The SQLCALL1 program calls the SQLGET program to perform calls based on program IDs 1, 2, 3, and 4.
- SQLGET.cbl
- The API program that performs a call to retrieve the program name of a specific program according to the program ID. The information that the SQLGET program needs to determine the called program is stored in a database table.
- Java™ utility files
- The sample Java utilities that are used to resolve the API
call in sample programs SQLCALL1 and SQLGET. You can find
the utility files in the \Java User Exit\src\com\ibm\ez\resolver\utility folder.
- ResolveCallUtility.java
- The Java utility that is used as a user exit to resolve
the API call. This utility performs the following actions:
- Parsing the input JSON file that is automatically generated at run time. For the schema of the input JSON file, see the \Input and Output JSON Schema\utility-input-schema.json file.
- Using the SqlDataAccess utility to retrieve data.
- Generating the output JSON file that contain the resolution of the API call. For the schema of the output JSON file, see the \Input and Output JSON Schema\utility-output-schema.json file.
- Storing the input and output JSON files.
- SqlDataAccess.java
- The Java utility that is used to retrieve data from an SQL
server according to the program ID. A database that is named DynamicCallPgms
and a table that is named ProgramToCall are used. The following image shows the
values in the ProgramToCall table:
- JAR files
- The sample JAR files that are used to resolve the API call in sample programs SQLCALL1 and SQLGET: sqljdbc42.jar and json-simple-1.1.1.jar.
- Build.bat
- The sample file that can be used to compile sample Java utilities ResolveCallUtility and SqlDataAccess. You can find the file in the Java User Exit folder.
- API extensibility configuration files
- The sample JSON files that are used to configure the API extensibility settings. Two types of
the configuration files are required to enable the API extensibility feature: API Config and User
Exits Config. You can find the configuration files in the AD Extensibility
JSONs folder.
- Api_Config.json
- The sample API Config configuration file that specifies the API program name, which is
SQLGET, and the following two parameters that are required:
- programKey
- The value that is passed to the SQLGET program at run time through the PGM-TOCALL-ID variable to resolve the called program.
- data
- The value that is passed to the SQLGET program at run time through the PGM-DATA variable to resolve the called program.
- ue-config.json
- The User Exits Config configuration file that specifies the following user-exit-related
settings:
- The ResolveCallUtility Java utility, which is used as a user exit to resolve the API call.
- The class path of the sqljdbc42.jar and json-simple-1.1.1.jar JAR files.
- The
###
notation that is replaced with a dynamically generated input JSON file name for each call at run time. - The path to store the automatically generated input JSON files. The input files are parsed and stored by the ResolveCallUtility utility. This setting is optional and for debug purposes.
- The path to store the output JSON files that are generated by the ResolveCallUtility utility.
- Input JSON files
- The sample input files that are automatically generated at run time, and parsed by the sample Java utility ResolveCallUtility to retrieve the program IDs. You can find the input files in the Input and Output JSON samples folder.
- Output JSON files
- The sample output files that are generated by the sample Java utility ResolveCallUtility to specify the called program names. You can find the output files in the Input and Output JSON samples folder.
- Schema JSON files
- The files that describe the schemas of the sample input and output JSON files. You can find the schema files in the Input and Output JSON Schema folder.