DataStage not identifying Varchar

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sagar deshmukh
Participant
Posts: 103
Joined: Fri Jan 18, 2008 12:55 am
Location: chennai

DataStage not identifying Varchar

Post by sagar deshmukh »

Hi i have a rounine as given below




DEFFUN ConvDateCYYDDDtoYYYYMMDD(A) Calling "DSU.ConvDateCYYDDDtoYYYYMMDD"
DEFFUN ConvDateToYYYYMMDD(A) Calling "DSU.ConvDateToYYYYMMDD"
DEFFUN ConvtSignOverPunch(A) Calling "DSU.ConvtSignOverPunch"

******
*Init*
******

RECORD_LENGTH = 100
REJECT = "REJECT-"
CODE = 0
Ans = ""
IC4X = Arg1

*********
*Process*
*********
If Len(IC4X) < RECORD_LENGTH Or Len(IC4X) > RECORD_LENGTH Then
GoTo Reject
End Else
GoTo ProcessIC4X
End

ProcessIC4X:
*** Get Country_Code - 1 ***
Country_Code = Trim(IC4X[1,3])
If (IsNull(Country_Code) Or (Country_Code <> "US" And Country_Code <> "GU" And Country_Code <> "CA")) Then
CODE = 1
GoTo Reject
End
Ans = Ans:Country_Code:"|"

*** Get Item_Nbr - 2 ***
Item_Nbr = Trim(IC4X[26,6])
If Num(Item_Nbr) = @FALSE Then
CODE = 2
GoTo Reject
End
Ans = Ans:Item_Nbr:"|"

*** Get Loc_Nbr - 3 ***
Loc_Nbr = Trim(IC4X[5,5])
If Num(Loc_Nbr) = @FALSE Then
CODE = 3
GoTo Reject
End
Ans = Ans:Loc_Nbr:"|"



Reject:
Return ("<":REJECT:CODE:">")


here for Loc_Nbr - 3 if we give value as 'e4545' it identifies as varchar and aborts....but if we give 45e45 then it doesnt identify it as varchar....
can you tell me whats the problem......



bt same piece of code for Get Item_Nbr - 2 is working fine,....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Write a short Basic routine and return the value of "NUM('45e45')". Is that returning a 1 or a 0?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It returns 1, since 45e45 is numeric (provided EXACTNUMERIC is sufficiently large).

You don't even need a routine. Use EVAL in a query.

Code: Select all

SELECT EVAL "NUM('45e45')" FROM VOC FIRST 1;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Ray - you ruined the suspense I was trying to build up ;)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Only in this forum. :wink:

viewtopic.php?t=124402
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply