Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
PUSH & POP ILF Statements | ||||||||
Line: 58 to 58 | ||||||||
(2) Application ID (3) File Name, field name, or predefined field (4) Occurrence (constant/index) | ||||||||
Changed: | ||||||||
< < | (5) Data item type (FIELD, RECORD, DEFAULT FIELD, DEFAULT RECORD, ORIGINAL FIELD, ORIGINAL RECORD) | |||||||
> > | (5) Data item type (FIELD, RECORD) | |||||||
The POP statement is used to pop (retrieve) a value that was saved with a PUSH statement. | ||||||||
Line: 67 to 67 | ||||||||
The stack has the internal structure of a LIFO list, i.e. the last value pushed onto the stack for a field or record is the first value popped from the stack. There is no predefined limit as to how many field or record values may be pushed onto a stack. | ||||||||
Changed: | ||||||||
< < | You may execute a POP statement for a specific field or file more than once. Each time that you execute a POP statement, the value from the "top" of the stack of the referenced field or record is saved as the current value of the referenced field or record, the value is removed from the stack, and the True/False indicator is set. The POP statement sets the True/False indicator. If the stack for the referenced field or file contains a value, then the stack is popped and the next level of the true/false statsu indicator is set to T (true). If the stack is empty, then the referenced field is set to its default value and the next level of the true/false indicator is set to F (false). | |||||||
> > | You may execute a POP statement for a specific field or file more than once. Each time that you execute a POP statement, the value from the "top" of the stack of the referenced field or record is saved as the current value of the referenced field or record and the value is removed from the stack. The POP statement also sets the True/False indicator. If the stack for the referenced field or file contains a value, then the stack is popped and the next level of the true/false statsu indicator is set to T (true). If the stack is empty, then the referenced field is set to its default value and the next level of the true/false indicator is set to F (false). | |||||||
Predefined fields may be referenced by a PUSH or POP statement. However, it is invalid to use the PUSH or POP statement for predefined fields that are non-modifiable. The scope of a stack is the same as the scope of the associated field or file. For example, if the scope of the referenced field is RELATED, then the scope of the associated stack will also be RELATED. | ||||||||
Deleted: | ||||||||
< < | The Data Item Type specification is used to specify either FIELD or RECORD, and load/retrieve accordingly. Scanning on the TYPE field displays six possible values (FIELD, DEFAULT FIELD, ORIGINAL FIELD, RECORD, DEFAULT RECORD, ORIGINAL RECORD), apparently because the structure of the statement was taken from the STORE/RESTORE statements. However, it is important to note that there is only one stack for each FIELD, and one for each RECORD; therefore specifying DEFAULT FIELD or ORIGINAL FIELD is no different than specifying FIELD. Note, though, that an error will occur if you specify ORIGINAL FIELD on something other than the Process Control File. The POP statement retrieves values in the reverse order that they were PUSHED, i.e. a LIFO function, and returns a TRUE flag if a value was successfully POPped, and a FALSE flag if the stack was empty. There is no automatic way to empty a stack, other than to repeat the POP statement in a loop until it returns a FALSE. | |||||||
When a POP statement references a field with an occurrence, the next value from the stack is popped into the specified occurrence of the reference field. A sub-string field and a synonym field will each have their own stack since they have field names that are distinct from the field that they are derived from. | ||||||||
Line: 94 to 88 | ||||||||
One use for PUSH and POP is to load virtual keystrokes (user options) into a stack, and have them executed automatically and sequentially. See the section on SELECT below for an example of this usage. | ||||||||
Added: | ||||||||
> > | Issues:
| |||||||
Comments:Read what other users have said about this page or add your own comments. |