Buffer Referencing (PQN)
The following material applies to PQN Procs only.
Buffer Reference Symbols
You can make direct and indirect references to input and output buffers and file buffers, direct references only to select registers. The following characters are used to indicate buffer referencing:
% References the primary input buffer.
# References the active output buffer.
& References a file buffer or the 'fast' buffer.
! References a select register.
Referencing the primary input buffer or active output buffer does not reposition the pointers.
Direct or indirect buffer references can be used with the following Proc commands:
( ) | [ ] | F; | FB | F-FREE |
F-KLOSE | F-OPEN | F-READ | F-UREAD | H |
IBH | IBP | IF | IF (mask) | IF (multivalued) |
IFN | IH | IP | L | MV |
MVA | MVD | RI | S | T |
Direct Referencing
A direct reference is made by following the appropriate buffer symbol with a literal. For example:
%23 References the 23rd parameter in the primary input buffer.
#4 References the 4th parameter in the current output buffer.
&4.19 References attribute 19 in file buffer 4.
!3 References the next value in select register 3.
Indirect Referencing
An indirect reference is made by following the buffer reference symbol with another buffer reference symbol and a literal. The second buffer reference symbol and the literal form a direct reference to a value that is used with the first buffer reference symbol to form a further buffer reference.
Indirect references can only be made to the primary input buffer (%), the active output buffer (#) or a file buffer (&). If the referenced value is non numeric, then a zero is used.
Example 1
If the active output buffer contains
123^XYZ^A^6^7
&3.#4 #4 refers to the 4th parameter in the active output buffer, which is a value of 6. Therefore, #4 is equal to 6. &3 refers to file buffer 3. Therefore, &3.#4 evaluates to the 6th attribute in file buffer 3.
Another way of looking at this example:
#4 = 6
&3.(#4) = &3.(6) = &3.6
Example 2
If the primary input buffer contains
ABC^DEF^123^789^2^C
%%5 %5 refers to the 5th parameter in the primary input buffer, which is a value of 2. Therefore, %5 evaluates to 2. %2 references the 2nd parameter in the primary input buffer, or DEF. Therefore, %%5 evaluates to DEF.
Another way of looking at it:
%5 = 2
%(%5) = %(2) = %2