You can easily call a QA Build program from a C program. Below is an example of a call to a QA Build program from an existing DP4 application written in C, with the changes from the original program shown in bold type.
/* LIBMAKE keywords to create .H include file */
/*
#c
#db MYDB
#mapname CPROG
#end
*/
#include "dp4.h"
#include "cprog.h"
#include "cexits.h"
...
void process()
{
/* C application code */
...
/* calls to QA Build */
Qab_init();
Qaction_program("MYPROG");
}
|
This example assumes that the application database is the same for the C application and the QA Build program, MYPROG. Also in this case there are no calls to DP4 functions in process() after the call to Qaction_program(), but you can include code after the call to Qaction_program() if you like. In this case you should pay attention to the advice in Resuming After Qaction_program().
For an introduction to writing DP4 applications using C see Installing and Using DP4 C Libraries and tools in the C++ Programmers Reference. The following is a summary of the steps needed to convert such a C program to one that calls a QAB program:
Example command lines to build your program are shown for Windows and Unix below:
Windows: cl -DWIN32 -Zp1 -Oxs progname.c -link ntqab.lib ntown.lib -entry:mainCRTStartup
Unix or Linux: $(CC) -o progname $(CFLAGS) progname.c ccqab.a ccown.a
The QA Build program called can perform any action available with QA Build processing, including overlays and C exits.
Unless you call C exits, no extra definitions are required and you do not need to create any C interfaces with PROGCOMP.
If you call C exits, you must modify the source files produced by PROGCOMP to produce a hybrid of the two techniques. You must not try to call a QA Build program from within a C exit.
If your program uses only standard C functions, you can call QA Build by making the following changes to your source code:
Once this is done follow the instructions as given in the previous section.