How to Convert Numeric Data - mfx - 3.1

Syncsort™ MFX Programmers Guide

Product type
Software
Portfolio
Integrate
Product family
Syncsort™ Software
Product
Syncsort™ MFX > MFX
Version
3.1
Language
English
Content type
Programmer’s Guide
Product name
Syncsort™ MFX
Title
Syncsort™ MFX Programmers Guide
Topic type
How Do I
2024
First publish date
2010
Last edition
2024-08-27
Last publish date
2024-08-27T08:14:56.318001

One of the most important functions of OUTREC processing is to convert a numeric data field or an expression to either an output numeric data format or a printable format with editing capabilities. OUTREC processing can convert 2-digit year fields into 4-digit year fields, as well as any 2-digit or 4-digit year full-date field into any other full-date field, including conversion between Julian and Gregorian formats. For details on converting 2-digit year data, see Converting Year Data with Century Window Processing on INREC, OUTREC, or OUTFIL OUTREC. When a single numeric field defined by p,l,fi is to be converted to a printable format without editing, the format and length of the field determine the length of the output field, as illustrated in the following two tables.

Table 1. Data Conversion Table

Data Conversion

Input Format

Bytes in Input Field

Resulting Digits (d)

ZD

n

n

PD

n

2n-1

BI, FI

1

3

BI, FI

2

5

BI, FI

3

8

BI, FI

4

10

BI, FI

5

13

BI, FI

6

15

BI, FI

7

17

BI, FI

8

20

CSF or FS

n=1 to 16

n (to maximum of 15, then truncated)

CSF or FS

n=17 to 32

n (to maximum of 31, then truncated)

FL

4 or 8

20

PD0

n

2n-2 digits

SFF, UFF

n

n (to maximum of 31,then truncated)

Y2C, Y2P, Y2S, Y2Z

2

4 digits

Y2B, Y2D

1

4 digits

Y2ID

1

2 bytes

Y2IP

2

3 bytes

For full-date formats, the number of bytes in the input field can vary. The following table shows input lengths for full-date formats and the resulting output length:

Table 2. Data Conversion Table – Full-Date Formats

Input Format

Bytes in Input Field

Resulting Digits (d)

Y2T

3

5

4

6

5

7

6

8

Y2U

2

5

3 7

Y2V

3

6

4

8

Y2W

3

5

4

6

5

7

6

8

Y2X

2

5

3

7

Y2Y

3

6

4

8

Y4T

7

7

8

8

Y4W

7

7

8

8

Y4U

4

7

Y4V

5

8

Y4X

4

7

Y4Y

5

8

For any other type of expression (those that are not a simple p,l,fi), MFX internally maintains a 31-digit number. The number of digits that are used for conversion or editing depends upon the lengths of the fields used in the expression. For more information, see the description of expression in the section The following describes the c: subparameter.

If all fields in the expression conform to the following, then 15 digits will be used. If any field in the expression exceeds these length values, 31 digits will be used for editing or conversion. Note that full-date formats in an expression (not a simple p,l,f) are treated as providing a 15-digit value when evaluating the following rules.

Table 3. Field Lengths That Produce a 15-Digit Default Output Length

Fields in the expression

Input Field Length

CSF/FS format fields

1 to 16 bytes

SFF/UFF, AUF/ASF format fields

1 to 15 bytes

BI/FI fields

1 to 4 bytes

PD fields

1 to 8 bytes

ZD fields

1 to 15 bytes

Decimal constants

1 to 15 significant digits

If you specify no other FIELDS subparameters, the result will be converted to printable output according to the default editing mask, M0. See Mm Subparameter (Editing Masks). Other forms of printable output can be created by using the EDIT, LENGTH, Mm, and SIGNS subparameters, which allow you to create your own edit patterns, or by using one of the 27 MFX-supplied editing masks, which are appropriate for many editing operations.

To convert to a numeric data field, specify an output format of BI, CSF/FS, FD, FI, PD, PDC, PDF, ZD, ZDC or ZDF. The default output field length is determined for CSF/FS, PD, PDC, PDF, ZD, ZDC and ZDF formats by table Default Output Lengths. For BI and FI formats, use Output Lengths for BI and FI Formats when Input is a Single p,l,fiField. For FD, use Output Lengths for FD Fields..

The number of digits (d) in the following table is obtained from column 3 of Data Conversion Table for an expression that is a single p,l,fi field. For any other type of expression (not a single p,l,fi), d is either 15 or 31 based upon the fields in the expression. If all fields in the expression conform to the lengths in table Field Lengths That Produce a 15-Digit Default Output Length, then d is 15. If any are longer, d is 31.

Table 4. Default Output Lengths

Output Format

Default Output Length (bytes)

CSF/FS

d+1

PD, PDC, PDF

d/2+1

ZD, ZDC, ZDF

d

For BI or FI fields, when the field to be converted is a single p,l,fi field, the default output length is either 4 or 8 bytes depending upon the format and length of the field to be converted. See table Output Lengths for BI and FI Formats when Input is a Single p,l,fiField to determine the default length.

Table 5. Output Lengths for BI and FI Formats when Input is a Single p,l,fiField

Input Format and Length

Default Output Length (bytes)

BI or FI from 1 to 4 bytes

4

BI or FI from 5 to 8 bytes

8

CSF/FS from 1 to 16 bytes

4

CSF/FS from 17 to 32 bytes

8

FL either 4 or 8 bytes

8

PD from 1 to 8 bytes

4

PD from 9 to 16 bytes

8

SFF/UFF, AUF/ASF from 1 to 9 bytes

4

SFF/UFF, AUF/ASF from 10 to 44 bytes

8

ZD from 1 to 15 bytes

4

ZD from 16 to 31 bytes

8

These lengths can be overridden by specifying the LENGTH parameter.

For any other type of expression (those that are not simple p,l,fi), the output length when converting to BI or FI is based upon the number of digits available for output. If all fields in the expression conform to the lengths in table Field Lengths That Produce a 15-Digit Default Output Length, then d is 15. If any are longer, d is 31. When the number of digits available is 15, the output length will be 4. When the number of digits is 31, the output length will be 8.

The table Output Lengths for FD Fields displays the formats that can be converted to FD and the default output lengths.

Table 6. Output Lengths for FD Fields

Input Format and Length

Default FD Format Output Length (bytes)

BI or FI from 1 to 4 bytes

8

BI or FI from 5 to 8 bytes

16

CSF/FS from 1 to 16 bytes

8

CSF/FS from 17 to 32 bytes

16

FL either 4 or 8 bytes

16

PD from 1 to 8 bytes

8

PD from 9 to 16 bytes

16

SFF/UFF, AUF/ASF from 1 to 15 bytes

8

SFF/UFF, AUF/ASF from 16 to 44 bytes

16

ZD from 1 to 15 bytes

8

ZD from 16 to 31 bytes

16

If a LENGTH parameter is specified with a conversion to an FD format, only 4, 8 and 16 bytes are allowed.

The following five sections describe the data conversion capabilities:
• Converting Year Data with century window processing on INREC, OUTREC, or OUTFIL OUTREC

• The EDIT Subparameter

• The LENGTH=n Subparameter

• The Mm Subparameter (Editing Masks)

• The SIGNS Subparameter