Function Field Subparameters - 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
Copyright
2024
First publish date
2010
Last edition
2024-08-27
Last publish date
2024-08-27T08:14:56.318001

The function fields allow you to insert a sequence number into your output record, to add or subtract values from date fields, to compute the difference between two date fields, and perform other date field functions.

The figure below illustrates how the function subparameters should be specified and describes their function,
Figure 1. Function Field Subparameters

SEQNUM

Use SEQNUM to create a sequence number field within the output record. The length of the field can be from 1 to 16 bytes and can be represented in either BI, PD, or ZD formats. A starting value and an increment can be specified for the field. In addition, the sequence numbering can be restarted when the value in a specified field changes.

The following describes the SEQNUM variables and parameters:
l

Represents the length in bytes of the field to be created. A value from 1 to 16 can be specified.

f

Indicates the format of the field to be created. BI, PD, or ZD can be specified to create an unsigned binary field, a packed decimal field, or zoned decimal field, respectively.

START

Optionally specifies a starting number n for the field. The n value can be 0 through 2,147,483,647. The default is 1.

INCR

Optionally specifies a value i that indicates how sequence numbers should be incremented. The i value can be 1 through 65,535. The default is 1.

RESTART Optionally specifies that the sequence numbering is restarted when the value in the RESTART field changes. The value of n specified in the START parameter is used to restart the numbering sequence. p represents the position of the first byte of the field. h is the length of the field and can be from 1 to 256 bytes. Alternatively, a parsed field %pp may be specified. A binary comparison is performed on the field.

The maximum sequence number generated is limited to 15 decimal digits or the output field length. If a number is reached that would exceed the limit, MFX truncates the high order digit and continues processing. Thus, sequence numbers will cycle within the limit. So, if the output is a 2-byte ZD field, 99 will be the highest sequence number. The next number, 100, will have its high-order digit truncated. The resulting number, 00, starts a new sequence number cycle from 00 to 99, regardless of the START value.

DATEADD

Use DATEADD to add or subtract units of days to or from an input record date field and create an output record date field in the same format with the same length. The results of DATEADD are considered to be a character string and not a number. Thus they cannot be used where a numeric field could be used, for example, in an arithmetic expression or with an EDIT pattern or mask.

The following describes the DATEADD parameters:
datefield

Defines a date field in the input record. The format may be printable or packed, with or without a separator, containing either a 2-digit or 4-digit year, and either a Julian day, quarter, or month/day. If a 2-digit year is specified,CENTWIN processing will be used to determine a 4-digit year, but the final result will only contain a 2-digit year. The field is defined by specifying a position and length followed by the DT, DTNS, or DTNSP parameter. The field length must be exactly what is implied by the mask specifications.

When there is invalid data, the output field will contain Z’9999...’ for a printable field or X’9999...C’ for a packed field.

p,l,DT[=({m1m2m3m4,m1m2m4})]

DT is used for printable fields with separators. Position and length of the input field are followed by the DT parameter which describes the input format. For day/month/year fields, m1

through m3 are replaced, in any order, with M for the month (01-12), D for the day (01-31), and either Y or 4 for the year (where Y is a 2-digit year and 4 is a 4-digit year); m4 designates the separator character. For quarter/year, month/year and Julian day/year, just specify m1m2 in any order, with Y or 4 for the year and either Q for the quarter, J for the 3-digit Julian day or M for the month; m4 designates the separator character. If the mask specification is omitted, a mask of ‘MDY/ ’ will be assumed.

p,l,DTNS[=({m1m2m3,m1m2})]
DTNS is similar to DT, but is used for printable fields without separators. If the mask specification is omitted, a mask of ‘MDY’ will be assumed.
p,l,DTNSP[=({m1m2m3,m1m2})]
DTNSP is similar to DTNS, but is used for packed decimal fields without separators. Fields are assumed to contain a trailing sign which is ignored. If the mask specifies an even number of digits for the date, then the input field is assumed to contain a leading halfbyte of zeros which is ignored.
number
Specifies the number of date units to be added to or subtracted from the input date. Specify a positive number to add or a negative number to subtract. The absolute value of the number is limited to 9999 for DAYs and WEEKs and 999 for MONTHs, QUARTERs and YEARs.
unit
Specifies the date unit for the calculation. If the mask includes a day/month, then specify DAY, WEEK or YEAR as the unit. If the mask includes a Julian day, then specify DAY or WEEK as the unit. If the mask includes a quarter or month without a day, then specify MONTH, QUARTER or YEAR as the unit.