ITOZ: Converting a Number to Zoned Format

How to:

Available Languages: reporting, Maintain

The ITOZ function converts a number in numeric format to zoned-decimal format. Although a request cannot process zoned numbers, it can write zoned fields to an extract file for use by an external program.

Syntax: How to Convert a Number to Zoned Format

ITOZ(length, in_value, output)

where:

length

Integer

Is the length of in_value in bytes. The maximum number of bytes is 15. The last byte includes the sign.

in_value

Numeric

Is the number to be converted, or the field that contains the number. The number is truncated to an integer before it is converted.

output

Alphanumeric

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

Example: Converting a Number to Zoned Format

The following request creates an extract file containing employee IDs and salaries in zoned format for a COBOL program:

DEFINE FILE EMPLOYEE
ZONE_SAL/A8 = ITOZ(8, CURR_SAL, ZONE_SAL);
END
TABLE FILE EMPLOYEE
PRINT CURR_SAL ZONE_SAL BY EMP_ID
ON TABLE SAVE AS SALARIES
END

The resulting extract file is:

NUMBER OF RECORDS IN TABLE= 12 LINES= 12 
 
ALPHANUMERIC  RECORD  NAMED  SALARIES 
FIELDNAME                          ALIAS         FORMAT        LENGTH 
EMP_ID                             EID           A9              9 
CURR_SAL                           CSAL          D12.2M         12 
ZONE_SAL                                         A8              8 
TOTAL                                                           29