![]() ![]() However, the Database Embedded SQL Programming manual also briefly mentions the SQL INCLUDE statement. We're taking our chances and going to stick with /COPY and RPGPPOPT = *LVL1. Resource limit? We're on an IBM i! Not Windows. If this happens you must either break up your source into smaller pieces, or not use the RPG preprocessor." "When *LVL1 or *LVL2 is used, there is a possibility that the expanded source generated by the RPG preprocessor will become very large and reach a resource limit due to the expansion of the /COPY and /INCLUDE statements. The Database Embedded SQL Programming manual includes an ominous warning about using *LVL1 and *LVL2 values with RPGPPOPT: There is also an /INCLUDE directive available, but it only works when RPGPPOPT = *LVL2. Providing *LVL1 or *LVL2 as the value for CRTSQLRPGI's RPGPPOPT parameter (as shown below in Figure 3), fixed the problem. Scouring the Database Embedded SQL Programming manual provided a clue (the text in the manual is somewhat ambiguous) regarding CRTSQLRPGI's RPGPPOPT parameter. ![]() The fix to this issue was simple, but moderately elusive. When a member included with /COPY defines a host structure it must be available to the SQL precompiler, and this apparently was not happening. Using CRTSQLRPGI to compile the RPG program that contained the snippet shown in Figure 1b produced an SQL SQL5011 error ("Host structure array CustomerList was not defined or not usable"). Puts the fetched result set into the CustomerList host structure. In Figure 1b, the SQL statement: FETCH C_DOC1 FOR 12 ROWS INTO :CustomerList The CustomerList data structure array defines an SQL host structure (a replaceable SQL token). Embedded SQL in RPG putting a result set into the host structure named CustomerList. COPY INCLUDES,CUSTLISTDSįETCH C_DOC1 FOR 12 ROWS INTO :CustomerList įigure 1b. A data structure area definition named CUSTLISTDS and stored in the INCLUDES source physical file. Consider the following two ILE RPG snippets: Dcl-DS CustomerList Dim(50) Qualified įigure 1a. We learned a lesson the other day about using /COPY included files with embedded SQL. We need to keep these applications simple so we usually use /COPY instead of other ILE RPG partitioning schemes. ![]() However, we generally hand these finished applications off to customer RPG teams with little or no advanced ILE RPG knowledge. In a pure world, these applications would be architected with ILE RPG's service programs (and binding directories and other ILE composite goodies). The combination of a moderately rational RPG and SQL database access make a great duo for creating effective, performant server-side components. We've become big fans of the TR7-introduced full free-format RPG and embedded SQL. We often create ILE RPG applications for our customers to provide the server-side logic and database access for IBM i mobile applications-which we use with ASNA Mobile RPG. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |