IBM Support

In the Transformer stage, using the IsValid function throws a warning in DataStage.

Troubleshooting


Problem

Using the IsValid function to check for a valid date. However, the function throws a warning if there is an actual bad date. In DataStage v7 and v8.1, there is no warning but in v8.5 and above, a warning appears. Some examples: Scenario 1: StageVar=20141231 If IsValidDate( "2014-12-31" ) Then "Valid" Else "InValid" Returns= Valid No Log Warnings Scenario 2: StageVar=20143112 If IsValidDate(" 2014-31-12" ) Then "Valid" Else "InValid" Returns= InValid Log Warnings= Conversion error calling conversion routine date_from_ustring data may have been lost Scenario 3: StageVar=20143112 If IsValidDate(StringToDate( "2014-31-12" ,"%yyyy-%mm-%dd")) Then "Valid" Else "InValid" Returns= InValid Log Warnings= APT_CombinedOperatorController,1: Conversion error calling conversion routine date_from_string data may have been lost

Cause

A warning message will occur with the use of IsValidDate or IsValid("date",StringToDate(string,"%mm/%dd/%yyyy") ) because it is trying to convert the invalid string value to date before it actually checks to see if it is valid.

Resolving The Problem

To resolve this issue, use the function:

IsValid ("date", String1[1,4]:"-":String1[5,2]:"-":String1[7,2])

[{"Product":{"code":"SSZJPZ","label":"IBM InfoSphere Information Server"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"--","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.5;8.7;9.1;9.1.2.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21672650