RPG programmers have gotten used to the idea of being able to define variables anywhere they like in a program. As long as you state the size and type of variable somewhere in the program, it will compile. It doesn't matter if the definition is physically after your first use of the variable. However, this concept could fail you when writing an RPG program with embedded SQL.
I was writing a report program that needed the three main SQL parts: DECLARE CURSOR, OPEN CURSOR, and FETCH. To make the mainline of the program less cluttered, I decided to put each of these three sections in separate subroutines and call them in the proper sequence.
The program would not compile. The error message in the compile listing told me that I could not OPEN a CURSOR without a DECLARE, but there was a DECLARE in the program. After a few minutes of head scratching, I found my problem. I had arranged my three subroutines in no particular order, and I did not realize that?unlike variable definitions?I had to have them in the proper physical order. After I rearranged the physical location of the subroutines in the proper DECLARE, OPEN, FETCH physical order, the program compiled.
When you compile an SQL RPG program, the compile command first runs an SQL precompiler that looks at the SQL part of the program. It appears that this precompiler is not as robust as the regular RPG compiler because it does not look ahead to verify that all the pieces are in the program.
? Kenneth Fordham
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.
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:
LATEST COMMENTS
MC Press Online