Page History
...
Executing DOUNTIL . . . ENDUNTIL to enter "n" records to a file
Using DEF_COND Values as DOUNTIL parameters to make code easier to read and maintain
Comparing DOUNTIL . . . ENDUNTIL to the use of IF . . . GOTO . . . ENDIF
Executing DOUNTIL . . . ENDUNTIL routine with an Array Index
| Anchor | ||||
|---|---|---|---|---|
|
...
GROUP_BY NAME(#EMPDET) FIELDS(#EMPNO #SURNAME #SALARY)
DEFINE FIELD(#COUNT) REFFLD(#STD_NUM)
DEF_LIST NAME(#WORKER) FIELDS(#EMPNO #SURNAME #SALARY)
CHANGE FIELD(#COUNT) TO(1)
DOUNTIL COND('#COUNT > 10')
DISPLAY FIELDS(#COUNT)
proREQUEST FIELDS(#EMPNO #SURNAME #SALARY)
ADD_ENTRY TO_LIST(#WORKER)
CHANGE FIELD(#COUNT) TO('#COUNT + 1')
ENDUNTIL
DISPLAY BROWSELIST(#WORKER)
| Anchor | ||||
|---|---|---|---|---|
|
In this example, the COND parameter for the DOUNTIL command is set by the DEF_COND command before DOUNTIL is executed.
...
The use of DEF_COND also helps in situations where the same condition is referred to multiple times in the function. In this case it reduces the quantity of code and makes maintenance of the condition easier. . For further reference, refer to the << link to DEF_COND >> command.
| Anchor | ||||
|---|---|---|---|---|
|
This example, shows the simple use of the DOUNTIL .... ENDUNTIL routine:
...
When compared, the use of the DOUNTIL .... ENDUNTIL routine is simpler and easier to read than when the IF .... GOTO .... ENDIF routine is used for a simple loop.
| Anchor | ||||
|---|---|---|---|---|
|
This example demonstrates the use of the DOUNTIL .... ENDUNTIL routine with an Array Index that groups 3 field values into an array, increments each one by 10%, then adds the resulting values up to display:
...