Sample DATEADD Specifications - 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
Example 1
Figure 1. Sample DATEADD Subparameter

Column 10 contains a Julian date in the form ddd-yyyy and 13 weeks are to be added to it to create the output field.

Example 2
Figure 2. Sample DATEADD Subparameter

Column 10 contains a Gregorian date in the form X’0yymmdds’ and 30 days are to be subtracted from it to create the output field.

Example 3
Figure 3. Sample DATEADD Subparameter

Column 10 contains a month/year date field in the form mmyyyy and 3 months are to be added to it to create the output field.

DATEDIFF   

Use DATEDIFF to compute the interval between two date values. It returns a numeric value that can be used in expressions or formatted with an EDIT pattern; the default formatting will be with mask M0 for 15 digits, generating a 16-byte field. The value is calculated by counting the number of unit boundaries between the two date values. There­fore, there is no rounding. For example, when unit is DAY, the value is the number of midnights between datefield1 and datefield2 - midnight is the boundary between one day and the next. Similarly, the week boundary is defined as midnight on Sunday; the month boundary is midnight of the last day of the month, and so on.

The following describes the DATEDIFF parameters:
datefield1
Contain the two date values to be used in the calculation.
datefield2

Date values may be date fields within the record, a hard-coded date, or the current system date, though each of the two fields need not be in the same format. Date fields within the record are specified in the same manner as the datefield in the DATEADD function, hardcoded dates must be of the form YYYY/MM/DD (length=10), and the current system date is indicated by &DATE.

If datefield1 is earlier than datefield2, the value is negative; otherwise, the value is positive. When there is invalid datefield data in either field, the value will be Z’999999999999999’, and an informational WER490I message will be issued. 

unit
Specifies the date unit to be used in calculating the difference between datefield1 and datefield2. Specify YEAR, QUARTER, MONTH, WEEK, or DAY. The date components required for the calculations should be present in both datefields. For MONTH, the month is required in each datefield. For WEEK and DAY, the day is required.