Page 1 of 1

validate YYYYMMDD and HHMMSS

Posted: Wed Mar 16, 2011 10:33 am
by ingsic
Need to validate
if the following formats are correct:


YYYYMMDD
Date:
if isValid ('DATE', StringToDate (StageVar, "% yyyy% mm% dd")) Then StageVar else 0

HHMMSS
Time

isvalid (HH: MM: SS)

Please confirm if it is correct

Posted: Wed Mar 16, 2011 11:08 am
by eph

Posted: Wed Mar 16, 2011 12:48 pm
by ingsic
ok

but yet need to validate if the following formats are correct:

HHMMSS

isvalid (HH: MM: SS)

thanks

Posted: Wed Mar 16, 2011 2:02 pm
by jwiles
IsValid("time",timestring)

Where timestring is in the format HH:MM:DD (or the default format if different).

Regards,

Posted: Wed Mar 16, 2011 4:07 pm
by ray.wurlod

Code: Select all

IsValid(inLink.TheTimeString, "%hh%nn%ss")
will be appropriate if there are no delimiters.

Posted: Wed Mar 16, 2011 5:54 pm
by jwiles
For 8.1? Not FP1, at least

Posted: Wed Mar 16, 2011 7:45 pm
by ray.wurlod
For 8.0.1 (at least according to the manual) and therefore, presumably, for 8.1.
Parallel Job Developer's Guide (8.0) wrote:result (int8) = IsValid(type (string) [, format (string)])
(page 601)

Posted: Wed Mar 16, 2011 11:15 pm
by jwiles
The 8.1 docs have the same entry (and so do the 7.5.1a docs), but I think it was a typo that never got corrected. It should be (IMHO)

Code: Select all

result (int8) = IsValid(type (string), string (string))
With type being one of the datatypes and string being the value being validated. At least that is what the transformer derivation validator allows.

When I run this derivation:

Code: Select all

IsValid("120101","%hh%nn%ss")
I get this message and a result of 0:

Code: Select all

APT_CombinedOperatorController,1: Expected identifier; got: "120101"
That's on two different 8.1 FP1 systems, one RedHat and one AIX.

c'est la vie :?

Posted: Wed Mar 16, 2011 11:47 pm
by ray.wurlod
D'accord.

Posted: Thu Mar 17, 2011 1:15 am
by jwiles
I tried the third option in 8.1 as well and it wouldn't pass validation.

validate

Posted: Wed Apr 06, 2011 5:28 pm
by ingsic
jwiles wrote:I tried the third option in 8.1 as well and it wouldn't pass validation.
isvalid('DATE',StringToDate(Lnk_campo,"%yyyy%mm%dd"))

isvalid('TIME',StringToTime(Lnk_encabezado.CHDHTR_E,"%hh%nn%ss"))

Posted: Wed Apr 06, 2011 6:53 pm
by jwiles
Those work, but mainly because Date, Time and Timestamp datatypes return a string of asterisks '*' when the data is invalid. In a sense, the datatype is performing the validation for you.