Troubleshooting
Problem
This document contains an example of performing a READE in a ILE RPG IV program.
Resolving The Problem
This document contains an example of performing a READE in a ILE RPG IV program.
READE reads the matching record for factor-1 and moves the pointer to the next record with the same matching criteria.
If the same matching criteria is not found then it goes to EOF.
Example ILE RPG IV READEQ2
Example ILE RPG IV READEQ2
**FREE
Ctl-Opt debug(*input);
Dcl-F filekeylf Keyed rename(filekeylf:filekeylfr);
Dcl-S fld Char(5) inz('a');
reade fld filekeylfr;
dow Not %EOF;
if field1 = fld;
snd-msg field1;
snd-msg field5;
snd-msg 'it worked';
endif;
reade fld filekeylfr;
enddo;
*INlr = *ON;
DDS for PF FILEKEYPF:
A R FILEKEY
A FIELD1 5A
A FIELD2 3A
A FIELD3 3A
A FIELD4 3A
A FIELD5 3A
A K FIELD1
A K FIELD2
A K FIELD3
DDS for LF FILEKEYLF:
A R FILEKEYLF PFILE(FILEKEYPF)
A FIELD1
A FIELD2
A FIELD3
A FIELD4
A FIELD5
A K FIELD1
A K FIELD5
PF file has the following records:
FIELD1 FIELD2 FIELD3 FIELD4 FIELD5
a F2 F3 F4 F5
B F2B F3B F4B F5B
a X2 X3 X4 X5
Compile the program using CRTBNDRPG.Call from command line:
> call readeq2
a
F5
it worked
a
X5
it worked
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
534552026
Was this topic helpful?
Document Information
Modified date:
25 November 2024
UID
nas8N1012765