Release the NEW Power of CL

Release the NEW Power of CL

Name:

Email:

Programming Services

Do you need a program written?

Bruce Vining Services can provide highly experienced IBM i developers to supplement your staff with short term contracts. We don't do general ledger but if you are looking for custom solutions involving system functions such as database, communications, security, encryption, print, and work management you will find your answers at Bruce Vining Services.

Retrieve Date Attributes PDF Print E-mail

Retrieve Date Attributes (RTVDATAXCL)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
Threadsafe: Yes
Parameters
Examples
Error messages

The Retrieve Date Attributes (RTVDATAXCL) command retrieves the date related attributes of either a date or timestamp parameter.

All date attributes are determined as if the Gregorian calendar had been in effect for the range of years 0001 to 9999.

Top

Parameters

KeywordDescriptionChoicesNotes
DATE Date or timestamp value Character value, *CURRENT Optional, Positional 1
FMT Date format *JOB, *MDY, *YMD, *DMY, *MDYY, *YYMD, *DMYY, *ISO, *USA, *EUR, *JIS, *CMDY, *CYMD, *CDMY, *JUL, *LONGJUL, *TS, *DTS, *EPOCH Optional
DAYOFWEEK Day of week as number (1 0) Decimal number Optional
DAYOFWEEKC Day of week as character (1) Character value Optional
DAYOFWEEKT Day of week as text (min 1) Character value Optional
DAYOFMON Day of month as number (2 0) Decimal number Optional
DAYOFMONC Day of week as character (2) Character value Optional
DAYOFYEAR Day of year as number (3 0) Decimal number Optional
DAYOFYEARC Day of year as character (3) Character value Optional
MONOFYEAR Month as number (2 0) Decimal number Optional
MONOFYEARC Month as character (2) Character value Optional
MONOFYEART Month as text (min 1) Character value Optional
YEAR Year as number (4 0) Decimal number Optional
YEARC Year as character (4) Character value Optional
LEAPYEAR Leap year Logical value Optional
Top

Date or timestamp value (DATE)

Specifies the date or timestamp value to be used when determining the date attributes.

*CURRENT
The current system date is used.
character-value
Specify the date or timestamp to be used. The format of this parameter is determined by the FMT parameter.
Top

Date format (FMT)

Specifies the format of the DATE parameter.

*JOB
The job date format attribute is used with a 2-digit year.
*MDY
The DATE parameter is formatted with a 2-digit month, a 2-digit day, and a 2-digit year. The use of date separators is optional.
*YMD
The DATE parameter is formatted with a 2-digit year, a 2-digit month, and a 2-digit day. The use of date separators is optional.
*DMY
The DATE parameter is formatted with a 2-digit day, a 2-digit month, and a 2-digit year. The use of date separators is optional.
*MDYY
The DATE parameter is formatted with a 2-digit month, a 2-digit day, and a 4-digit year. The use of date separators is optional.
*YYMD
The DATE parameter is formatted with a 4-digit year, a 2-digit month, and a 2-digit day. The use of date separators is optional.
*DMYY
The DATE parameter is formatted with a 2-digit day, a 2-digit month, and a 4-digit year. The use of date separators is optional.
*ISO
The DATE parameter is formatted with a 4-digit year, a '-', a 2-digit month, a '-', and a 2-digit year.
*USA
The DATE parameter is formatted with a 2-digit month, a '/', a 2-digit day, a '/', and a 4-digit year.
*EUR
The DATE parameter is formatted with a 2-digit day, a '.', a 2-digit month, a '.', and a 4-digit year.
*JIS
The DATE paramter is formatted with a 4-digit year, a '-', a 2-digit month, a '-', and a 2-digit day.
*CYMD
The DATE parameter is formatted with a 1-digit century, a 2-digit year, a 2-digit month, and a 2-digit day. A century value of 0 represents a year starting with '19', a century value of 9 represents a year starting with '28'. The use of date separators is optional.
*CDMY
The DATE parameter is formatted with a 1-digit century, a 2-digit day, a 2-digit month, and a 2-digit year. A century value of 0 represents a year starting with '19', a century value of 9 represents a year starting with '28'. The use of date separators is optional.
*CMDY
The DATE parameter is formatted with a 1-digit century, a 2-digit month, a 2-digit day, and a 2-digit year. A century value of 0 represents a year starting with '19', a century value of 9 represents a year starting with '28'. The use of date separators is optional.
*JUL
The DATE parameter is formatted with a 2-digit year and a 3-digit day. The use of date separators is optional.
*LONGJUL
The DATE parameter is formatted with a 4-digit year and a 3-digit day. The use of date separators is optional.
*TS
The DATE parameter is formatted as a 26-byte timestamp value. The format is 'YYYY-MM-DD-HH.MM.SS.mmmmmm'.
*DTS
The DATE parameter is formatted as an 8-byte system timestamp. A system time stamp is an 8-byte integer value often returned by system APIs.
*EPOCH
The DATE parameter is formatted as a 4-byte signed integer value representing the number of seconds since January 1 1970 at time 00:00:00. This 4-byte integer value is often returned by Unix-type system APIs.
Top

Day of week as number (1 0) (DAYOFWEEK)

Specifies the CL variable to receive the day of week as a numeric value. A value of 1 represents Sunday through a value of 7 which represents Saturday.

decimal-number
Specify a variable defined as Type(*Dec) with Len(1 0).
Top

Day of week as character (1) (DAYOFWEEKC)

Specifies the CL variable to receive the day of week as a character value. A value of 1 represents Sunday through a value of 7 which represents Saturday.

character-value
Specify a variable defined as Type(*Char) with Len(1).
Top

Day of week as text (min 1) (DAYOFWEEKT)

Specifies the CL variable to receive the day name as a character value. The CL variable can range in size from one (1) byte to one hundred (100) bytes. The returned value will be in the national language in effect for the job and in mixed case with the initial letter capitalized.

character-value
Specify a variable defined as Type(*Char).
Top

Day of month as number (2 0) (DAYOFMON)

Specifies the CL variable to receive the day of month as a 2-digit numeric value.

decimal-number
Specify a variable defined as Type(*Dec) with Len(2 0).
Top

Day of week as character (2) (DAYOFMONC)

Specifies the CL variable to receive the day of month as a 2-digit character value. Leading zeros will be returned.

character-value
Specify a variable defined as Type(*Char) with Len(2).
Top

Day of year as number (3 0) (DAYOFYEAR)

Specifies the CL variable to receive the day of year as a numeric value. A value of 1 represents January 1.

decimal-number
Specify a variable defined as Type(*Dec) with Len(3 0).
Top

Day of year as character (3) (DAYOFYEARC)

Specifies the CL variable to receive the day of year as a character value. A value of 001 represents January 1.

character-value
Specify a variable defined as Type(*Char) with Len(3).
Top

Month as number (2 0) (MONOFYEAR)

Specifies the CL variable to receive the month as a 2-digit numeric value.

decimal-number
Specify a variable defined as Type(*Dec) with Len(2 0).
Top

Month as character (2) (MONOFYEARC)

Specifies the CL variable to receive the month as a 2-digit character value. Leading zeros will be returned.

character-value
Specify a variable defined as Type(*Char) with Len(2).
Top

Month as text (min 1) (MONOFYEART)

Specifies the CL variable to receive the month name as a character value. The CL variable can range in size from one (1) byte to one hundred (100) bytes. The returned value will be in the national language in effect for the job and in mixed case with the initial letter capitalized.

character-value
Specify a variable defined as Type(*Char).
Top

Year as number (4 0) (YEAR)

Specifies the CL variable to receive the year as a 4-digit numeric value.

decimal-number
Specify a variable defined as Type(*Dec) with Len(4 0).
Top

Year as character (4) (YEARC)

Specifies the CL variable to receive the year as a 4-digit character value. Leading zeros will be returned.

character-value
Specify a variable defined as Type(*Char) with Len(4).
Top

Leap year (LEAPYEAR)

Specifies the CL variable to receive the leap year status for the date. If the CL variable is on ('1') the year is a leap year. If the CL variable is off ('0') the year is not a leap year.

logical-value
Specify the CL variable to receive the leap year status.
Top

Examples for RTVDATAXCL

Example 1: Retrieving the Current Day of Week

 

    Dcl &DayOfWeek  Type(*Char)  Len(10)
    RtvDatAXCL Date('11/02/2009') Fmt(*MDYY) +
                 DayOfWeekT(&DayOfWeek)

 

This command retrieves the day of the week for November 2 2009. The CL variable &DayOfWeek will be set to the value 'Monday'.

Example 2: Determining if a Year is a Leap Year

 

    Dcl &LeapYear   Type(*Lgl)
    Dcl &Year       Type(*Char)  Len(4)
    RtvDatAXCL Date('2009-11-02') Fmt(*ISO) LeapYear(&LeapYear) +
                 YearC(&Year)
    If         Cond(&LeapYear) Then(SndPgmMsg Msg(&Year *BCat +
                 'is a leap year'))
    Else       Cmd(SndPgmMsg Msg(&Year *BCat +
                 'is not a leap year'))

 

This command retrieves the leap year status and 4-digit character year for November 2 2009. A message is then sent indicating if the year is or is not a leap year.

Top

Error messages for RTVDATAXCL

*ESCAPE Messages

XCL5003
Parameter value &1 is not valid for format &2.
XCL9002
Function did not complete. See previously listed messages related to possible user errors.
XCL9003
Function did not complete. See previously listed messages for possible cause.
XCL9004
Function did not complete. See previously listed messages for possible cause.
Top
 
Joomla 1.5 Templates by Joomlashack