9##########The following Insert routine is executed when either the INSERT or APPEND edit operation 9##########is selected. 9Insert 9 Setoff I1 9 Perform First 9##########The "First" routine is used here to initiate fields and clear them of previous values. 9 Perform Disp* 9Ins1 Perform AccKey 9##########The key fields data are entered by the user in the "AccKey" routine. If the user aborts the 9##########data entry, the flag A1 is set to ON and the Insert routine is aborted, returning the ON status 9##########of the I1 flag to the Edit command. 9 A1 Seton I1 InsEnd 9 Find 1KEY1 I0
9 Perform I/O_ok 9##########The find command is executed to check if there is an existing record that has key field value 9##########entered. 9 I0=Message!Exist +1 +1
9 I0=Goto Ins1 9 Perform AccData 9##########The data fields data are entered by the user in the "AccData" routine. If the user aborts the 9##########data entry, the flag A2 is set to ON and the flow is diverted to the "Ins1" label. 9 A2 Goto Ins1 9 Write 1 I0
9 Perform I/O_ok 9InsEnd Return 9########## ----- Insert routine end --------- 9##########The following Update routine is executed when UPDATE Edit operation is selected. 9Update 9 Setoff U1 9 Find 1KEY1 I0
9 Perform I/O_ok 9 Perform Disp* 9##########The "Disp*" routine is executed after the record is found to display the field values. 9 Perform AccData 9 A2 Seton U1 UpdEnd 9 Rewrite1 I0
9 Perform I/O_ok 9UpdEnd Return 9########## ----- Update routine end --------- 9##########The following Delete routine is executed when DELETE Edit operation is selected. 9Delete 9 Setoff D1 9 Find 1KEY1 I0
9 Perform I/O_ok 9 Message!DelMsg +2 +1 D1 9##########The record is deleted after presentation of the warning message. 9 If Delete 9 Delete 1 I0
9 Perform I/O_ok 9 EndIf 9DelEnd Return 9########## ----- Delete routine end --------- 9##########The following Locate routine is executed when LOCATE Edit operation is selected. 9Locate 9 Setoff L1 9 Perform First 9 Perform AccKey 9##########The searched key value is entered by the user in the "AccKey" routine. 9 A1 Seton L1 LocEnd 9 Find 1KEY1 I0
9 Perform I/O_ok 9 If Locate 9 Perform Next
9 N1 Seton I0 9 EndIf 9 If Locate 9 Perform Prev
9 P1 Seton I0 9 EndIf 9 If Locate 9 Seton L1 9 EndIf 9LocEnd Return 9########## ----- Locate routine end --------- 9##########The display routine is called by the Edit command. There is no Display command in this 9##########routine, because the display is initiated automatically by the Edit command. 9Display 9 Find 1KEY1 I0
9 Perform I/O_ok 9 Return
9########## ----- Display routine end --------- 9##########The first routine is executed when the Edit command needs to initiate the field values. 9First Moves 0BLANK 1Family
9 Setoff F1
9 Return
9########## ----- First routine end --------- 9##########The last routine is executed when the Edit command needs to maximize the field values. 9Last Moves 0MaxStr 1Family
9 Setoff L1
9 Return
9########## ----- Last routine end --------- 9##########The next routine is executed when the Edit command needs to read the next record, either for 9##########internal use or as a result of user selection. 9Next Setoff N1
9 Read 1KEY1 I0
9 Perform I/O_ok 9 I0 Seton N1 9 Return
9########## ----- Next routine end --------- 9##########The Prev routine is executed when the Edit command needs to read the previous record, either 9##########for internal use or as a result of user selection. 9Prev Setoff P1
9 Prev 1KEY1 I0
9 Perform I/O_ok 9 I0 Seton P1 9 Return
9########## ----- Prev routine end --------- 9##########The Exit routine is executed when the Edit operation EXIT is selected. 9##########The EXIT operation ends Edit command execution. 9Exit Setoff E1
9 Return
9##########The Exit- routine is executed when the Edit operation EXIT- is selected. 9##########The EXIT- operation ends Edit command execution and sets the Edit flag to "-". 9Exit- Setoff E1
9 Find 1KEY1 F1
9 Return
9##########The Exit+ routine is executed when the Edit operation EXIT+ is selected. 9##########The EXIT+ operation ends Edit command execution and sets the Edit flag to "+". 9Exit+ Message!Exit 0Two +1 E1
9 Return
9I/O_ok 9 I0-Message!WriteErr+1 +1 9 I0-Seton I1 9 I0-Seton U1 9 I0-Seton D1 9 I0-Seton L1 9 I0-Seton N1 9 I0-Seton P1 9 Return 9##########All user data are entered in the KEY fields here. 9AccKey Accept *KEY A1 9 Return 9##########All user data are entered in the DATA fields here. 9AccData Accept *DATA A2 9 Return 9Disp* Display*KEY