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



I agree with Alan about using/allowing ONE date format only. What you
can do is adding a label that indicates the format that the program
wants right next to/above/under the entry field, such as (mm/dd/yy).
This way, user will know actually what format the program is asking for.


However, if your user insists on allowing multi format, I think below
might work (Assuming that you will have to convert it into a date
later). Also be aware that 1/1/2008 is not a valid USA format. It must
be entered as 01/01/2008.:

D UNTIL_LEAVE c const('1')
D screenDate s 10
D myDateInChar s 10 varying
D myDate s D

/free

dow UNTIL_LEAVE;
myDate = *loval;
myDateInChar = %trim(screenDate);

//try *mdy no seperator
monitor;
myDate = %date(myDateInChar :*mdy0);
leave;
on-error;
endmon;

//try *mdy with seperator
monitor;
myDate = %date(myDateInChar :*mdy/);
leave;
on-error;
endmon;

//try *USA no seperator
monitor;
myDate = %date(myDateInChar :*usa0);
leave;
on-error;
endmon;

//try *USA with seperator
monitor;
myDate = %date(myDateInChar :*usa/);
leave;
on-error;
endmon;

//try *ISO no seperator
monitor;
myDate = %date(myDateInChar :*iso0);
leave;
on-error;
endmon;

//try *ISO with seperator
monitor;
myDate = %date(myDateInChar :*iso);
leave;
on-error;
endmon;

//try *eur with seperator
monitor;
myDate = %date(myDateInChar :*eur);
leave;
on-error;
endmon;

leave;
enddo;

if myDate = *loval;
//invalid date
endif;


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Shore
Sent: Wednesday, May 14, 2008 12:45 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Date verification with multiple values on Green Screen


Somewhat agree with you Eric.
Where I differ is that you want the users to choose the format to input.
In my experience when talking to a user with respect to date formats, no
matter which format that user uses on a day to day basis in their
everyday life, the only response I get is a vacant stare, and if I
squint my eyes hard enough, I can see a thought bubble appear above
their head with the words "WHAT THE @!$#^&&&& IS HE TALKING ABOUT?"
My suggestion (for what its worth) choose one particular format and
force the users to enter any date in that format. Use EDTMSK in the DDS
screen for the separators to make it look somewhat pretty, and validate
the date based upon this ONE format.



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
"If you're going through Hell, keep going" - Winston Churchill




"DeLong, Eric"

<EDeLong@Sallybea

uty.com>
To
Sent by: "RPG programming on the AS400 /

rpg400-l-bounces@ iSeries" <rpg400-l@xxxxxxxxxxxx>

midrange.com
cc



Subject
05/14/2008 01:33 RE: Date verification with
multiple
PM values on Green Screen





Please respond to

RPG programming

on the AS400 /

iSeries

<rpg400-l@midrang

e.com>









I think you've opened the can-o-worms with this one... This is similar
to the name-parsing question from a few weeks ago....

Ok, so I am a user of this app, and I enter 060708 (six digit date).
How would your program ever determine if this is *MDY, *YMD, or *DMY?
You cannot... Eight digit dates are not much better...

Using date seperator values with an eight digit date format might work
ok, as long as the users always use the correct seperator character for
the format being entered... So, '05/06/2007' could be processed as
format *USA (month 05, day 06), where '05.06.2007' could process as
format *EUR (month 06, day 05).... Probably not reasonable for the
users to always know which seperator value to use.

I do not think this requirement to accept date input in multiple formats
will add value to your application. More likely, it will cause a great
deal of grief when the program mis-identifies the correct format and
gets your months and days mixed up.

I might recommend a second field where the users can select the date
format they will be using for this session.

hth,
Eric

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Doug Palme
Sent: Wednesday, May 14, 2008 11:22 AM
To: RPG Midrange L
Subject: Date verification with multiple values on Green Screen


I need to allow the users to enter any of the following values as a
valid date type on a display file:

010108 // Six digit date

20080101 // eight digit ISO date type

01012008 // eight digit USA date type

01/01/2008 // ten digit USA date type

I thought I could check the length of the field coming in, so if
anything is other than 6,8, or 10 it is automatically an invalid
date...that part is easy......

I wanted to check for a valid date value with the TEST(DE) but it seems
that will not work either since even though 010108 is tested as

TEST(DE) *MDY DateField;

It generates an error...which I am assuming is because the field is a
10a and not a 6,0.

So I would need to check and make sure that it is also numeric for the 6
and 8 digit entries correct?

I know, it sounds crazy, but that is what I have been instructed to
do......


This transmission may contain information that is privileged,
confidential and/or exempt from disclosure under applicable law. If you
are not the intended recipient, you are hereby notified that any
disclosure, copying, distribution, or use of the information contained
herein (including any reliance thereon) is STRICTLY PROHIBITED. If you
received this transmission in error, please immediately contact the
sender and destroy the material in its entirety, whether in electronic
or hard copy format.
Thank you.
--
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.



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

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.