Hi Walter I'm not sure I see what your problem is. This is a good way of validating dates and I have used it often in production. Nowadays I use the datetime class rather than the date BIF, but I found some code that used the TIME BIF, that shows the principle.
HTH Jon ::routine good_time public use strict arg time, form = 'n' signal on syntax name bad_time t = time('n',time,form) signal off syntax RETURN .true bad_time: signal off syntax RETURN .false On Mon, 24 Jan 2022 at 21:27, WalterPachl via Oorexx-devel < oorexx-devel@lists.sourceforge.net> wrote: > Surprise of the day/nite; > > ---------- Ursprüngliche Nachricht ---------- > > Von: WalterPachl <pa...@chello.at> > > An: TSO REXX Discussion List <tso-r...@vm.marist.edu>, Irwin Poché < > ipo...@ix.netcom.com> > > Datum: 24.01.2022 22:22 > > Betreff: Re: [TSO-REXX] Validating Dates > > > > > > Try this and tell us what TSO says > > I am astonished that Regina reacts nicely and ooRexx does not > > > > signal on syntax > > userDate = "14/01/22" > > ok = date("B",userDate,"U") > > back: Say 'we are back' > > Exit > > syntax: > > Say 'C' condition('C') > > Say 'D' condition('D') > > Say 'E' condition('E') > > Say 'I' condition('I') > > Say 'S' condition('S') > > Signal back > > > > H:\>regina vd > > C SYNTAX > > D Error 40.19: DATE argument 2, "14/01/22", is not in the format > described by argument 3, "U" > > E 40.19 > > I SIGNAL > > S OFF > > we are back > > > > H:\>rexx vd > > C SYNTAX > > D > > 9 *-* Say 'E' condition('E') > > Error 40 running H:\vd.rex line 9: Incorrect call to routine. > > Error 40.904: CONDITION argument 1 must be one of ACDIORS; found "E". > > > > > > > Irwin Poché <ipo...@ix.netcom.com> hat am 24.01.2022 21:47 > geschrieben: > > > > > > > > > I have never used the CALL ON / SIGNAL ON handlers and I’m wondering > if they can be used to assist validating user inputed dates. > > > > > > The statement that would trigger the trap would be something like… > > > > > > userDate = “14/01/22” > > > ok = date(“B”,userDate,”U”) > > > > > > …where userDate ought to be a MM/DD/YY date. If it’s not, then the > exec is terminated with “Incorrect call to routine” > > > > > > The DATE function feels like the perfect way to validate dates if the > exec can be prevented from being terminated. > > > > > > I’ve used all the permutations of CALL ON / SIGNAL ON I can think of. > None are working so this looks like a dead end. > > > > > > If this is a dead end is there any simple way to validate a date ? > > > > > > -Irwin > > > > _______________________________________________ > Oorexx-devel mailing list > Oorexx-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/oorexx-devel >
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel