How to use MODIFY STATE ? help please

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
tini
Participant
Posts: 24
Joined: Thu Jun 19, 2003 6:37 am

How to use MODIFY STATE ? help please

Post by tini »

I want to use the modify state to convert varchar 15 to char 14
and convert char 14 to timestampe

But I got warning when convert varchar 15 to 14.
Here is the warning
Conversion; from source type "string[max=15]" to result type "string": Taking substring of variable-length source string

code
source:string=substring[1,14](target)


help please
thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Specify an explicit length of 14 for your new string and the warning will go away.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

targetfield:string[14]=substring[0,14](sourcefield)
or

Code: Select all

targetfield:nullable string[14]=substring[0,14](sourcefield)
if the target field requires the capability to carry NULL.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tini
Participant
Posts: 24
Joined: Thu Jun 19, 2003 6:37 am

Post by tini »

ray.wurlod wrote:

Code: Select all

targetfield:string[14]=substring[0,14](sourcefield)
or

Code: Select all

targetfield:nullable string[14]=substring[0,14](sourcefield)
...
I tried the code but I still have same error msg.

Conversion; from source type "string[max=15]" to result type "string[14]": Taking substring of variable-length source string.


:(
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Try

Code: Select all

targetfield:string[14]=substring[0,13](sourcefield)
That will give you a lenght of 14, not 15 as you are currently doing.
tini
Participant
Posts: 24
Joined: Thu Jun 19, 2003 6:37 am

Post by tini »

ray.wurlod wrote:

Code: Select all

targetfield:string[14]=substring[0,14](sourcefield)
or

Code: Select all

targetfield:nullable string[14]=substring[0,14](sourcefield)
...
I tried the code but I still have same error msg.

Conversion; from source type "string[max=15]" to result type "string[14]": Taking substring of variable-length source string.


:(
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

tini - did you use 13 instead of 14 as the string end position? How did you declare this new column in your metadata? Somewhere you have specified this as unbounded, which is where the warning is coming from.
tini
Participant
Posts: 24
Joined: Thu Jun 19, 2003 6:37 am

Post by tini »

ArndW wrote:tini - did you use 13 instead of 14 as the string end position? How did you declare this new column in your metadata? Somewhere you have specified this as unbounded, which is where the warning is comi ...
the input column is varchar 15
and I declared the new column as char 14.

I tried
targetfield:string[14]=substring[0,13](sourcefield)

and I have same warning error.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

It looks like you cannot get rid of the message unless your source string is fixed length, I've experimented around a bit. You can always suppress the message from the log and it might be worth submitting the problem to your support provider.
tini
Participant
Posts: 24
Joined: Thu Jun 19, 2003 6:37 am

Post by tini »

So what should I do?
I even convert the varchar 15 to char 15
and substring 14 but I still have same warning?
what is going on?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

tini - I used a fixed length CHAR instead of VarChar and the message went away. Or just deprecate the warning message in the log.
tini
Participant
Posts: 24
Joined: Thu Jun 19, 2003 6:37 am

Post by tini »

ArndW wrote:tini - I used a fixed length CHAR instead of VarChar and the message went away. Or just deprecate the warning message in the log. ...

I tried this way too but the warning still there :evil: :evil: :evil:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

That is very unfortunate. I tested it and don't have the warning.
Post Reply