CEELOCT and CEEDATE information

CEELOCT and CEEDATE information

CEELOCT and CEEDATE are APIs that exist on the system.

You do not need to create them.

In essence, what the CL that I supplied  does is:

1)  Use the CEELOCT API to convert the current date to lillian.
2) Then you add or subtract the number of days you need from the lillian date.
3) Then you use CEEDATE to convert the new lillian date back to the date format that you wish, in this case, I used YYYYMMDD.

I have copied the descriptions of the API's from the Iseries Information Center
 (http://publib.boulder.ibm.com/pubs/html/as400/v4r5/ic2924/index.htm)

Get Current Local Time (CEELOCT) API
|--------------------------------------------------------------------------|
|                                                                          |
|                                                                          |
|                                                                          |
| Required Parameter Group:                                                |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                         1|
|          output_Lilian                                                   |
|                                                                       Out|
|                                                                       put|
|                      INT4                                                |
|                                                                         2|
|          output_seconds                                                  |
|                                                                       Out|
|                                                                       put|
|                      FLOAT8                                              |
|                                                                         3|
|          output_Gregorian                                                |
|                                                                       Out|
|                                                                       put|
|                      CHAR23                                              |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
| Omissible Parameter:                                                     |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                         4|
|                        fc                                                |
|                                    Output                                |
|                                                                     FEEDB|
|                                                                     ACK  |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
| Threadsafe: Yes                                                          |
|--------------------------------------------------------------------------|

The Get Current Local Time (CEELOCT) API returns the current local time in three formats: Lilian date (the number of days since 14 October 1582), Lilian timestamp (the number of seconds since 00:00:00 14 October 1582), and Gregorian character string (in the form YYYYMMDDHHMISS999'). These values are compatible with the other ILE date and time APIs and with existing language intrinsic functions. CEELOCT performs the same service, faster, than calling CEEUTC, CEEUTCO, and CEEDATM in succession.


Required Parameter Group


output_Lilian (output)
      A 32-bit binary integer representing the current local date in the
      Lilian format. That is, day 1 is 15 October 1582, day 148 887 is 4
      June 1990. If local time is not available from the system,
      output_Lilian is set to 0 and CEELOCT ends with a nonzero feedback
      code.


output_seconds (output)
      A 64-bit double floating point number representing the current local
      date and time as the number of seconds since 00:00:00 on 14 October
      1582. For example, 00:00:01 on 15 October 1582 is second number
      86 401 (24*60*60 + 01). 19:00:01.078 on 4 June 1990 is second number
      12 863 905 201.078. If local time is not available from the system,
      output_seconds is set to 0 and CEELOCT ends with a nonzero feedback
      code.


output_Gregorian (output)
      A 17-byte character string in the form YYYYMMDDHHMISS999 representing
      local year, month, day, hour, minute, second, and millisecond.


Omissible Parameter


fc (output)
      A 12-byte feedback code passed by reference. If specified as an
      argument, feedback information (a condition token) is returned to the
      calling procedure. If not specified and the requested operation was
      not successfully completed, the condition is signaled to the
      condition manager.


Feedback Codes and Conditions


                                                                           
 CEE0000                     The API completed successfully                
 Severity: 00                                                              
                                                                           
                                                                           
                                                                           
 CEE2502                     Local time not available                      
 Severity: 30                                                              
 
Usage Notes
      Use CEEUTC to determine Universal Time Coordinated (UTC).
      Use CEEUTCO to obtain the offset from UTC to local time.
      The character value returned by CEELOCT is designed to match that
      produced by existing language intrinsic functions. The numeric values
      returned can be used to simplify date calculations.
      If the format of output_Gregorian is inappropriate, CEEDATM can be
      used to convert output_seconds to any required format.


Example
      Extract current local date and time in the form YYYYMMDDHHMISS999:
      CALL CEELOCT (days, secs, localdatetime, fc);




Convert Lilian Date to Character Format (CEEDATE) API
|--------------------------------------------------------------------------|
|                                                                          |
|                                                                          |
|                                                                          |
| Required Parameter Group:                                                |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                         1|
|          input_Lilian_date                                               |
|                                                                     Input|
|                   INT4                                                   |
|                                                                         2|
|          picture_string                                                  |
|                                                                     Input|
|                   VSTRING                                                |
|                                                                         3|
|          output_char_date                                                |
|                                                                     Outpu|
|                                                                     t    |
|                   VSTRING                                                |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
| Omissible Parameter:                                                     |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                         4|
|              fc                                                          |
|                           Output                                         |
|                                                               FEEDBACK   |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
|                                                                          |
| Threadsafe: Yes                                                          |
|--------------------------------------------------------------------------|


The Convert Lilian Date to Character Format (CEEDATE) API formats a number representing a Lilian date. The output is a character string such as 1988/07/26.


Required Parameter Group


input_Lilian_date (input)
      A 32-bit binary integer representing the Lilian date, which is the
      number of days since 14 October 1582. For example, 16 May 1988 is day
      number 148 138. Valid range is 1 to 3 074 324 (31 December 9999).


picture_string (input by descriptor)
      A character string representing the desired format of
      output_char_date, for example MM/DD/YY. Each character in
      picture_string represents a character in output_char_date. If
      delimiters such as the slash (/) appear in the picture string, they
      are copied as is to output_char_date.


      Table 1 has a list of valid picture characters, and Table 2 contains
      examples of valid picture strings.


      If picture_string is null or blank, CEEDATE obtains picture_string
      based on the current job value for COUNTRY ID. For example, if the
      current job value for COUNTRY ID is US (United States), the date
      format is MM/DD/YYYY. If the current job value for COUNTRY ID is FR
      (France), the date format is DD.MM.YYYY.


      This default mechanism makes it easy for translators to specify the
      preferred date format, and also easy for application programs and
      library procedures to automatically use this format.


output_char_date (output by descriptor)
      A character string that is the result of converting input_Lilian_date
      to the format specified by picture_string. If necessary, output will
      be truncated to the length of output_char_date. Table 5 contains
      sample output dates. If input_Lilian_date is not valid,
      output_char_date is set to all blanks and CEEDATE ends with a nonzero
      feedback-code.


Omissible Parameter


fc (output)
      A 12-byte feedback code passed by reference. If specified as an
      argument, feedback information (a condition token) is returned to the
      calling procedure. If not specified and the requested operation was
      not successfully completed, the condition is signaled to the
      condition manager.


Feedback Codes and Conditions


                                                                           
 CEE0000               The API completed successfully                      
 Severity: 00                                                              
                                                                           
                                                                           
                                                                           
 CEE0501               The operational descriptor data type is not valid   
 Severity: 30                                                              
                                                                           
                                                                           
                                                                           
 CEE0502               Missing operational descriptor                      
 Severity: 30                                                              
                                                                           
                                                                           
                                                                           
 CEE2512               The value for the given Lilian date is not valid    
 Severity: 30                                                              
                                                                           
                                                                           
                                                                           
 CEE2518               The picture string specification is not valid       
 Severity: 30                                                              
                                                                           
                                                                           
                                                                           
 CEE2522               Lilian date outside of era                          
 Severity: 30                                                              
                                                                           
                                                                           
                                                                           
 CEE2526               Date truncated                                      
 Severity: 30                                                              
                                                                           
                                                                           
                                                                           
 CEE9902               Unexpected user error occurred in &1                
 Severity: 30                                                              
                                                                           
                                                                           
     Usage Notes
      The inverse of CEEDATE is CEEDAYS. The CEEDAYS API converts character
      dates to the Lilian format.
      If picture_string includes a Japanese era symbol <JJJJ>, the YY
      position in output_char_date is replaced by "year within Japanese
      era". Table 2 has an example. Table 3 contains a list of Japanese
      eras supported by CEEDATE.
      If picture_string includes a Republic of China (ROC) Era symbol
      <CCCC> or <CCCCCCCC>, the YY position in output_char_date is replaced
      by the year within ROC era. Table 2 has an example. Table 4 contains
      a list of ROC eras supported by CEEDATE.



Table 5. Sample Output of the CEEDATE API
|-----------+----------------------------+-------------------------------|
| input_Lili| picture_string             | output_char_date              |
| an_date   |                            |                               |
|-----------+----------------------------+-------------------------------|
| 148138    | YY                         | 88                            |
|           | YYMM                       | 8805                          |
|           | YY-MM                      | 88-05                         |
|           | YYMMDD                     | 880516                        |
|           | YYYYMMDD                   | 19880516                      |
|           | YYYY-MM-DD                 | 1988-05-16                    |
|           | YYYY-ZM-ZD                 | 1988-5-16                     |
|           | <JJJJ> YY.MM.DD            | Showa 63.05.16 (in a DBCS     |
|           | <CCCC> YY.MM.DD            | string)                       |
|           |                            | MinKow 77.05.16 (in a DBCS    |
|           |                            | string)                       |
|           |                            |                               |
|           |                            |                               |
|-----------+----------------------------+-------------------------------|
| 148139    | MM                         | 05                            |
|           | MMDD                       | 0517                          |
|           | MM/DD                      | 05/17                         |
|           | MMDDYY                     | 051788                        |
|           | MM/DD/YYYY                 | 05/17/1988                    |
|           | ZM/DD/YYYY                 | 5/17/1988                     |
|           |                            |                               |
|           |                            |                               |
|-----------+----------------------------+-------------------------------|
| 148140    | DD                         | 18                            |
|           | DDMM                       | 1805                          |
|           | DDMMYY                     | 180588                        |
|           | DD.MM.YY                   | 18.05.88                      |
|           | DD.MM.YYYY                 | 18.05.1988                    |
|           | DD Mmm YYYY                | 18 May 1988                   |
|           |                            |                               |
|           |                            |                               |
|-----------+----------------------------+-------------------------------|
| 148141    | DDD                        | 140                           |
|           | YYDDD                      | 88140                         |
|           | YY.DDD                     | 88.140                        |
|           | YYYY.DDD                   | 1988.140                      |
|           |                            |                               |
|           |                            |                               |
|-----------+----------------------------+-------------------------------|
| 148142    | YY/MM/DD HH:MI:SS.99       | 88/05/20 00:00:00.00          |
|           | YYYY/ZM/ZD ZH:MI AP        | 88/5/20 0:00 AM               |
|           |                            |                               |
|           |                            |                               |
|-----------+----------------------------+-------------------------------|
| 148143    | WWW., MMM DD, YYYY         | SAT., MAY 21, 1988            |
|           | Www., Mmm DD, YYYY         | Sat., May 21, 1988            |
|           | Wwwwwwwwww, Mmmmmmmmmm DD, | Saturday  , May        21,    |
|           | YYYY                       | 1988                          |
|           | Wwwwwwwwwz, Mmmmmmmmmz DD, | Saturday, May 21, 1988        |
|           | YYYY                       |                               |
|           |                            |                               |
|           |                            |                               |
|-----------+----------------------------+-------------------------------|


Example
      Convert a date from the Lilian format to IBM USA standard format
      MM/DD/YYYY:
      CALL CEEDATE (lildate, 'MM/DD/YYYY', usadate, fc);



 

Dig deeper on iSeries skills

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close