TechTalk: SQLRPG Gotcha Workaround

SQL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: