SQL programming considerations

 

If your program contains EXEC SQL statements and MQI calls, perform these steps:

  1. Translate the EXEC SQL commands into native language statements. Use the CRTSQLCI command for a C program. Use the CRTSQLCBLI command for a COBOL program.

    Include OPTION(*NOGEN) in the CRTSQLCI or CRTSQLCBLI command. This halts processing to enable you to include the appropriate WebSphere MQ service programs. This command puts the code, by default, into QTEMP/QSQLTEMP.

  2. Compile the source code using the CRTCMOD command (for a C program) or the CRTCBLMOD command (for a COBOL program).

  3. Use CRTPGM to link the compiled code with the appropriate WebSphere MQ service programs. This creates the executable program.

An example of such code follows (it compiles a program, SQLTEST, in library, SQLUSER):

CRTSQLCI  OBJ(MQTEST/SQLTEST) SRCFILE(SQLUSER/QCSRC) +
     SRCMBR(SQLTEST) OUTPUT(*PRINT) OPTION(*NOGEN)
CRTCMOD   MODULE(MQTEST/SQLTEST) +
     SRCFILE(QTEMP/QSQLTEMP) OUTPUT(*PRINT)
CRTPGM   PGM(MQTEST/SQLTEST) +
     BNDSRVPGM(QMQM/LIBMQIC)

 

Parent topic:

Building your application on i5/OS


fg16520_