#CONT: Convert binary to character binary
Use this macro to generate inline code to convert a binary number in the low-order byte of a register to character binary. A character binary number is a binary number represented in a string that contains only EBCDIC 0 or 1.
Note: See Table 1 for a summary of all the
conversion macros.
Last updated
Changed in 2024 (information only; no code change).
- Changed for PUT11.
- Changed for PUT08.
- Changed for PUT07.
- Changed for PUT05.
- Changed for PUT00.
Format
- INPUT=reg1
- Specifies a register, reg1, that contains the binary number to convert.
- TO=reg2
- Specifies a register, reg2, that points to the location that will contain the converted value.
- ON=C'onchar'
- Specifies the character used to represent binary 1 in the output string, where onchar is the character.
- OFF=C'offchar'
- Specifies the character used to represent binary 0 in the output string, where offchar is the character.
- WORK=workarea
- Specifies one of the following work areas based on the addressing mode:
- A 5-byte work area in 31-bit addressing mode.
- A 9-byte work area in 64-bit addressing mode.
Entry requirements
None.
Return conditions
- The contents of reg1 are overwritten during the conversion process.
- reg2 points to the next available byte following the output string.
The contents of the area referenced by
the WORK parameter are unpredictable.
Programming considerations
- If AMODE=64 is coded on the BEGIN macro, all 8 bytes of a register are used.
- For information about macro register conventions, see Assembler program register conventions.
- 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.
Examples
- In the following example,
Before the conversion: R14 contains F'43'.
R15 points to EBW000.
ON is 1 and OFF is 0.After the conversion: R14 is overwritten.
EBW000 contains C'00101011'.
R15 points to EBW000+8.L R14,CONT0 SET UP BINARY VALUE LA R15,EBW000 WHERE TO PLACE #CONT INPUT=R14,TO=R15,ON='1',OFF=C'0',WORK=CE1ARS : CONT0 DC F'43' BINARY VALUE (X'2B') - In the following example,
Before the conversion: R14 contains X'ABF1FF23'.
R15 points to EBW030.
ON is 1 and OFF is 0.After the conversion: R14 is overwritten.
EBW030 contains C'00100011'.
R15 points to EBW030+8.L R14,CONT1 SET UP BINARY VALUE LA R15,EBW030 WHERE TO PLACE #CONT INPUT=R14,TO=R15 LOW-ORDER BYTE TO BINARY : CONT1 DC X'ABF1FF23' BINARY VALUE - In the following example:
Before the conversion: R14 contains F'241'.
R15 points to EBW010.
ON is '*' and OFF is '-'.After the conversion: R14 is overwritten.
EBW010 contains C'****---*'.
R15 points to EBW010+8.L R4,CONT2 SET UP BINARY VALUE LA R15,EBW010 WHERE TO PLACE #CONT INPUT=R14,TO=R15,ON=C'*',OFF=C'-' LOW-ORDER BYTE TO BINARY : CONT2 DC F'241' BINARY VALUE (X'F1')
