#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
- 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.
- 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:
Before the conversion: R14 contains X'0000F394'.
R15 points to EBW000.
The length is 8.After the conversion: R14 is overwritten.
EBW000 contains C' 62356'.
R15 points to EBW000+8.L R14,CONS1 LA R15,EBW000 #CONS INPUT=R14,TO=R15,LENGTH=8 : CONS1 DC X'0000F394' - In the following example:
Before the conversion: R14 contains X'0000F394'.
R15 points to EBW080.
The length is 4.After the conversion: R14 is overwritten.
EBW080 contains C'2356'.
R15 points to EBW080+4.L R14,CONS2 LA R15,EBW080 #CONS INPUT=R14,TO=R15,LENGTH=4 : CONS2 DC X'0000F394' - In the following example:
Before the conversion: R14 contains F'355'.
R15 points to EBW040.
The length is 7.After the conversion: R14 is overwritten.
EBW040 contains C' 355'.
R15 points to EBW040+7.L R14,CONS3 LA R15,EBW040 #CONS INPUT=R14,TO=R15,LENGTH=7 : CONS3 DC F'355'
