#CONS: Convert a binary 31-bit number to character decimal with leading zero suppression

Use this macro to generate inline code to convert a 31-bit binary number to character decimal with leading zeros changed to leading blanks.

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

Read syntax diagramSkip visual syntax diagram#CONS INPUT=R14INPUT= reg1,TO=R1,TO= reg2,LENGTH=4,LENGTH= maxval,WORK=CE1ARS,WORK= workarea
INPUT=reg1
Specifies a register, reg1, that contains the 31-bit binary number to be converted.
TO=reg2
Specifies a register, reg2, that points to the location that will contain the converted value.
LENGTH=maxval
Specifies the length of the resulting character decimal string, where maxval is the length.
You can specify a maximum value of 15 for the LENGTH parameter.
WORK=workarea
Specifies an 8-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.
  • If the length specified is too short, the result is truncated to the left. If the length specified is longer than the input string, the result is padded to the left with blanks (X'40').
  • 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:
             L     R14,CONS1
             LA    R15,EBW000
             #CONS INPUT=R14,TO=R15,LENGTH=8
              :
    CONS1    DC    X'0000F394'
    
  • In the following example:
             L     R14,CONS2
             LA    R15,EBW080
             #CONS INPUT=R14,TO=R15,LENGTH=4
              :
    CONS2    DC    X'0000F394'
    
  • In the following example:
             L     R14,CONS3
             LA    R15,EBW040
             #CONS INPUT=R14,TO=R15,LENGTH=7
              :
    CONS3    DC    F'355'