Corrections

Despite our best efforts, sometimes typos and errors slip through the process of writing, editing, and printing a book. These are the known errors in our products. Future printings/productions will reflect these changes. Our apologies for any confusion they may have caused you. -BDM

RPG IV for RPG Programmers (DVD handout)

p35. The code at the bottom of the page shows an ENDIF operation, which should be ENDSL. The affected lines should read:
CL0N01Factor1+++++++Opcode(E)+Extended-factor2…

C                   SELECT
C                   WHEN      Key = F03Key OR Key = F12Key
C                   RETURN
C                   WHEN      Key = F05Key
C                   EXSR      Refresh
C                   WHEN      Custnumber <= 0
C                   EXSR      Error
C                   OTHER
C                   EXSR      Process
C                   ENDSL

RPG IV Modules, Procedures & Service Programs (DVD handout)

p39. In the section, "Compiling and Binding Modules," the first command after "Reuse modules easily," the CRTRPGMOD command refers to the wrong module. It should be
CRTRPGMOD MODULE(CHGLOAN)

RPG IV Jump Start (Fourth edition)

p37. The paragraphs on data-area data structures should read:

Data-area data structures typically use a U in column 23. Just as in RPG III, the RPG IV program will read/lock the data area named in the data structure at the beginning of the program, and it will update/unlock the data area at the end of the program. Also, just as in RPG III, if you don't specifically name the data-area data structure, it will use the local data area (*LDA). Here is an example:

*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
D Company        UDS
D   CpyName                     35
D   CpyAddr                     35
D   CpyCity                     21
D   CpyState                     2
D   CpyZipCode                  10


The data area must be a character data type. And the data area and data-area data structure must have the same name unless you use the *DTAARA DEFINE opcode or, better, the new DTAARA keyword to rename it. In the following example, the data area COMPANY is read into the CpyDta data structure in the RPG IV program:

*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
D CpyDta         UDS                  DTAARA(COMPANY)
D   CpyName                     35
D   CpyAddr                     35
D   CpyCity                     21
D   CpyState                     2
D   CpyZipCode                  10

When you code a U in column 23, the program will read and lock the data area when the program starts; it will automactically update and unlock it when the program ends. You can also use the IN and OUT operations to read and update the data area. If you do not want to lock the data area, do not use the U in column 23; instead use the DTAARA keyword to define the data area, along with IN and OUT.


p90. The code at the bottom of the page includes some unnecessary assignment (=) symbols. The affected lines should read:
IF %TLOOKUP(StateProv:TabState);
...
IF %TLOOKUP(StateProv:TabState:TabName);

Programming in RPG IV (Third edition)

p142. Operations for Output Files. This entire section should read:
 
The operations we’ve looked at so far are appropriate for input files. A few input/output (I/O) operations deal with output -- that is, writing records to database files. Until now, the output of your programs has been reports, but you can also designate a database file as program output. The File Specification entries in this case require the file name in positions 7–16; the type, O for output, in position 17; an E in position 22 (assuming the file is externally described); a K in position 34 (if the file is accessed via a key); and DISK, the device specification, in positions 36–42:
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++
// File specification for a program that writes records to a file
FCustMast O E K DISK
Once you’ve defined a database file as output, two RPG IV operations let you output records to the file: EXCEPT and WRITE.

pp176-177. In the code on page 176, the reference to field DspAtrPr should be Protect. So, instead of
DspAtrPr = *OFF;
the code should read
Protect = *OFF;
In subroutine AddRecord on page 177, the reference to field AddErr should be AddError. So, instead of
AddErr = %FOUND(Sections);     // Set AddErr if record already exists
the code should read
AddError = %FOUND(Sections); // Set AddError if record already exists
In subroutine ChgRecord, instead of
ChgError = %NOT FOUND(Sections);
the code should read
ChgError = NOT %FOUND(Sections);

p191. A parenthesis and a semicolon are missing in the code on this page. The affected line should read
IF %TLOOKUP(CodeIn:TabCode:TabName);

p282. In two instances, the %EDITC (Edit with an Edit Code) function is incorrectly referenced (as %EDTCDE). The correct name for the function is %EDITC.

p298. Title of section should be Variation 1: Subfile Size Greater Than Page.

pp301-302. Variation 2: Size Much Bigger Than Page. This section has somehow survived every edition of this book, and its predecessor, Programming in RPG/400. The section is outdated, irrelevant, and erroneous; it should be deleted in its entirety.

p302. Title of section should be Variation 2: Subfile Size Equals Page.