We have a PC network with an AS/400 on it. Our PC users have some files, which we created with SQL statements, in a library on the AS/400. Some of the columns are defined as data type TIMESTAMP, and some are defined as NULL capable.
The PC users access and maintain these tables with PC programs written in a client/server language. I also have some AS/400 programs?RPG programs that contain embedded SQL statements (source type SQLRPG)?that access and maintain these tables.
I ran into a problem on the AS/400, because the Create SQL RPG (CRTSQLRPG) command used to create SQLRPG-type programs does not have the parameters for conversion options (CVTOPT) and does not allow null values (ALWNULL). Fortunately, I found a workaround.
Start by creating the SQLRPG program interactively with the CRTSQLRPG command. Besides creating a program object, the CRTSQLRPG command places a temporary source member into file QSQLTEMP in library QTEMP. This temporary source member contains the embedded SQL statements translated into standard RPG operations. The source member can be compiled with the Create RPG Program (CRTRPGPGM) command, just like any other RPG source member, and herein lies the solution to the problem.
Compile the temporary source member with the CRTRPGPGM command. Compile to the same library you used in the CRTSQLRPG command and specify the parameters CVTOPT(*DATETIME) and ALWNULL(*YES). The resulting program object will replace the program object that was created when you ran the CRTSQLRPG command.
? Brian Spiece
LATEST COMMENTS
MC Press Online