× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: *CYMD in ILE RPG
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Sat, 31 Jan 98 00:56:21 +1100

For your situation *CYMD is only suitable for moving character or numeric 
fields in the form CYYMMDD 
into a real date field.  It will not help you with a character or numeric field 
in the form YYMMDD.  
Your best approach when dealing with six or seven digit dates in character or 
numeric form is to use 
the same rules as the system; that is:

Years falling between 40 and 99 are treated as being in the 20th century (a 
prefix of 19) and years 
falling between 00 and 39 are treated as being in the 21st century (a prefix of 
20).

You could move the character or numeric representation into a date field and 
then EXTRACT the year 
portion.  The advantage to this approach is that if IBM decide to change the 
40-39 window it will be 
transparent to your code although it is likely to be a little slower than 
simply testing the date 
range.

See following excerpt from the ILE RPG/400 Reference:

 2.3.4.1  *CYMD Format

 | A 3-digit year representation is also supported for fields used by the
 | MOVE, MOVEL, and TEST operations only.  This support is provided for
 | compatibility with the system *CYMD format.  The 3-digit year format is:

   ’‘‘‘‘‘‘˜‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘˜‘‘‘‘‘‘‘‘‘‘‘‘‘˜‘‘‘‘‘‘‘˜‘‘‘‘‘‘‘‘‘‘‘‘‘“
 |  *CYMD CenturyYear/Month/Day        cyy/mm/dd      9    001/01/15   
   ”‘‘‘‘‘‘™‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘™‘‘‘‘‘‘‘‘‘‘‘‘‘™‘‘‘‘‘‘‘™‘‘‘‘‘‘‘‘‘‘‘‘‘•

 | where:

 |    Valid separators are / - . , & (the blank separator).
 |    Valid values for C are 0 (for the years 1940-1999) or 1 (for the years
 |     2000-2039).
 |    Valid values must fall between 040/01/01 to 139/12/31, where 040
 |     represents the year 1940 and 139 represents the year 2039.

 | Separators are optional for character fields in the *CYMD format.  To
 | indicate that there are no separators you can specify *CYMD0.

And a bit more ....

 |    The format *CYMD is allowed in factor 1.  *CYMD0 can be specified in
 |     factor 1 if the source or target is a character field with no
 |     separators.  (For more information on *CYMD format see "*CYMD Format"
 |     in topic 2.3.4.1.)

 |    A two-digit year format (*MDY, *DMY, *YMD, and *JUL) or a three-digit
 |     year format (*CYMD or *CYMD0) can only represent dates in the range
 |     1940 through 2039.  An error will be issued if conversion to a two- or
 |     three-digit year format is requested for dates outside this range.

Regards,
Simon Coulter.

//----------------------------------------------------------
// FlyByNight Software
// AS/400 Technical Specialists
// Phone: +61 3 9419 0175
// Fax:   +61 3 9419 0175
// Mob:   +61 3 0411 091 400
// Email: shc@flybynight.com.au
//--- forwarded letter -------------------------------------------------------
> X-Mailer:  Microsoft Exchange Server Internet Mail Connector Version 
>4.0.995.52
> Date: Fri, 30 Jan 98 01:29:39 +0100
> From: "Michael Hill" <MHILL@csi.co.nz>
> To: "'MIDRANGE-L@midrange.com'" <MIDRANGE-L@midrange.com>
> Reply-To: MIDRANGE-L@midrange.com
> Cc: "'chanh_le@countrywide.com'" <chanh_le@countrywide.com>
> Subject: RE: *CYMD in ILE RPG

> 
> Thanks for that:
> 
> What we are trying to do is get the century from a date e.g. 290198
> 
> Can I still use *CYMD
> 
> Michael Hill
> Centurion Ltd
> 

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.