Books by Bryan Meyers

Programming in RPG IV

Control Language Programming for IBM i

RPG IV Jump Start

Power Tips for RPG IV

VisualAge for RPG by Example

 
Frequently Asked Questions


Prototyping Data Structures Print E-mail

Q. I've heard you say that I can pass a data structure as a parameter, or accept it as a return value. How do I do this?

Read more ... Prototyping Data Structures
 
%LOOKUP Function with ASCEND Print E-mail

Q: I recently ran into a problem with the %LOOKUP function (both in free and in fixed format). A converted program (which had originally used the LOOKUP operation) was using %LOOKUP on an array that was set up as ASCENDING. When the lookup occurred, no element was found. When I removed the ASCENDING keyword, the lookup word fine. Any ideas?

Read more ... %LOOKUP Function with ASCEND
 
Receiver Too Small to Hold Result Print E-mail

Q. I have programs that sometimes force a field defined larger than the result field. Of course I get the RNQ0103 message ("Target for a numeric operation is too small to hold result"). Is there a work-around or am I forced to end-free and do this operation and return to free?

Read more ... Receiver Too Small to Hold Result
 
V5R3 Activation Group Question Print E-mail

Q: V5R3 includes a change to the CRTPGM command; for the activation group if the *Entry module is an ILE module, the activation defaults to QILE.

We just had a very significant situation occur with an OPNQRYF in a CLLE program. The RPG program that was called to process the file in the OPNQRYF used to be an ILE program, *CALLER. However, it was not recompiled that way, and essentially ignored the selections made in the OPNQRYF and processed the whole file! This program needs to remain ACTGRP(*CALLER).

Am I correct that if this program were recompiled in activation group QILE, it would still not see the OPNQRYF selections and would still process the whole file?

Read more ... V5R3 Activation Group Question
 
Using %BITAND to Test Bits Print E-mail

Q. I have an interface program that has several single position character fields. Each field had has eight sub fields (each bit has a different meaning). In my old thinking I would have used TESTB and tested each bit assigning a different indicator per bit:

Read more ... Using %BITAND to Test Bits
 
Numeric target too small when using %DEC Print E-mail

Q. I guess I've misinterpreted how %DEC is supposed to work. In the following example, the value in Char4 is 0250, so I was anticipating the same result as a Move operation -- with my numeric result as 4 long, 3 decimal positions. But I get the error "The target for a numeric operation is too small to hold the result."

Num43 = %Dec(Char4:4:3);

Do you have a simple solution?

Read more ... Numeric target too small when using %DEC
 
Using %FOUND with CHAIN Print E-mail

Q: We are chaining to a file that has two record formats. We use the record format in factor 2 instead of the file name. When we try to use the %FOUND function (or NOT %FOUND), we get an RPG compile error: RNF0394 The parameter is not valid for built-in function %FOUND. Are we doing something wrong? Surely you can use the record format name on the chain?

Read more ... Using %FOUND with CHAIN
 
Multiple INDDS data structures Print E-mail

Q. I am converting an existing application to use the INDDS data structure function. If I have multiple screens defined in a single DDS workstation file, the indicators on different screens might mean different things. Could be command keys or maybe different fields, subfiles... Can I have the data structure remapped for every screen or some way to remap over the indicator in indicator data structure?

Read more ... Multiple INDDS data structures
 
Embedded SQL and Nulls Print E-mail
Q. How can I assign a null value to a table column using embedded SQL? The RPG %Nullind function doesn't seem to work for an SQL Update or Insert statement.
Read more ... Embedded SQL and Nulls
 
Converting Legacy Code to Named Indicators Print E-mail

Q. While maintaining a large RPG IV program, I added an indicator data structure, using the INDDS keyword for the workstation file. I also added the INDARA keyword to the DDS, as required, and recompiled the file. But now the program doesn't work. What did I do wrong? (The program is over 3,000 lines, and I do not want to change everything to use the new indicator data structure.)

Read more ... Converting Legacy Code to Named Indicators
 
Using /COPY with Free Format Print E-mail

Q. I'm having problems using /Copy in a free format RPG block. The compiler error I get is:

RNF0257
Form-Type entry not valid
or out of sequence.

What am I doing wrong?

Read more ... Using /COPY with Free Format
 
<< Start < Prev 1 2 3 4 Next > End >>

Page 2 of 4