In the functions you just completed, you named some implicit data items, for example LAST and COUNT. VisualAge Generator will create these implicit data items dynamically as needed in the program. You can specify in program properties whether or not VisualAge Generator creates implicit data items.
Two of the performed functions you named, READ-AND-SAVE and MOVE-IT are third or fourth-level performed functions. You must define these functions.
Define a I/O option that will read the next record from the database selected by the SETINQ I/O option in the function GET-LIST. Also, specify an error routine that causes an immediate return from the READ-N-SAVE function if an error condition occurs when the record is read.
To define READ-AND-SAVE:
The New Part Package/Application window is displayed.
The new part is created and the Function Editor is displayed.
The Function Properties window (Figure 84) is displayed.
Figure 84. Function Properties
To supply processing statements for READ-AND-SAVE:
if ezesqcod = 0; count = count + 1; sub = sub + 1; move cusnum to cusnum-ws[sub]; move cusname to cusname-ws[sub]; move cuscontact to cuscontact-ws[sub]; move cusphone to cusphone-ws[sub]; end;
VisualAge Generator will validate and format the statements. You must correct any errors before you save the part.
Your function should look like the one shown in Figure 85.
Now, you can define the logic behind MOVE-IT.
To define MOVE-IT:
The new part is created and the New Part Package/Application window is displayed.
The new part is created and the Function Editor is displayed.
move 0 to sub; move last to sub2; set custmap empty; while sub < 5 and sub2 < count; sub = sub + 1; sub2 = sub2 + 1; move cusnum-ws[sub2] to cusnum-a[sub]; move cusname-ws[sub2] to cusname-a[sub]; move cuscontact-ws[sub2] to cuscontact-a[sub]; move cusphone-ws[sub2] to cusphone-a[sub]; end; move sub2 to last;
VisualAge Generator will validate and format the statements. You must correct any errors before you save the part.
In the Program Editor, MOVE-IT is displayed as defined under FORWARDS and BACKWARDS. Your program should look like the one shown in Figure 87.