Loop final value not numeric

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
hsahay
Premium Member
Premium Member
Posts: 175
Joined: Wed Mar 21, 2007 9:35 am

Loop final value not numeric

Post by hsahay »

Hi,

I am executing the below command in execute command activity.The output from the command is 4

expr `date +%Y` - 2007

and passing the output of this command to start loop activity. i want the loop to be executed the number of times the output from above command.

But i am getting the below error.

Loop final value not numeric (4)

I have searched the forum i got 4 unique solutions. tried all of them but was not succesful. Please find the solution from forum and my job output. I used all the below expressions in Start loop activity.

Convert(@FM,"",#Execute_Command_20.$CommandOutput#)--Convert(@FM,"",4 - cannot execute (i double checked the paranthesis and they are correct)

Trim(Convert(@FM,"",#Execute_Command_20.$CommandOutput#))--Trim(Convert(@FM,"",4)-cannot execute

Convert(@FM,"",Execute_Command_20.$CommandOutput)--My job wasnot compiling at all.

DSGetUserStatus--I was not able to find this routine and dont know how to use it.

I used the below expressions in Execute command activity which is coming as input to start loop activity
Convert(@FM,"",expr `date +%Y` - 2007)--SH: 0403-057 Syntax error at line 1 : `(' is not expected.) - cannot execute

Please help in getting the solution and please correct me if my understanding is wrong .-
vishal
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The result of the command includes a newline. Try eliminating it, for example by changing the command to

Code: Select all

expr `date +%Y` - 2007 | tr -d '\n'
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hsahay
Premium Member
Premium Member
Posts: 175
Joined: Wed Mar 21, 2007 9:35 am

Post by hsahay »

Thanks a lot Ray, It worked. :D

I am marking this thread as resolved and closing it.
vishal
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post by vamsi.4a6 »

Just want to know why the above command is not worked eventhough post is resolved.

Convert(@FM,"",#Execute_Command_20.$CommandOutput#) or Trim(Convert(@FM,"",#Execute_Command_20.$CommandOutput#))

Any help is appreciated.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Probably because the command was typed in rather than using the expression builder and/or because parameters were included in the Command field (they may only appear in the Parameters field). These are my guesses. I don't know for certain what the OP did.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply