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



On a subprocedure parameter, specifying the date format keyword, DATFMT(*ISO)
for example, causes the date passed on that parameter to be sent to the
subprocedure in *ISO format (assuming CONST or VALUE is also specified). This
allows people that have dates in non-*ISO format (in this example) to pass those
dates to the subprocedure without first copying them to another format.

Try declaring a date parameter of a subprocedure as *USA format, and then pass
in a *YMD format date value. Make sure the date parameter does not have CONST or
VALUE specified. Then add CONST or VALUE and try it again.

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



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Booth Martin
Sent: Thursday, February 08, 2007 1:28 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Date conversion technique, alpha to Numeric

I am about to show my stupidity.  Isn't there a QSYSVAL for a system's 
default date format?

But more importantly, please expand on your last comment.  Can't a date 
be passed as a parameter?  Why does one need a DATFMT for that?


Bob Cozzi wrote:
In database if you use DATFMT you get that result in your queries and SQL.
In RPG IV, everything is pretty much converted to *ISO format when its brought
into the program.
In RPG IV, you can declare a field as any date format you want to have default
conversion to that format when moving it to a non-date field.
Today, except for passing parameters, it is true that the usability of the
DATFMT keyword in defining date fields is nearly worthless.


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



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Booth Martin
Sent: Thursday, February 08, 2007 12:50 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Date conversion technique, alpha to Numeric

Yes, except for the part about defining the file's field as a date type 
  with a DATFMT.  Why would anyone do that?  That seems to me to be 
degrading the appeal of a date field.

Joe Pluta wrote:
From: Booth Martin

Then I misunderstood this sentence: "it's a conversion from the file's
*MDY format to your *ISO program format."
When the file is read in from the database, the buffer that is passed to the
caller has a date field in it.  That date field is formatted in the manner
specified by the DATFMT keyword on the field definition.  However, if you
then specify an I-spec for that field with a DIFFERENT format, RPG will then
convert the buffer data (which is itself a conversion from the 4-byte
internal format) into the format you specified.

Make sense?

Joe





As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.