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



Thank you for the test code...

Comments below...

On 5 Jan 2015 at 23:14, Booth (Booth Martin <rpg400-l@xxxxxxxxxxxx>) commented
about Re: Converting a date:

Did you comment the data structure?
Yes

How about, just to see where the problem lies:

D TestField s 10A
C eval TestField = '01'
+ '06'
+ '20'
+ '15'
C eval DTEOFHIRE = %date(TestField: *usa0)
C eval DTEOFHIRE = %date(('01'
+ '06'
+ '20'
+ '15'): *usa0)
C eval DTEOFHIRE = %date(%char(X)
C + %char(EmpDay2)
C + %char(EmpCentury)
C + %char(EmpYear2): *usa0)

In Debug:
TESTFIELD = '01062015 '
Just as I would expect. With two extra spaces at the end.
DTEOFHIRE = '01/06/2015'
From the first Eval DTEOFHIRE. I didn't expect the slashes since it has *usa0 but it
did work.
I did get the error:
Date, Time or Timestamp value is not valid
On the last Eval DTEOFHIRE.

I thought there might be something wrong with the %Char BIF
So I changed the Month, Year and Century to Alpha fields.
Then I changed the code to:
C eval TestField = Mo
C + EmpDay
C + EmpCentury
C + EmpYear
C eval DTEOFHIRE = %date(TestField: *usa0)

This worked. There must be a problem with the %date BIT at V5R3 when it has more
than one field . They must have fixed it in latter version.

Thanks for the suggestions.

Gary
I would expect a result of "01/06/2015". Then, during debug, you may
see where it fails.

Two things: I messed up with mdy0; also, I am not sure where the %date
bif was in v5r3.



On 1/5/2015 10:29 PM, Gary Kuznitz wrote:
Thank you very much for the suggestions



In Debug mode:
X = 01.
EMPDAY2 = 15.
EMPCENTURY = 20.
DTEOFHIRE = '01/01/0001'

I modified it slightly and tried this code:

C eval DTEOFHIRE = %date(%char(X)
C + %char(EmpDay2)
C + %char(EmpCentury)
C + %char(EmpYear2): *mdy0)
EMPYEAR2 = 01.

I get the same error.

The only thing I can think that I might be doing wrong is I have this H
statement in the
program:
H OPTION(*SRCSTMT : *NODEBUGIO)DATFMT(*USA)

Thanks,

Gary

--
This is the RPG programming on the IBM i (AS/400 and 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 ...

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.