COZZI - Retrieve/Convert Date (RTVDATE)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
  • Batch ILE CL module (*BMOD)
  • Interactive ILE CL module (*IMOD)
Threadsafe: No
Parameters
Examples
Error messages

Retrieve and Convert Date (RTVDATE) Help

Retrieve and Convert Date - Help

The RTVDATE command allows you to retrieve a date in a user-specified date format. Most formats are supported, including just about any combination of Y, M and D on the RTNFMT (return format) parameter.

Use this command to retrieve a date, such as today's date or to convert a date to another format. For example, to retrieve tomorrow's date and have that date returned to your CL program in YYYYMMDD format:

RTVDATE RTNDATE(&TOM) RTNFMT(*YYMD) DATE(*TOMORROW)

This will return tomorrow's date in YYYYMMDD format to the CL variable specified on the RTNDATE parameter.

Top

Parameters

Keyword Description Choices Notes
RTNDATE CL variable for returned date Not restricted Required, Positional 1
RTNFMT Format of returned date Character value, *JOB, *MDY, *DMY, *YMD, *JUL, *MDYY, *DMYY, *YYMD, *CYMD, *ISO, *USA, *EUR, *JIS, *LONGJUL, *JDEJUL, *DDMMMYY, *DDMMMYYYY, *CL, *DATETIME, *DTS, *DTSTEXT, *MDYTEXT, *DAY, *LONGDAY, *ISO0, *USA0 Optional, Positional 2
DATE Date to retrieve Element list Optional, Positional 3
Element 1: Date or symbolic date value Date, *JOB, *JOBSTART, *JOBSBMDATE, *RUNDATE, *SYSVAL, *YESTERDAY, *TOMORROW, *CURRENT, *SYSTEM, *TODAY, *BOM, *EOM, *MONTHSTR, *MONTHEND
Element 2: Time or symbolic time value Time, *CURRENT
WHEN Adjust date WHEN Single values: *NONE
Other values: Element list
Optional, Positional 4
Element 1: Returned Date is *ALL, *SUN, *MON, *TUE, *WED, *THU, *FRI, *SAT, *WEEKDAY, *WEEKEND, *BOM, *EOM, *MONTHSTR, *MONTHEND
Element 2: Then return the *THIS, *NEXT, *PRV, *PREV, *FIRST, *LAST, 1, 2, 3, 4, 5, *BOM, *EOM, *MONTHSTR, *MONTHEND
Element 3: Relative Day *SUN, *MON, *TUE, *WED, *THU, *FRI, *SAT, *DAY, *WEEKDAY, *BOM, *EOM, *MONTHSTR, *MONTHEND
DUR Add duration to returned date Single values: *NONE
Other values: Element list
Optional, Positional 5
Element 1: Duration Integer
Element 2: Duration code *DAYS, *MONTHS, *YEARS, *DAY, *MONTH, *YEAR, *D, *M, *Y
Top

Returned Date (RTNDATE) parameter

Specify a CL return variable to receive the date value. The format and length of this varibable is interpreted at runtime by the COZTOOLS system. The date value it converted into the same TYPE and LEN specified on the CL variable DCL statement and returned to the program. Therefore any valid *CHAR or *DEC CL variable may be specified.

Top

Returned Date Format (RTNFMT) parameter

Specify the format of the date as it should be returned to the CL variable specified on the RTNDATE parameter. The following special formats are provided for easy selection, however any combination of the CEEDATM API's date and time picture format codes may be used, including: For Date values: YY, YYYY, MM, MMM, DD, WWW, Mmm, Www, Wwwwwwwwwz, Mmmmmmmmmz, etc. For Time values: HH, MI, and SS to indicate hours, minutes and seconds. The letters AM and PM may also be used. See the CEEDATM API for a list of valid format combinations.

