How to: Example: |
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 OpenVMS-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.
@gencpgm -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 DCL command procedure helper script that sets logicals for runtime and invokes the actual program.
If your API program was written using Cobol, issue:
@gencpgm -c cobol -m api program_name
If your API program was written using C++, issue:
@gencpgm -c c++ -m api program_name
If your API program was written using Fortran, issue:
@gencpgm -c for -m api program_name
To create a debuggable version of your API program, add the -g parameter. For example:
@gencpgm -g -m api program_name
Note: Use the command "@gencpgm -help" to see a list of additional language and switch options that are available when executing gencpgm.com. The gencpgm script is also used for building sub-routines as described in the Stored Procedures manual.
To run the sample procedure after the compilation step, enter: @EDAAPP.
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), edaapp.cpp (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, but also supports Cobol, Pascal, Basic, and Fortran on OpenVMS. In writing complex applications, a DCL wrapper may be an ideal method to set up other site specific run-time tasks.
iWay Software |