To work with the fill-in of subfiles in dynamic mode, you must not use the ROLL_UP instruction, since it is only valid for an automatic fill-in of a subfile (MANAGE_SFL, UPD_SFL, END_MANAGE_SFL).
You must:
Check the "Dynamic pagination" box for view *1 or enter 2 in the type of pagination (in Adelia/400).
Not specify a guide file for the load.
Create a view 01 (for example), with *1 as file origin.
The view mode is set to update with creation of records.
Access is by key, with WRAN01 as key.
The guide word for this view could be: LINE_SF1.
If necessary, create a view to work with the file to be displayed (update, etc.).
Define a new variable in the prototype:
field = WRAN01 GW = WRAN01 Ln = 4 Dec = 0 Ref = *NODEF
Create a procedure to load a page of the subfile:
BEGIN_PROCEDURE LODSF1 |
LODSF1 is the procedure name |
*NBL01 = 0 |
Resets the number of records |
*IN08 = '0' |
loaded in the page. |
DO_WHILE check outcome of read operation and *NBL01 < *NBLS1 |
|
screen fields = file fields |
Replaces the PRESENT instruction |
*NBL01 = *NBL01 + 1 |
+ 1 in the number of records |
|
of the current page. |
*DEL01 = *DEL01 + 1 |
) Replaces |
WRAN01 = *DEL01 |
) the UPD_SFL |
CREATE LINE_SF1 |
) instruction |
read next record |
|
REDO |
|
*IN07 = '0' |
|
IF next record DOES_NOT_EXIST |
|
*IN07 = '1' |
) Erases the "+" continuation sign |
END |
|
END_PROCEDURE |
|
Enter in the INITIALIZATION section:
********************** |
|
INITIALIZATION aa |
aa = transaction number |
********************** |
|
CLEAR 1 |
Initializes subfile |
read the first record of file |
|
PROCESS_PROC LODFG1 |
Loads first page |
... |
Enter in the TRANSACTION section:
********************** |
|
TRANSACTION aa |
aa = transaction number |
********************** |
|
IF *ROLLUP |
|
PROCESS_PROC LODSF1 |
|
*RANPA1=0 |
) Allows to force the redisplay of the |
PROCESS aa |
) loaded page, if *SAME_PAGE = '1'. |
END |
) Otherwise,the current page is being |
|
redisplayed. |
Note: The MANAGE_SFL and END_MANAGE_SFL instructions are used in the VERIFICATION and VALIDATION sections the same way they are used when the subfile is filled in automatically.
Reserved words used
WRAN0n
is the variable generated by Adelia to work with the SFLRCDNBR keyword (number of the subfile control format).
*DEL0n
is the Adelia reserved word which contains the total number of records loaded in the subfile.
The assignment WRAN01 = *DEL01 allows to display the last page loaded in the subfile.
*NBLSn
is the Adelia reserved word which contains the number of records contained in the subfile page when the subfile is loaded in dynamic mode.
*NBL0n
is the Adelia reserved word which contains the number of records already loaded in the current page of the subfile.
*IN07
is the indicator associated with the use of the SFLEND keyword (continuation character) for subfile *1.
This indicator is defined in the generation standards.
It is set to 1 when the fill-in of the subfile is done.
*IN08
is the indicator associated with the use of the SFLNXTCHG keyword. This indicator is set to '0' so that the created lines be active only if modified.
Click here for the detailed explanation of the reserved words.