Generating Run-time Date and Time Constants - 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
Copyright
2024
First publish date
2010
Last updated
2024-11-06
Published on
2024-11-06T17:38:26.716054

You can insert the date and time, or the date with an offset, of your MFX run into your records. The table Run-time Constants shows the constants generated by the run-time date and time parameters.

A 'C' in the output format denotes a character constant. A 'P' denotes a packed decimal constant, which contains a positive sign and a leading zero when padding is necessary. A '(c)' in the parameter represents a separator character.

Optionally, you can create an offset of the current date. The offset takes the form {±}nnnn, where '+' indicates a date after the current date and '–' indicates a date before the current date. 'nnnn' is the date offset. The range is 0 to 9999, which represents the number of days to be added or subtracted from the current date; or 0 to 999, which represents the number of months to be added or subtracted from the current month for DATE2, DATE2P, or DATE2(c).

Table 1. Run-time Constants

Parameter 

Output

Length (Bytes)

&DATE [{±}nnnn]

C'mm/dd/yy'

8

&DATE1 [{±}nnnn]

C'yyyymmdd'

8

&DATE1(c) [{±}nnnn]

C'yyyycmmcdd'

10

&DATE1P [{±}nnnn]

P'yyyymmdd'

5

&DATE2 [{±}nnn]

C'yyyymm'

6

&DATE2(c) [{±}nnn]

C'yyyycmm'

7

&DATE2P [{±}nnn]

P'yyyymm'

4

&DATE3 [{±}nnnn]

C'yyyyddd'

7

&DATE3(c) [{±}nnnn]

   C'yyyycddd'

8

&DATE3P    [{±}nnnn]

P'yyyyddd'

4

&DATE4 [{±}nnnn]

C'yyyy-mm-dd-hh.mm.ss'

19

&DATE5 [{±}nnnn]

C'yyyy-mm-dd-hh.mm.ss.nnnnnn'

26

&DATE=(m1m2m3m4) [{±}nnnn]

(see description below table)

 

&DATENS=(xyz) [{±}nnnn]

(see description below table)

 

&TIME

C'hh:mm:ss'

8

&TIME1

C'hhmmss'

6

&TIME1(c)

C'hhcmmcss'

8

&TIME1P

P'hhmmss'

4

&TIME2

C'hhmm'

4

&TIME2(c)

   C'hhcmm'

5

&TIME2P

P'hhmm'

3

&TIME3

C'hh'

2

&TIME3P

P'hh'

2

&TIME=(hp)

(see description below table)

 

&TIMENS=(tt)

(see description below table)

 

&YDDD=(m1m2m3) [{±}nnnn]

(see description below table)

 

&YDDDNS=(m1m2) [{±}nnnn]

(see description below table)

 

&DATE=(m1m2m3m4)[{±}nnnn]

This form of the &DATE subparameter generates the cur­rent system date or date with offset and controls the formatting of the date. You can specify the position of the year, month, and day; specify a separator character; and choose between 2-digit and 4-digit year representation.

The positions m1 through m4 represent masks used to format the date. To specify the positions of the month, day, and year, replace the m1, m2 and m3 positions, 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). Replace the m4 position with a separator character.

For example, to print the date with the form yy-mm-dd, specify &DATE=(YMD-). For December 31, 1997, the date would appear as “97-12-31.”

The field for this form of &DATE requires 8 bytes for a 2-digit year representation and 10 bytes for a 4-digit year. The M, D, and Y or 4 may only appear once in the mask. All four positions must be specified.

Optionally, you can create an offset of the current date. See Generating Run_time Date and Time Constants for a description.

&DATENS=(xyz)[{±}nnnn]

This form of the &DATENS subparameter specifies that the cur­rent date or date with offset is to appear in the output record in the form 'xyz', where x, y, and z indicate the order in which the month, day, and year are to appear and whether the year is to appear as two or four digits. For x, y, and z, use M to represent the month (01-12), D to represent the day (01-31), Y to represent the last two digits of the year (for example, 02), or 4 to represent the four digits of the year (for example, 2002). M, D, and Y or 4 can each be specified only once.

For example, &DATENS=(DMY) would produce a date of the form 'ddmmyy' which on March 29, 2002, would appear as '290302'. &DATENS=(4MD) would produce a date of the form 'yyyymmdd' which on March 29, 2002, would appear as '20020329'. x, y, and z must be specified.

Optionally, you can create an offset of the current date. See Generating Run_time Date and Time Constants for a description.

&TIME=(hp)

This form of the &TIME subparameter generates the current system time of day and controls the formatting of the time. You can print the time in 24-hour or 12-hour formats and specify the separator character between the hours, minutes and seconds.

The format for 24-hour time is hhpmmpss, where hh represents the hour (00-23), mm represents minutes (00-59), ss represents seconds (00-59), and p represents the separator character as specified by p in the &TIME=(hp) subparameter.

The format for 12-hour time is hhpmmpss nn, where hh represents the hour (01-12), mm represents minutes (00-59), ss represents seconds (00-59), and p represents the separator character as specified by p in the &TIME=(hp) subparameter. The nn is “am” or “pm” as appropriate.

To select 12-hour mode specify h as 12; to select 24-hour mode specify h as 24. The p specification represents the character to use as a separator.

For example, to display the time in a 12-hour format with a period as a separator, specify &TIME=(12.). At 22:43:23 hours, the time would appear as “10.43.23 pm.”

The field for this form of the &TIME subparameter requires 8 bytes for the 24-hour format and 11 bytes for the 12-hour format.

&TIMENS=(tt)

This form of the &TIMENS subparameter specifies that the current time is to appear in the output record in the form 'hhmmss' (24-hour time) or 'hhmmss xx' (12-hour time). If tt is 24, the time is to appear in the form 'hhmmss' (24-hour time) where hh represents the hour (00-23), mm represents the minutes (00-59), and ss represents the seconds (00-59).

For example, &TIMENS=(24) would produce a time of the form 'hhmmss' which at 08:25:13 pm would appear as '202513'. If tt is 12, the time is to appear in the form 'hhmmss xx' (12-hour time) where hh represents the hour (01-12), mm represents the minutes (00-59), ss represents the seconds (00-59), and xx is either 'am' or 'pm'.

For a second example, &TIMENS=(12) would produce a time of the form 'hhmmss xx' which at 08:25:13 pm would appear as '082513 pm'.

&YDDD=(m1m2m3)[{±}nnnn]

This form of the &YDDD subparameter specifies that the cur­rent date or date with offset is to appear in the output record in the form of a year and day. You can specify the position of the year and day, specify a separator character, and choose between 2-digit and 4-digit year representation. The positions m1 through m3 represent masks used to format the date. To specify the position of the year and day, replace the m1 and m2 positions (in either position) with D for day (001-366) and either Y or 4 for the year (where Y is a 2-digit year and 4 is a 4-digit year). Replace the m3 position with a separator character.

For example, to print the date in the form yyyy/ddd, specify &YDDD=(4D/). For March 29, 2005, the date would appear as 2005/088.

Optionally, you can create an offset of the current date. See Generating Run_time Date and Time Constantsfor a description.

&YDDDNS=(m1m2)[{±}nnnn]

This form of the &YDDDNS subparameter specifies that the current date or date with offset is to appear in the output record in the form of a year and day. You can specify the position of the year and day and choose between 2-digit and 4-digit year representation. The positions m1 and m2 represent masks used to format the date. To specify the position of the year and day, replace the m1 and m2 positions (in either position) with D for day (001-366) and either Y or 4 for the year (where Y is a 2-digit year and 4 is a 4-digit year).

For example, to print the date in the form dddyy, specify &YDDDNS=(DY). For March 29, 2005, the date would appear as 08805.

For an example of an OUTREC control statement that generates run-time constants, see figure Sample OUTREC Control Statement.

Optionally, you can create an offset of the current date. See Generating Run_time Date and Time Constants on page 2-166 for a description.