bdfs1m0p | Structured Programming Macros |
Use this macro to generate inline code to convert a character
decimal number to a binary value. A character decimal number is a
number represented in a string that contains only EBCDIC 0-9.
- Note:
- See Table 1 for a summary of all the conversion macros.
Format
Notes:
- If you do not specify the MAX parameter, the maximum number of characters
defaults to 16 bytes.
- INPUT=reg1
- specifies a register, reg1, that points to the start of the
string to convert.
- TO=reg2
- specifies a register, reg2, that will contain the converted
binary value. Do not use R0 for reg2.
- MAX=reg3
- specifies a register, reg3, that contains a binary number
indicating the maximum number of characters to convert. Leading zeros
(C'0') in the input string are ignored. You can specify a
maximum of 16 bytes.
- WORK=workarea
- specifies a 16-byte work area.
Entry Requirements
None.
Return Conditions
- reg1 points to the next byte following the last byte that was
converted.
- reg2 contains one of the following:
- The resulting binary value.
- X'FFFFFFFF', if the first character is not numeric; for
example, the string C'A94732'.
- X'FFFFFFFF', if more than 9 digits following any leading zeros are
specified; for example, the string C'1234567890'.
- The contents of reg3 are overwritten during the conversion
process.
Programming Considerations
- You can specify the parameters for this macro in any order.
- All labels used in the SPM conditional expression can be no more than
32 characters long. Any additional characters are
truncated.
- This macro converts the input string only up to the first nondigit
character. For example, if the input string contains
C'789B2', the macro converts only C'789', and
reg1 points to B.
Examples
- In the following example:
Before the conversion:
|
R14 points to CONB0, which contains C'12713971'.
R15 contents are unknown.
R0 contains 8.
|
After the conversion:
|
R14 points to CONB0+8.
R15 contains X'C1FFF3'.
R0 contents are overwritten.
|
LA R14,CONB0 SET UP INPUT ADDRESS
LA R0,8 SET UP INPUT LENGTH
#CONB INPUT=R14,TO=R15,MAX=R0 EBCDIC-STRING TO BINARY
:
CONB0 DC C'12713971' DECIMAL INPUT STRING
- In the following example:
Before the conversion:
|
R14 points to CONB4, which contains C'789B2'.
R15 contents are unknown.
R0 contains 16.
|
After the conversion:
|
R14 points to CONB4+3.
R15 contains X'00000315'.
R0 contents are overwritten.
|
LA R14,CONB4 SET UP INPUT ADDRESS
LA R0,16 SET UP INPUT LENGTH
#CONB INPUT=R14,TO=R15,WORK=EBX024,MAX=R0
:
CONB4 DC C'789B2' DECIMAL INPUT STRING
Related Macros
#CONH-Convert Character Hexadecimal to Binary.