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



What helped me to figure it out is this statement:  "A date field always
knows what it is,  you never have to tell it".
 
---------------------------------
Booth Martin
http://www.martinvt.com
---------------------------------
-------Original Message-------
 
From: RPG programming on the AS400 / iSeries
Date: 06/21/05 11:56:33
To: RPG programming on the AS400 / iSeries
Subject: Re: Date conversion to Julian - RPG IV rookie..
 
Thanks Rick (and Scott).
 
DUH!  Reading (for the 12th time) from the RPG IV programmers reference:
 
"The second parameter is the date format for character or numeric input.
Regardless
of the input format, the output is returned in *ISO format."
 
Note the word INPUT, not output, so even the RTFM approach got past
these old eyes....
 
Thanks for re-stating the obvious for me (Hey! You'd make great
consultants......!)
 
Pete
 
 
 
Rick.Chevalier@xxxxxxxxxxxxxxx wrote:
 
>Pete,
>
>Your are right, the %Date statement is incorrect.
>
>In your post you have the value '05/28/2005' as the IFS field value.  If it
truly has the separators the statement should be
>
>jvDate = %Date(INvDate: *USA);
>
>If it doesn't have separators it would be
>
>jvDate = %Date(INvDate: *USA0);
>
>The date format parameter for the %Date BIF is the input date format not
the output format.  The output of %Date is always *ISO.  Assigning it to a
*JUL field causes it to be converted from *ISO to *JUL as well.
>
>Rick
>
>-----Original Message-----
>From: rpg400-l-bounces@xxxxxxxxxxxx
>[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Pete Helgren
>Sent: Tuesday, June 21, 2005 10:13 AM
>To: RPG Midrange Discussion
>Subject: Date conversion to Julian - RPG IV rookie..
>
>
>I thought this was going to be simple but.....
>
>I have an application that reads through IFS records, parses out fields
>and then writes them to a physical file using SQL.  I ran into an issue
>with the date.  It comes in as MM/DD/CCYY formatted text and I need to
>get it to a Julian date (actually a 5 digit number)  So I thought the
>following would work (/FREE):
>
>       INvDate = GetNextFld();  //This returns the next field in the IFS
>record. In this case lets assume that it returns '05/28/2005'
>
>       //convert the MM/DD/CCYY text to a julian date
>       // D spec on the jvDate field is:  D jvDate
>S              6D   DATFMT(*JUL)
>      // I get an error HERE at run time  RNX0112 - The Date, Time or
>Timestamp value is not valid
>          jvDate = %Date(INvDate:*JUL0);
>      // Then convert the Julian date to char equivalent
>          vDate = %Char(jvDate);
>
>I am suspecting that the runtime error is occurring because the program
>is assuming *ISO for the date format and it is coming in as *USA.  I
>just don't know how to tell  %Date built in that I am formatting a date
>FROM *USA to *JUL.  Do I need to add another step so that I first
>convert the character field to *USA date and THEN convert that to a *JUL
>format? Like:
>
>     InvDate = GetNxtfld();
>      USAdate = %date(INvDate: *USA);
>     jvDate = %Date(USADate:*JUL);
>
>Again, I am a little bit new to RPG IV (liking it though) so perhaps I
>am just using %Date wrong.....
>
>Thanks,
>
>Pete Helgren
>
>Privileged and Confidential.  This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information.  If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail.  You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.
>
>
>
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
 
 
.

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.