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



Vern,

You can try the CEE date apis.

CEEDAYS (Convert character date to lilian date)
CEEDATE (Convert lilian date character date)

I don't remember what data type or format is in the table so I'm going to assume 8S 0.

1. Convert the table value to 8A.
2. Call CEEDAYS to convert the value to a lilian date.
3. Call CEEDATE to convert the lilian date to whatever date format you want.
4. Set the display file value.

For the edit you follow the same essential steps.

1. Get the screen value to a character value.
2. Call CEEDAYS to convert to lilian date. If an error then something was keyed incorrectly.
3. Call CEEDATE to conver the lilian date to whatever date format you want.
4. Put the date to the database.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Monday, September 16, 2013 12:58 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Date, Time or Timestamp value is not valid. received in DSPF - need alternative

Hi Eric

I gave things a try - initialized the on-screen date field with d'1940-01-01' before the EXFMT.

I didn't put anything into either field and still get the error. This doesn't seem what MAPVAL is supposed to do, but OK.

I think I'll go back to the numeric field for now - have to get this done!!

Thx
Vern

On 9/16/2013 11:31 AM, DeLong, Eric wrote:
Hi Vern,

How about this? I use this to properly initialize the on screen date fields...

A VFLTDTBEG L B 5 32DATFMT(*MDY)
A COLOR(WHT)
A MAPVAL(('01/01/40' *BLANK))

Hth,
-Eric DeLong

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Monday, September 16, 2013 11:27 AM
To: RPG programming on the IBM i / System i
Subject: Date, Time or Timestamp value is not valid. received in DSPF
- need alternative

Oh it has been awhile! I am working on a change to a screen, to enter
dates. Database field is packed 8,0 - no, don't ask why I don't change
it to a date type!

I have the display field defined as a date type, formatted as *MDY -
here's the I-spec of the compile listing.

317 316=I *MDY/D 164 171 CBKDAT

The *MDY formatting is because I don't have enough real-estate horizontally.

The dump SPLF says the error occurred in statement 316 - that's the
I-spec you see above, so far as I know.


I get this error if I leave this field "blank" on the screen - it is
not required when creating a new item - a collections call note, in this case.

The dump also says the value for CBKDAT is '0001-01-01' - that's
*LOVAL for a date - also the default, IIRC. It shows nothing (blanks)
in the input or output buffer.

I suspected that the error comes because that default date is not in
the range for an MDY date. So I put in a date like that - no error.


So I need a way to leave that field empty without getting this error.
The date in storage will be a packed data type, anyhow.


***UPDATE*** OK - I just rearranged the screen vertically, to get
space
- and set the date format to *USA. I want the user to have a familiar
way of entering dates - they are used to MDY without separators, but
seeing the separators is requested.

I still get the error on this CBKDAT field when I don't put anything
there - it is shown with the default in the dump I requested.

I just tried entering 1/1/0001 - that it took as valid. When I leave
the screen field empty, it still gets the error. So is it the lack of
a value in the input buffer that is the issue?


My shortest path to success is to use the old 6-digit number with a Y
edit code and maybe the EDTMSK to protect the slashes.

But I welcome a solution to actually using the DATE type field on-screen.

TIA
Vern

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