× 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.



"Easy" is in the eye of the beholder.

The merits of using a Data Structure vs. Built-in Functions for things in
general is what you're talking about. 

But the request was to convert an 8-digit date to a 6-digit date. Neither value
is actually a "date" however, so it was more of a data manipulation question. 

There are myriad ways to do what was requested, some "faster" than the others.
The Data Structure approach is certainly one I would use in RPGIII and maybe in
languages like C where you don't have strong built-in date conversion tools. 

If I were him, I would have used the QWCCVTDT API method as I know API is always
going to work, (and it uses Data Structures as parameters, so that might make
the "always use DS" crowd happy <tic>). 

The real question in my mind is one of style and perspective. Is the code
obvious, is it intuitive, can it be easily changed, and does it always work? 

I see tons-O-examples in this and other forums that works in only one specific
or rare situation and thus, should only be used in case of a fire. The bigger
questions are, will it always work and can it be easily changed?
I think changing *ISO to *USA or *MDY to *DMY is easy enough to do, and may
apply to others monitoring this list, such as the non-North American RPG IV
programmers. After all, not everyone views dates in *MDY format.


-Bob Cozzi
www.i5PodCast.com
Ask your manager to start watching i5 TV


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of endofthetrail@xxxxxxxxxxx
Sent: Wednesday, February 07, 2007 6:44 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: Date conversion technique, alpha to Numeric

will take an 8 pos. character 
date and return a 6 numeric.

Maybe I am too simplicity or still stuck in the "golden - oldies" era
of RPG, but if you wish to put CCYYMMDD to an YYMMDD, use MOVE or
define it in a data structure with YYMMDD as a subset of CCYYMMDD.. 
It is quick, simple and easy.

Eurrat Saylor, Jr.

---- Original Message ----
From: bob@xxxxxxxxxxxx
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: Date conversion technique, alpha to Numeric
Date: Tue, 6 Feb 2007 15:38:37 -0600


There are many ways to do this.
On is to call the QWCCVTDT API. This gives you the most flexibility.
Another you can use a bunch of nested built-in functions, similar to
the
following:

   YYMMDD = %Dec(%date(CCYYMMDD: *ISO0):*YMD);

-Bob Cozzi
www.i5PodCast.com
Ask your manager to start watching i5 TV



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Mike Berman
Sent: Tuesday, February 06, 2007 3:29 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Date conversion technique, alpha to Numeric

HI I searched the archives but could not find an ILE routine that
will take an 8
pos. character date and return a 6 numeric. At some point, the extra
2 are to be
dropped.they are the left most so we are going from a CCYYMMDD to a
YYMMDD.
  
 I would like to use Procedure for this.
  
 thanks,
 Mike



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.