*JOB
Returns the date in Job Date format
*MDY
Month Day Year (2-digit year portion)
*DMY
Day/Month/Year (2-digit year portion)
*YMD
Year/Month/Day (2-digit year portion)
*JUL
YYDDD (Julian Date format)
*MDYY
Month Day Year (4-digit year portion)
*DMYY
Day/Month/Year (4-digit year portion)
*YYMD
Year/Month/Day (4-digit year portion)
*ISO
Year/Month/Day (4-digit year/Same as *YYMD)
*USA
Month/Day/Year (4-digit year/Same as *MDYY)
*EUR
Day/Month/Year (4-digit year/Same as *DMYY)
*JIS
Year/Month/Day (4-digit year/Same as *YYMD and *ISO)
*LONGJUL
YYYYDDD (long julian date with 4-digit year)
*JDEJUL
CYYDDD (JD Edwards (julian) Date Format)
*DAY
WWW (The Day of the week in 3-characters, MON, TUE, WED, etc.)
*LONGDAY
Wwwwwwwwwz (The Day of the week: full name)
Top

Date and Time to Return (DATE) parameter

Specify the date to be returned to the RTNDATE parameter. The date specified here is converted to the format on the RTNFMT parameter. The DATE parameter consists of the date and time.

Date

Date Value: Specify a date in job-date format to convert to the format specifed on the RTNFMT parameter. The following special value may be used instead of an actual date value:

*JOB
Job Run Date
*JOBSTART
Job Start Date
*CURRENT
Deprecated--same JOB run date.
*SYSVAL
System Date: Same as SYSVAL(QDATE)
*YESTERDAY
Yesterday's date (based on current system date)
*TOMORROW
Tomorrow's date (based on current system date)
*BOM
Beginning of month for the current date
*EOM
End of month for the current date
*MONTHSTR
Same as *BOM but compatible with WRKJOBSCDE
*MONTHEND
Same as *EOM but compatible with WRKJOBSCDE

Time

Time Value to return. Specify any valid Time in HHMMSS or HH:MM:SS format. The time is returned when the RTNFMT parameter contains time-element formatting characters.

*CURRENT
Current system time is returned.
time
Any valid time value may be specified.
Top

Relative Date Adjustment (WHEN) parameter

Use this parameter when the original date being returned needs to be adjusted for example, when it falls on a weekend, the end of month or a specific day of the week. The returned date is modified based on the values specified for this parameter.

Returned Date is...

Specify a day of week, symbolic date or *ALL to adjust the returned date when this returned date is this value.

Then return...

Specify a relative operator for the new returned date value. This element is used with the Relative Day element to adjust the date being returned.

*THIS
Return the next date that falls on the day specified on the Relative day element of this parm. If the base date falls on that day then the base date is returned. Otherwise the first date that follows the base date that falls on the Day specified is returned.
*NEXT
Return the next date that falls on the day specified on the Relative Day portion of the DATE parameter. If "today" is that day, then the date for next week's day is returned.
*PRV
Return the data for the previous day specified on the DAY portion of DATE parameter.
*FIRST
Return the date of the first day of the month whose date matches the day specified on the Day portion of the DATE parameter.
*LAST
Return the date of final day in the month whose date matches the day specified on the Day portion of the DATE parameter.
*BOM
Return the date of first day in the month for the date specified the DATE portion of the DATE parameter.
*EOM
Return the date of last day in the month for the date specified the DATE portion of the DATE parameter.

Relative Day (date) to be returned

Specify a day of the week or one of of the symbolic dates to be returned when the original returned date WHEN condition is meet. This element is used with the "Then Return" element to produce the date being returned. The following values are allowed:

*SUN, *MON, *TUE, *WED, *THU, *FRI, *SAT
*WEEKDAY, *EOM, *BOM
Top

Date Duration (DUR) parameter

Specify a numeric value that is added as a duration to the date specified on the DATE portion of the DATE parameter. This parameter consists of two parts:

Duration

For the DURATION portion, specify the quantity of the duration. The following special value is allowed for the DURATION:

*NONE - No duration is added to the date before it is returned.

(+/-)99999 - The number of days or months or years to add to the date before it is returned. Specify a positive or negative value.

Duration Code

For the DURATION CODE portion, specify the context of the duration. The following values are allowed for the DURATION CODE portion:

*DAYS
*MONTHS
*YEARS
Top

Examples

None
Top

Error messages

Unknown
Top