How to: Example: Reference: OS-Specific DLL Environment Search Variables |
The API requires some specific data structures in your applications, and has a number of numeric constants associated with certain method calls. C language descriptions of these data structures and symbolic definitions of the various constants are included in the eda.h and edasys.h header files. The eda.h file contains the symbolic constant and method prototypes. The edasys.h file is included by eda.h and contains UNIX-specific information. Similarly, edacpy.cpy contains a Cobol version of these definitions.
When you compile an API application written in C, C++, or Cobol, include the eda.h or edacpy.cpy header file in those sources where API method calls are referenced. If you are programming in a language other than C, C++, or Cobol, you must create the language-specific versions of the API data structures based upon the information in eda.h. Sample programs edaapp.c, edaapp.cpp, and edaapp.cbl are provided with the API.
Working samples are provided in various languages. The first step in writing an API application should be to confirm that the desired sample language properly compiles, links, and runs to ensure there is a properly working environment.
Important: Step b is for OS/390 and z/OS only.
cp $EDAHOME/etc/libeda*.*
gencpgm.sh -m api program_name
where:
program_name reflects the name of the file assuming the API program is written using the C language. An executable for the program_name you specify will be created in your current directory plus a DLL helper script that sets logicals for runtime and invokes the actual program.
If your API program was written using C++, issue:
gencpgm.sh -c c++ -m api program_name
To create a debuggable version of your API program, add the -g parameter. For example:
gencpgm.sh -g -m api program_name
Note: Use the command "gencpgm.sh -help" to see a list of additional switch options available when executing gencpgm.com. The gencpgm script is also used for building sub-routines as described in the Stored Procedures manual. The OS/400 environment additionally supports Cobol, RPG, and DDS as languages for the "-c" switch.
To run the sample procedure after the compilation step, enter: edaapp.sh.
Sample application is included with the software and should be used as a test before building your own application to confirm that there is a properly working environment. The applications are called edaapp.c (C example) and edaapp.cbl (Cobol example) and are located in the etc directory of EDAHOME. To compile and execute, copy the application to the EDACONF bin directory and follow the standard directions above. The sample application is very similar to the rdaapp program that is used to verify a server as operational, to test the connection to your server, and to run simple commands. If this step is successful, a customer-written application can be built and tested.
Note: GENCPCM is written for simple cases. Complex linking requirements may mean the site must write custom scripts for the tasks. GENCPGM primary support is for C and is all that can be built with the tool in the UNIX environment. Use of other languages such as Cobol or Fortran on UNIX requires the user to provide the build tool. In writing complex applications, the shell script wrapper may be an ideal method to set up other site specific run-time tasks.
Operating System |
Variable |
AIX |
LIBPATH |
HP-UX |
SHLIB_PATH |
OS/400 |
See "OS/400 Users" below |
All Others |
LD_LIBRARY_PATH |
OS/400 Users:
The gencpgm.sh compiles and creates programs into *CURLIB and creates an IFS symbolic link to the current directory for API programs. CURLIB should be set appropriately if a system or other library is the desired final location. The resulting client shell script for running the application will also do a "liblist -a" for the location so end users do not need to set or know the physical location if using the script.
Note: Testing was done Micro FOCUS Express 2.0.11 on AIX using the standard EDAAPP Cobol example supplied with the product. We have no reason to believe that compilers on other platforms and from other vendors do not work. These other combinations are just untested due to availability and there are no specific plans to test other environments due to the logistics of obtaining, maintaining and testing what could be many combinations. The Cobol example tested is the same example tested on OpenVMS and MVS so there is no question of program quality. If you are attempting to use an untested environment and are having specific problem, the first step are to check the supported general features of the compiler, specifically how the compiler supports the use of external DLL libraries and get the standard EDAAPP example working before attempting a custom application. Customer Support will glad to assist in researching issues and bringing them to the attention of the development staff for resolution if need.
Older versions of Micro Focus Cobol required an customer written interface stub and prefacing of calls with special syntax to link and use external libraries; this is no longer required in recent Micro Focus Cobol releases and programs link much like C. However, this may be indicative of the complexity of using other third party compliers, so BEWARE.
Micro Focus Cobol may have the word "Focus" in it, but is not a product of Information Builders.
cob -V -x myprogram.cbl -L $EDAHOME/bin -l edaapi
The result is an executable without an extension.
You probably also get an error message about use of a non-debuggable library. The message is simple a warning and may be ignored. Using the debuggable version of the EDAAPI library will stop the message.
The gencpgm.sh program on OS/400 supports a -c cobol switch and may be used to build Cobol programs. It assumes the Cobol program in in the current directory with a .cbl or .cob extension or it will check for the source in QCBLLESRC.
Specific information for the UNIX environment is not available due to the number of vendors in the market, though the environments vary and adjust accessibility to the products. However, we have no reason to believe that these compilers on UNIX would not work since compilation on other platforms and using various other vendors does work. It is simply a question of understanding the product requirements and methods for using external DLL libraries. Customer Support will glad to assist in researching issues and bringing them to the attention of the development staff for resolution if needed.
iWay Software |