80 Modernizing IBM Eserver iSeries Application Data Acess - A Roadmap Cornerstone
7.3 Compile command CRTSQLRPGI
If you want to generate RPG programs or modules, you have to use different compile
commands. CRTRPGMOD creates a module object, while CRTBNDRPG creates a program
object. To compile SQL program objects, there is only one single command, CRTSQLxxxI
(where xxx specifies the programming language.)
The object type that is created can be determined by the compile option OBJTYPE.
򐂰 Object type *MODULE generates a module object.
򐂰 Object type *PGM generates a program object.
򐂰 Object type *SRVPGM generates a service program object.
7.3.1 Missing compile options in the SQL compile command
There are some compile options that are important for RPG compilation, but not supported by
the SQL command CRTSQLRPGI:
򐂰 Activation group.
The CRTSQLRPGI command does not contain an option to determine the activation
group.
Programs are always compiled with the default activation group.
Service programs are always compiled with activation group *CALLER.
If you want to use different activation groups, especially for programs, you either have to
use the keyword ACTGRP in the Control Specifications or you have to create the module
with CRTSQLRPGI and then bind it with CRTPGM or CRTSRVPGM.
򐂰 Binding directories.
The CRTSQLRPGI command does not contain an option to specify binding directories, so
it is not possible to bind several modules or service programs to the program object.
If you have to bind several modules, you either have to use the keyword BNDDIR in the
control specifications or execute a two-step process by using CRTSQLRPGI to create the
module first and then bind it with CRTPGM or CRTSRVPGM.
򐂰 Allow NULL values.
The CRTSQLRPGI command does not contain an option to allow NULL values.
If you use both embedded SQL and native I/O to access data, and the tables contain
NULL values, you have to specify the keyword ALWNULL in the control specification.
Example 7-2 shows the control specification to implement compiler options in the control
specifications (H-Specs).
Example 7-2 Control specifications for compiler options
H ActGrp('MYACTGRP')
H BndDir('QC2LE': 'QUSAPIBD': 'MYBNDDIR')
H AlwNull(*UsrCtl)
Note: There is only one single command to generate programs, service programs, and
modules with embedded SQL in RPG.
The object type can be specified by option OBJTYPE (Compile type).

Get Modernizing IBM eServer iSeries Application Data Access - A Roadmap Cornerstone now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.