Use this general macro to edit and move data. This macro is used to
scan a string of characters for a delimiter. It deletes certain
characters in the string (such as blanks) and moves the significant characters
in the string to a prescribed work area, keeping count of the number of
characters moved. The operation ends when a specified character (such
as an end-of-message character) is encountered or when a specified number of
characters have been moved. This is a data-manipulating type of
macro. The characters are edited from left to right and stored
left-justified in the destination area.
Format
- label
- A symbolic name can be assigned to the macro statement.
- COUNT=Rw|R15
- Significant character count. It designates a symbolic general
register, other than R0, which will contain the count of significant
characters after execution of the macro. If this parameter is omitted,
R15 is assumed for use.
- FROM=Rx|R1
- This is the source location register. It designates a symbolic
general register, other than R0, which contains the address of the first
character in the string to be edited. If this parameter is omitted, R1
is assumed to contain that address.
- TO=Ry|R14
- This is the destination location register. It designates a symbolic
general register which contains the address of the first position into which
the significant characters are to be moved. R14 will be assumed if this
keyword is omitted.
- MAX=literal|256|Rz
- Specify one of the following:
- literal
- It defines the maximum number of significant characters to be
moved. This parameter will end the operation if the specified delimiter
is not encountered, where 1 <= literal <= 256. If this
parameter is omitted, the maximum number of characters moved will be 256
characters.
- Rz
- This is any symbolic general register that contains a binary count
defining the maximum number of significant characters to be moved. The
value contained in the register must conform to the limits set up for literal
usage.
- MAXFROM=Rv
- This is any symbolic general register other than R0 that contains the
maximum, or last, address of the source location to be edited. Editing
ends when the address of the character being scanned (in the source location)
exceeds MAXFROM before a stop delimiter has been found and before the maximum
number of characters has been moved. The default is to not check for
the maximum source location address as an ending condition.
- DELETi
- Where i is 1-3. These parameters identify as many as 3
characters that, if found at the source location (specified by the FROM
parameter), will not be moved to the destination location. These
parameters may be defined as symbols or as literals. The literal may be
any self-defining expression that can be coded in the immediate field of a CLI
instruction.
These parameters must be used in sequence. That is, if DELET2 is
used, DELET1 must be included, and if DELET3 is used, both DELET1 and DELET2
must be included.
- symbol
- The symbolic location of a byte that will be used for comparison.
The symbol cannot begin with the letter A.
- Aliteral
- The letter A followed by any self-defining expression that could be coded
in the immediate field of a CLI instruction as given in the following
examples.
Examples of legal delimiters:
- Delimiter
- Binary Representation
- AX'2F'
- 00101111
- AC' '
- 01000000
- A#CAR
- 00010101
Examples of illegal delimiters:
- Delimiter
- Explanation
- X'2F'
- Not preceded by an A.
- AX'CFA3'
- More than 1 byte defined.
- C'A'
- Not preceded by an A.
- AC'AB'
- More than 1 byte defined.
- STOPj
- Where j is 1-3. These parameters specify characters which
cause EDITA to cease editing. They can be specified as: symbol,
Aliteral, ALPHA or NUM.
If STOP1 is omitted an end-of-message-complete character (#EOMC) will be
assumed as the option. If STOP2 or STOP3 is omitted no option will be
assumed. If STOP2 is omitted STOP3 will not be examined for
options.
Examples of legal STOP combinations are:
EDITA STOP1
EDITA STOP1,STOP2,STOP3
EDITA STOP2 /* STOP1 assumed EOMC */
Illegal combinations are:
EDITA STOP1,STOP3 /* STOP2 missing */
EDITA STOP3 /* STOP2 missing */
- symbol
- This is the symbolic location of one, two or three bytes that will be used
for comparison to stop the EDITA scan. For example: EDITA
STOP1=PCA412 is coded and the symbolic location, PCA412 defines a
C'/'. This will cause editing to cease when a slash (/) is
found in the FROM field. The symbol cannot begin with the letter
A.
- Aliteral
- The letter A followed by any self-defining expression that can be coded in
the immediate field of a CLI instruction.
- ALPHA
- Editing is stopped at the first nonnumeric character (not a digit,
0-9, X'F0'-X'F9').
- NUM
- Editing is stopped at the first numeric character (digit, 0-9,
X'F0'-X'F9').
Examples of legal delimiters:
- Delimiter
- Binary Representation
- AX'2F'
- 00101111
- AC' '
- 01000000
- A#EOM
- 01001110
- ALPHA
- 11110000 (BNO)
- NUM
- 11110000 (BO)
Examples of illegal delimiters:
- Delimiter
- Explanation
- X'2F'
- Not preceded by an A.
- AX'CFA2'
- More than 1 byte defined.
- C' '
- Not preceded by an A.
- AC'@@'
- More than 1 byte defined.
- FALSE=errorloc
- This the symbolic location where control is to be transferred in the event
that the specified delimiter is not found; that is, if the maximum number
of characters has been scanned or moved. If this parameter is omitted,
return will be to the next sequential instruction with no other indication of
the error. The user could determine this, however, because the source
location register would not be pointing to the specified delimiter.
Entry Requirements
- R9 must contain the address of the ECB being processed.
- The source location register (R1 is default) must contain the address of
the first character to be edited.
- The destination location register (R14 is default) must contain the
address of the first position into which the significant characters are to be
moved.
- The significant character count register (R15 is default) must be free for
use. It is cleared by the macro and its contents are not saved.
Return Conditions
- When the maximum number of characters has been moved (MAX parameter) or
the scan exceeds the maximum source location address (MAXFROM parameter),
control is returned to either the location specified by FALSE parameter or to
the next sequential instruction (if the FALSE parameter is not used).
- The source location register (specified by the FROM parameter) will
contain the address of the specified stop delimiter in the character
stream. The delimiter is moved. If the delimiter is not found,
the register will contain the address of that character position, which is
equivalent to the first character position plus the maximum number of
significant characters scanned.
- The destination location register (specified by the TO parameter) will
contain the address into which the last character was moved if a stop
character was encountered; it will contain the address +1 if the maximum
number of significant characters was moved (MAX parameter) or the scan exceeds
the maximum source location address (MAXFROM parameter).
- The significant character count register (specified by the COUNT
parameter) will contain the number of significant characters moved (not
including the stop character).
- R1, R14, and R15 are the default registers used. However, the
programmer can explicitly state other registers when necessary.
- The condition code will be changed as a result of execution of this
macro.
Programming Considerations
Examples
The following is an example taken from segment WGA1:
* EDIT THE INPUT MESSAGE TO REMOVE ALL BLANKS AND CARRIAGE RETS
LA R14,MI0ACC
LR R1,R14
EDITA DELET1=AX'40',DELET2=A#CAR,FALSE=WGA1EB
* UPDATE ITEM LENGTH COUNTER TO REFLECT EDIT
LA R15,4(R15)
STH R15,MI0CCT
* IS THE INPUT MESSAGE THE PROPER LENGTH ?
.
.
.
WGA1EB MVI EBW044,X'01' INVLD FORMAT
In the previous example, CAR refers to the symbol for carriage
return.
The following example is taken from segment UIM1:
UIM1NZ EQU *
LA R0,MI0LNO R0=ADDRESS FIRST COUNTED BYTE
LH R1,MI0CCT R1=MESSAGE COUNT
AR R1,R0 R1=ADDRESS OF EOM+1
LA R0,MI0ACC R0=ADDRESS OF FIRST CHARACTER TEXT
SR R1,R0 R1=COUNT OF CHARACTERS TO BE SCANNED
LA R2,MI0ACC R2=FROM LOCATION
LR R7,R2
EDITA FROM=R2,TO=R7,DELET1=AC' ',DELET2=A#CAR,MAX=R1
LA R15,4(R15) ADJUST COUNT
STH R15,MI0CCT STORE COUNT