Tags:
view all tags
---+ PUSH & POP ILF Statements _Release 5.0.0 of APPX implements the PUSH and POP ILF statements._ %TOC% ---++ PUSH Statement The PUSH statement pushes a field or record value onto an internally maintained stack for the indicated field or record. The structure of the statement is: <pre> <blockquote style="MARGIN-RIGHT: 0px" dir="ltr"><p />***** PUSH *** ********************** *** *************** (1) (2) (3) (4) (5)<p /> (1) T/F execution conditions (2) Application ID (3) File Name, field name, or predefined field (4) Occurrence (constant/index) (5) Data item type (FIELD, RECORD, DEFAULT FIELD, DEFAULT RECORD, ORIGINAL FIELD, ORIGINAL RECORD)</blockquote> </pre> 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. Each field and each record has its own stack. There is only one stack for each field name and one stack for each file name. Consequently, FIELD, DEFAULT FIELD, and ORIGINAL FIELD all push the indicated values onto a common (shared) stack for the specified field and RECORD, DEFAULT RECORD, and ORIGINAL RECORD all push the indicated record buffers onto a common (shared) stack for the specified record. 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. Multiple occurrences of a field share a common stack. The stack for a field or record has the same scope (none, subprocess, related, or detached) as the field or record associated with it. ---++ POP Statement 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: <pre> <blockquote style="MARGIN-RIGHT: 0px" dir="ltr"><p />***** POP *** ********************** *** *************** (1) (2) (3) (4) (5)<p /> (1) T/F execution conditions (2) Application ID (3) File Name, field name, or predefined field (4) Occurrence (constant/index) (5) Data item type (FIELD, RECORD, DEFAULT FIELD, DEFAULT RECORD, ORIGINAL FIELD, ORIGINAL RECORD)</blockquote> </pre> <verbatim> POP AAA FILE OR FIELD NAME OCC TYPE </verbatim> 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 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 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. 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. The stack inherites the scope (subprocess, related, or detached) from the field that is PUSH'ed. 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. ---++ Examples The following example shows how PUSH and POP can be used to swap the values of occurrences 1 and 2 of a field. <pre> PUSH TOE ORDER1 SALESPERSON 001 FIELD PUSH TOE ORDER1 SALESPERSON 002 FIELD POP TOE ORDER1 SALESPERSON 001 FIELD POP TOE ORDER1 SALESPERSON 002 FIELD </pre> 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. ---++ Comments: _Read what other users have said about this page or add your own comments._ --- Here are a couple of ideas for additional related statements: * POP ALL - Empty the stack for the specified field or record * POP FIFO - POP the specified field or record from the bottom of the stack - FIFO (first in, first out) manner, rather than LIFO -- SteveFrizzell - 01 Oct 2008 %COMMENT% -- AlKalter - 04 Apr 2008
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r21
|
r16
<
r15
<
r14
<
r13
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r14 - 2008-10-01
-
SteveFrizzell
Home
Site map
Main web
MedicaidBilling web
Sandbox web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Edit
Attach
Copyright © 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