Difference: PUSHPOPILFStatements (15 vs. 16)

Revision 162008-10-03 - SteveFrizzell

Line: 1 to 1
 
META TOPICPARENT name="APPX500Features"

PUSH & POP ILF Statements

Line: 6 to 6
 
Added:
>
>
 

PUSH Statement

The PUSH statement saves a field or record value on an internally maintained stack for the indicated field or record. The structure of the statement is:

Line: 22 to 24
  A distinct stack is associated with each field name and with each file name.
Changed:
<
<
The stack has the internal structure of a LIFO list, i.e. the last value pushed onto the stack for a field is the first value popped from the stack.
>
>
The PUSH statement is used to add  field and record values to a stack.

The POP statement is used to retrieve field and record values from a stack.

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.

The value of the source field or record is not changed when a PUSH statement is executed.

You may execute a PUSH statement for a specific field or file more than once before you execute a POP statement to retrieve a value from the stack.  Each time that you execute a PUSH statement, the value of the referenced field or record is "pushed" onto the top of the stack associated with that field or file. Each time that you execute a POP statement, the next value is retrieved from the stack of the referenced field or record, stored as the current value of the referenced field or record, and removed from the top of the stack.

  The contents of predefined fields can also be saved using the PUSH statement. However, it is invalid to use the PUSH statement for predefined fields that are non-modifiable, since the POP command is invalid for those fields.
Changed:
<
<
The scope of a stack is the same as the scope of the associated field or file. 
>
>
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.
  The Data item type specification identifies which field value or record is to be pushed onto the stack.  If FIELD or RECORD is specified, then the  current value of the field or record is pushed onto the stack.  If DEFAULT FIELD or DEFAULT RECORD is specified, then the  default value of the field or record is pushed onto the stack.  If ORIGINAL FIELD or ORIGINAL RECORD is specified, then the original value of the field or record is pushed onto the stack.  ORIGINAL FIELD and ORIGINAL RECORD may only be specified if the process being executed has a PCF.
Line: 34 to 44
  Multiple occurrences of a field also share a common stack.
Changed:
<
<
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.
>
>
A sub-string field and a synonym field each have their own stack since they have field names that are distinct from the field that they are derived from.

 

POP Statement 

Changed:
<
<
The POP statement pops a field or record value from an internally maintained stack and sets it into the indicated field or record. The structure of the statement is:
>
>
The POP statement pops a field or record value from an internally maintained stack and sets it as the current value of the indicated field or record. The structure of the statement is:
 

***** POP *** ********************** *** ***************

Line: 49 to 61
 (5) Data item type (FIELD, RECORD, DEFAULT FIELD, DEFAULT RECORD, ORIGINAL FIELD, ORIGINAL RECORD)
Changed:
<
<
 
      POP      AAA FILE OR FIELD NAME   OCC      TYPE
>
>
A distinct stack is associated with each field name and with each file name.
 
Changed:
<
<
The new PUSH and POP statements allow designers to load (PUSH) field or record data onto an internally maintained stack, and then retrieve (POP) them for use later. The structure of the statement is: (AAA is the application ID, OCC is the [optional] occurrence number.)
>
>
The PUSH statement is used to add  field and record values to a stack.
 
Changed:
<
<
The TYPE field 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 is used to retrieve field and record values from a stack.
 
Changed:
<
<
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.
>
>
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:
<
<
A sub-string field and a synonym field will each have their own stack since they have distinct field names. A field with multiple occurrences will have one stack. For example, a field named MYFILE FLD is defined with 2 occurrences. If you pushed MYFILE FLD (001) then pushed MYFILE FLD (002) the data will be saved in the stack named MYFILE FLD. To retrieve the saved values you would POP MYFILE FLD twice. The first POP would return MYFILE FLD (002), the second POP would return MYFILE FLD (001) as described above.
>
>
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.
 
Changed:
<
<
The stack inherites the scope (subprocess, related, or detached) from the field that is PUSH'ed.
>
>
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).
 
Changed:
<
<
An ideal 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.
>
>
The PUSH statement is used to PUSH the value of a field or record onto an internally maintained stack in memory.  The POP statement is used to POP (retrieve) a previously pushed value.

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.

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.

 

Examples

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback