#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.

Format

Read syntax diagramSkip visual syntax diagram#CONTINPUT= R14INPUT= reg1,TO= R1,TO= reg2,ON= C'1',ON= C' onchar',OFF= C'0',OFF= C' offchar',WORK= CE1ARS,WORK= workarea
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 a 5-byte work area.

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.

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.
  • All SPM conditional expressions can be no more than 128 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')