A
Copies a parameter from the active input buffer to the active output buffer.
Syntax
A{char}
A{char}param
A{char}param,count
A{char}(start)
A{char}(,count)
A{char}(start,count)
Syntax Elements
char Optional. Specifies a character to surround the string being copied.
The char specification can be any non-numeric character except a left parenthesis (.
The surround character
option is especially useful for
If the destination is the secondary output buffer, the character char is ignored.
If char is a backslash (\), the value is concatenated with the previous parameter in the primary output buffer.
param An integer that specifies the parameter to be copied. Must be greater than 0.
count Specifies the number of characters to be copied starting at the current position of the primary input buffer pointer or the position specified by start.
The copy terminates if an attribute mark or end of buffer is encountered before count characters have been copied.
start Specifies the starting column in the primary input buffer where you want the copy to begin. The copy continues to the end of the parameter or until the number of characters specified by the count parameter have been copied.
Operation
The A command used by itself copies the parameter pointed to by the buffer pointer in the active input buffer to the active output buffer.
The A command that includes a parenthetical specification (that is, (start), (,count), or (start,count)) causes the primary input buffer to be selected.
If the stack is "off" (that is, the primary output buffer is active), the A command places the data in the output buffer as a separate parameter.
If the stack is "on" (that is, the secondary output buffer is active), the A command concatenates the value to the previous parameter in the output buffer. The move continues until an attribute mark is found.
The buffer pointers are positioned at the attribute mark terminating the copied parameter in the primary output buffer (stack "off") or at the end of the secondary output buffer (stack "on"). Subsequent A commands move the next parameters in order.
If the buffer pointer in the active input buffer is at the end of the buffer, the A command has no effect.
Example 1
PIB Before the A Command |
PIB After the A Command |
---|---|
|
|
Note the position of the buffer pointer after you issue the A command.
Example 2
Command |
PIB Before |
PIB After |
---|---|---|
|
|
|
|
POB Before |
POB After |
---|---|---|
|
|
Example 3
Command |
PIB Before |
PIB After |
---|---|---|
|
|
|
|
SOB Before |
SOB After |
---|---|---|
|
|
The secondary output buffer is active (stack is "on" by a previous STON command). The characters in the 8th to the 10th position in the primary input buffer are copied to the secondary output buffer. The full 6 characters are not copied because the copy terminates at the attribute mark.
Example 4
Command |
PIB Before |
PIB After |
---|---|---|
|
|
|
|
POB Before |
POB After |
---|---|---|
|
|
|
Example 5
001 PQN 002 MV %1 "LIST","MD","ERRMSG","SORT" 003 MV %5 "WITH *A1 =","Q","DDBL-SPCX" 004 S1 005 A 006 IF A # MD X%2 WAS NOT MD 007 A 008 A'4 009 A'3 010 S5 011 A 012 A"6 013 A(35,7) 014 P
In this example:
- The S1 command on line 004 positions the buffer pointer at the 1st parameter in the active input buffer (%1).
- The A command on line 005 moves the string "LIST" to the active output buffer (#1) and moves the buffer pointer forward to the 2nd parameter in the primary input buffer.
- The IF statement on line 006 verifies that the 2nd parameter in the primary input buffer (%2) contains the string MD. (This does not increment the pointer.)
- The A command on line 007 then copies the string "MD" into the 2nd parameter of the active output buffer (#2).
- A'4 and A'3 on lines 008 and 009 surround the strings "SORT" and "ERRMSG" with single quotes and copies those values into the 3rd and 4th parameters of the active output buffer (#3 and #4).
- S5 positions the buffer pointer at the fifth parameter of the active input buffer (%5).
- The A command on line 011 copies the string "WITH *A1 =" into the 5th parameter of the active output buffer (#5).
- The A"6 on line 012 surrounds the value "Q" in the 6th parameter of the active input buffer (%6) with double quotes and copies it to the end of the output buffer.
- A(35,7) locates the 35th character in the primary input buffer, (starting the count at the 'L' in "LIST" and counting, including attribute marks, for 35 bytes). Seven characters (starting with the 35th character) are copied into the 7th parameter of the active output buffer (#7). These seven characters are: DBL-SPC.
The primary input buffer after line 3 contains:
LIST^MD^ERRMSG^SORT^WITH *A1 =^Q^DDBL-SPCX^
This Proc produces the following command:
LIST MD 'SORT' 'ERRMSG' WITH *A1 = "Q" DBL-SPC
The contents of the input and output buffers are given below:
Primary Input Buffer:
%1 |
%2 |
%3 |
%4 |
%5 |
%6 |
%7 |
LIST |
MD |
ERRMSG |
SORT |
WITH *A1 = |
Q |
DDBL-SPCX |
|
|
|
|
|
23
|
|
Currently Active Output Buffer:
%1 |
%2 |
%3 |
%4 |
%5 |
%6 |
%7 |
LIST |
MD |
'SORT' |
'ERRMSG' |
WITH *A1 = |
"Q" |
DBL-SPC |