Construct a function to display records from a file.
Files Involved
Physical file CUSMST (customer master file)
RDML Program - Version 1
GROUP_BY NAME(#CUSTOMER) FIELDS(#CUSTNO #NAME #ADDL1
#ADDL2 #ADDL3)
BEGIN_LOOP
L10 REQUEST FIELD(#CUSTNO)
FETCH FIELDS(#CUSTOMER) FROM_FILE(CUSMST)
WITH_KEY(#CUSTNO) NOT_FOUND(L10)
ISSUE_MSG(*YES)
DISPLAY FIELDS(#CUSTOMER)
END_LOOP
RDML Program - Version 2
GROUP_BY NAME(#CUSTOMER) FIELDS(#CUSTNO #NAME #ADDL1
#ADDL2 #ADDL3)
BEGIN_LOOP
REQUEST FIELD(#CUSTNO)
FETCH FIELDS(#CUSTOMER) FROM_FILE(CUSMST)
WITH_KEY(#CUSTNO)
IF_STATUS IS(*OKAY)
DISPLAY FIELDS(#CUSTOMER)
ELSE
MESSAGE MSGTXT('No customer exists with this number')
ENDIF
END_LOOP
Points to Note: