E Dates

This chapter contains these topics:

E.1 About Date Programs

JD Edwards World uses four key RPG programs to work with dates in the system.

  • X0027 is used to calculate a new date from a reference date.

  • X0028 is the primary date formatting program which converts dates from Julian to Gregorian or Gregorian to Julian.

  • X0035 determines the difference in days between two dates or can calculate the second date given one date and the difference in days

  • X98DAY determines the day of the week and the day and month names for a given date.

E.1.1 Date Formats

Julian Format

The JD Edwards World Julian (*JUL) format is CYYDDD where:

  • C is the value added to 19 to create the century (0=>19, 1=>20).

  • YY is the year within the century.

  • DDD is the day in the year which can range from 001 to 731(next year).

For Example:

  • 098185 is July 4, 1998

  • 100001 is Jan 1, 2000

  • 099666 is Oct 27, 2000

Gregorian Formats

The JD Edwards World Gregorian formats are *MDY, *DMY, and *YMD where:

  • M represents the 2 character month

  • D represents the 2 character day

  • Y represents the 2 or 4 character year

Note:

Edited means punctuation such as: 12/31/98, 22.11.45, or 2000-01-01.

E.2 X0027

X0027 is an RPG program the system uses to calculate a new date from a reference date including *TODAY. The interval can be + or -, the unit can be *DAY, *WEEK, *MONTH, or *YEAR.

The information here is intended to cover the usual usage of this program. The source code has samples and more documentation. Specifically, *FORMULA is used to pass a string like "*TODAY + 1".

E.2.1 Using X0027

The reference date must be scrubbed (usually copy module C0012) before being passed to X0027. X0027 calls x0028 which uses the Data Dictionary item #CYR to establish the last year of the floating 100-year business window. See the X0028.

#CYR DD default Digits entered = (*MDY) Julian date = CYYDDD IBM QRY = (no leading 0's)
10 01/01/10 110001 (2010) 110,001
10 12/31/11 011365 (1911) 11,365
30 07/29/55 055241 (1955) 55,241
60 07/29/55 155241 (2055) 155,241
98 09/14/98 198257 (2098)! 198,257
97 09/14/98 098257 (1998) 98,257

E.2.2 Parameters

The parameters to pass to X0027 are ALL type Alpha. If the calling program is written in CL, be sure the variables are *CHAR.

The first parameter will accept a 4 digit year, for example 01011999(MMDDCCYY).

You must pass the first 8 parameters. If you want the day of the week and that day name, pass 10 parameters.

Parameter Description
$SIDAT $SIDAT is a 25 character field which can be any format as long as it agrees with the From format. To fetch today's date use *TODAY (+/- optional) and use *FORMULA in $FFMT.
$CENT $CENT is a 2 character field which should be sent blank.
$FFMT $FFMT is an 8 character field describing the FROM format. The usual values will be *JUL, *MDY, *DMY, *YMD, *SYSVAL or *FORMULA. See the program code for other allowed values.
$OFSET $OFSET is the 6 character number (+/-) of the units you have chosen in parameter 5.
$INTVL $INTVL is the 8 character calendar unit used to calculate the number of days. The usual values are *DAY, *WEEK, *MONTH or *YEAR. See the program code for other allowed values.
$SODAT $SODAT is a 6 character field which will contain the output date. This date will need to be passed to X0028 for any editing. It should be sent blank.
$TFMT $TFMT is an 8 character field describing the TO format. The usual values will be *JUL, *MDY, *DMY, *YMD, or *SYSVAL. See the program code for other allowed values.
RTNCDE RTNCDE is a single character error code. A '1' will be placed in this in this field if X0027 receives an invalid parameter. Your program should check this field right after the call to X0027.
$DAY# (Optional) $DAY# is a one character field for the day name, 1 = Sunday, 2 = Monday, and so on.
$DAY$ (Optional) $DAY$ is a ten character field which, if it is sent, will have the day name loaded.

E.3 X0028

X0028 is the primary JD Edwards World date formatting program. Briefly, it is an RPG program which converts dates from Julian to Gregorian or Gregorian to Julian. It will do some editing, but that is not its purpose. This program will NOT convert edited dates to unedited.

E.3.1 Using X0028

The edited date must be scrubbed (usually copy module C0012) before being passed to X0028. The Data Dictionary item that X0028 uses is #CYR. It establishes the last year of the floating 100-year business window.

#CYR DD default Digits entered = (*MDY) Julian date = CYYDDD IBM QRY = (no leading 0's)
10 01/01/10 110001 (2010) 110,001
10 12/31/11 011365 (1911) 11,365
30 07/29/55 055241 (1955) 55,241
60 07/29/55 155241 (2055) 155,241
98 09/14/98 198257 (2098)! 198,257
97 09/14/98 098257 (1998) 98,257

If the 2 digits for the year are less than or equal to #CYR, a 1 will be placed in the Julian century field so that when it is added to 19, a century of 20 will result.

Caution:

Setting #CYR to 60 so that your business will go from 1961 to 2060 means entering a date of birth for 07/29/55 will be converted to 2055. Setting #CYR to 98 means you have a range from 1999 to 2098. Think about it!

In the prior paragraph, the stored Julian values were shown. Once the data has been stored in the file, no comparison or decision is necessary. The value of the century digit is added to 19 and the rest of the data will be used to compute the day and month. Remember, when displaying a file with QRY, the leading zero will not be displayed. DSPPFM will show you all the digits.

E.3.2 Parameters

The parameters to pass to X0028 are ALL type Alpha. If the calling program is written in CL, be sure the variables are *CHAR.

If you do not need 4 position years, pass the first 6 parameters. If you need a 4 position year, pass all 10 or 11 parameters.

Parameter Description
$SIDAT $SIDAT is a 6 character field which can be any format as long as it agrees with the From format field and has only digits from 0-9 or is all zeros. X0028 moves the converted unedited date back into this field.
#EDAT #EDAT is the 8 character edited field. It has two extra positions to allow for the #SEP characters inserted by X0028. It will have the format specified by #TFMT. X0028 blanks this field upon receipt.
#FFMT #FFMT is a 7 character field describing the FROM format. It can be *SYSVAL, *JUL, *MDY, *DMY, or *YMD.
#TFMT #TFMT a 7 character field describing the TO format. It can be *SYSVAL, *JUL, *MDY, *DMY, or *YMD.
#SEP #SEP is a 7 character field for the separator character to be used in editing the date. It can be *SYSVAL, *NONE, blank or a single editing character like '-', '/' or '.'.
$ERTST $ERTST is a single character error code. A '1' will be placed in this in this field if X0028 receives an invalid date or invalid data. Your program should check this field right after the call to X0028.
$CTRY (Optional) $CTRY is a two character field which will contain the century, 19 or 20. It should be sent with blanks.
#FJPN (Optional) #FJPN is a one character field used for Japanese Era dates.
#TJPN (Optional) #TJPN is a one character field used for Japanese Era dates.
#EDAT2 #EDAT2 is a 10 character field used for edited dates with 4 digits for the year. You MUST use this parameter if you want a 4 digit year date. It has two extra positions to allow for the #SEP characters inserted by X0028. It will have the format specified by #TFMT.
#SIDT2 #SIDT2 is an optional 8 character field intended for use with 4 digit year dates. It can be any format as long as it agrees with the From format field and has only digits from 0-9. If this parameter is used and the from format is Julian, the Julian date needs to be loaded here with 2 leading zeros and #SIDAT should be loaded with zeros. X0028 moves the converted unedited date back into this field as well as #SIDAT.

E.4 X0035

X0035 is an RPG program which determines the difference in days between two dates or can calculate the second date given one date and the difference in days. It uses X0028 for date conversion.

E.4.1 Using X0035

The Data Dictionary item that X0028 uses is #CYR. It establishes the last year of the floating 100-year business window. See X0028.

E.4.2 Parameters

The parameters to pass to X0035 are ALL type Alpha. If the calling program is written in CL, be sure the variables are *CHAR.

Parameter Description
#SIDA1 #SIDA1 is a 6 character date field which can be any format as long as it agrees with the #SIFM1 format and has only digits from 0-9. It can be sent as blanks if a reverse date is to be calculated from #SIDA2.
#SIDA2 #SIDA2 is a 6 character date field which can be any format as long as it agrees with the #SIFM2 format and has only digits from 0-9. It can be sent as blanks if a forward date is to be calculated from #SIDA1.
#SIFM1 #SIFM1 is a 7 character field describing the #SIDA1 format. It can be *SYSVAL, *JUL, *MDY, *DMY, or *YMD.
#SIFM2 #SIFM2 is a 7 character field describing the #SIDA2 format. It can be *SYSVAL, *JUL, *MDY, *DMY, or *YMD.
#SITYE #SITYE is a one-character field which is used when calculating the difference in days between two dates. It is usually sent blank. If the difference between two dates is to be calculated, a blank means one date is subtracted from the other. If this field is a 1, a 1 is added to the difference so that the beginning and ending date are included in the count. If this field is a 2, a 1 is subtracted from the difference which means neither date will be included in the count.
$ERTST $ERTST is a one character field which should be sent blank. It will contain a 1 if two blank dates are sent, an invalid format is sent, or X0028 finds a problem with either date.
$#X $#X is a 9 character field which contains the number of day difference to be calculated between #SIDA1 and #SIDA2. If #SIDA1 is blank, the reverse date will be placed in #SIDA1. If #SIDA2 is blank, the future date will be placed in #SIDA2.
#SICT1 (Optional) #SICT1 is a 2 character century field for #SIDA1.
#SICT2 (Optional) #SICT2 is a 2 character century field for #SIDA2.

E.5 X98DAY

X98DAY is an RPG program which determines the day of the week and the day and month names for a given date. It uses X0028 for date conversion.

E.5.1 Using X98DAY

The Data Dictionary item that X0028 uses is #CYR. It establishes the last year of the floating 100-year business window. See the User's Guide for X0028.

Note:

X98DAY only works inside this 100-year window.

E.5.2 Parameters

The parameters to pass to X0035 are ALL type Alpha. If the calling program is written in CL, be sure the variables are *CHAR.

Parameter Description
#SIDAT #SIDAT is a 6 character field which can be any format as long as it agrees with the From format field and has only digits from 0-9.
#SIFMT #SIFMT is a 7 character field describing the FROM format. It can be *SYSVAL, *JUL, *MDY, *DMY, or *YMD.
#SIDAY #SIDAY is a 29 character field which will contain the converted day name, month name, day and year. If an 'A' is sent in this field, the month and day abbreviations will be used for a maximum size of 17 characters.
#SNDAY #SNDAY is a one character field which will contain the number for the day of the week, 1 = Sunday, 7 = Saturday.
#SOFMT #SOFMT is a 16 character field which is used to send an override output format. The edit codes are MM, DD, YY, YYYY, AM and AD where AM and AD are the abbreviated month and day names. The entries can be separated by comma, :, ., /, or a blank.