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)

Control Language Programming for IBM i

p131. In exercise 4e, the table should read:

Variable name Expression value
&num1 &num1 + 1
&num2 &dec72 + &dec50
&num3 &num2 + &num1
&num4 &dec72 - 8
&text &char10 *CAT &char25
&text2 'My friend is' *BCAT &char25
&text3 %SST(&text2 1 12) *BCAT 'Bill Jones'
&text (%SST(&text4 10 35))

p218. The data following "The actual parameter passed..." near the bottom should be:

Marybbbbbbbbbbbbbbbbbbbbbbbbbbbb
Joebbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Billiebbbbbbbbbbbbbbbbbbbbbbbbbb
Rumpelstiltskinbbbbbbbbbbbbbbbbb
Character constant longer than 32

p266. In the "Files Without DDS" sidebar, the first example should read:

CRTPF FILE(WORKFILE) RCDLEN(256)
The example at the bottom of the page should read:

DCLF WORKFILE
DCL  &date  *DEC (6 0)
DCL  &adate *CHAR 6

CHGVAR &adate (%SST(&workfile 1 6))
CHGVAR &date  &adate

p274. In the paragraph beginning "The LEN parameter defines..." a sentence limits *DEC data areas to 15 digits. The sentence should read:

"CL supports *DEC type data areas up to 24 digits long, with up to nine decimal places (the default is 15 digits, with five decimals."

p301. In the paragraph beginning "The WAIT parameter..." the sentence beginning "Another value that can be specified..." should read

"Another value that can be specified for the WAIT parameter is *MAX."

p331. In the code example at label "B" the code should read:

  OVRDBF MAILLIST SHARE(*YES)

p345. The table at the bottom of the page should read:

Prompt Value displayed Input Allowed?
??KEYWORD() Default Yes
??KEYWORD(value) Value Yes
?*KEYWORD() Default No
?*KEYWORD(value) Value No
?-KEYWORD() Parameter not displayed; command will use default No
?-KEYWORD(value) Parameter not displayed; command will use specified value No

p396. In the section "Call Stack Level Scoping" the second sentence should read:

"When you scope an override at the call stack level in an ILE environment, the override is in effect at the current call level and at any subsequent call levels within the same job."

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.