5 3 1 Adding Records to a File One at a Time

Visual LANSA

5.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.

Ý 5.3 Sample RDML Programs