For an automatic re-reading (MANAGE_SFL *n), use the indicator corresponding to the SFLNXTCHG keyword; this indicator is defined in the generation standard (*IN08 by default).
When the subfile is filled in, you must set the indicator to 1 before writing any record.
In this way, all records can be automatically reread in the VERIFICATION or VALIDATION blocks.
Example
INITIALIZATION block
*********************** |
|
INITIALIZATION aa |
|
*********************** |
|
MANAGE_SFL n |
|
.... |
|
*IN08 = '1' |
|
UPD_SFL |
|
.... |
|
*IN08 = '0' |
|
END_MANAGE_SFL |
When the subfile is reread manually, you can define a view that works directly on the subfile, and write a standard loop to read by key.
Example
View xx: file origin *n
Access is by key using WRAN0n as key.
WRAN0n is the variable generated by Adelia to work with the subfile sequence number and is associated with the SFLRCDNBR keyword. It allows you to specify the page of the subfile to be displayed; the page displayed is the page that contains the record whose sequence number equals WRAN0n (n is the number of the subfile).
You must define it in the prototype:
field = WRAN01 GW = WRAN01 Ln = 4 Dec = 0 Ref = *NODEF
View guide word: READ_SUBFILE
WRAN0n = 1 |
Position to first record |
DO_WHILE WRAN0n <= *DEL0n |
Loop until all subfile records have been processed |
|
|
CHAIN READ_SUBFILE |
Read record directly |
.... |
|
WRAN0n = WRAN0n + 1 |
Go to next record |
REDO |
Continue with DO_WHILE |
The lines that were active are no longer active. You cannot reread this subfile with MANAGE_SFL before redisplaying the screen (with PROCESS or EXECUTE).
Reserved words used
*DEL0n
is the Adelia reserved word that contains the total number of records loaded in the subfile.