You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

&<img src="../resources/images/opentocr.png" title="Open Contents list" border="0"&>
You are here:

4.3.1 Adding Records to a File (One at a Time)

Construct a function to add records to one file.
Files Involved
Physical file CUSMST (customer master file)
RDML Program
GROUP_BY   NAME(#CUSTOMER) FIELDS(#CUSTNO #NAME #ADDL1 
           #ADDL2 #ADDL3)
 
BEGIN_LOOP
CHANGE     FIELD(#CUSTOMER) TO(*DEFAULT)
REQUEST    FIELDS(#CUSTOMER) EXIT_KEY(*YES *EXIT) 
           MENU_KEY(*YES *MENU)
INSERT     FIELDS(#CUSTOMER) TO_FILE(CUSMST) 
           VAL_ERROR(*LASTDIS) 
END_LOOP
 
Points to Note:

  • Program keeps adding records until the EXIT or MENU function key is used (BEGIN_LOOP and END_LOOP commands).
  • The EXIT and MENU function keys are enabled on the REQUEST screen. If either key is used the function will end. The values shown are defaults and would not normally be shown.
  • The VAL_ERROR parameter of the INSERT command is a default and would not normally be shown. If a validation error (file or dictionary level) is detected by the INSERT command the last display (the REQUEST command) will receive control to display the error details for correction.

&<img src="../resources/images/opentoc-dark.png" title="Open Contents List" border="0"&>

  • No labels