Getting error in $CommandOutput
Moderators: chulett, rschirm, roy
Getting error in $CommandOutput
Hi All,
I'm using execute command stage to read each line of a file at a time. The file looks like~
3,123
4,456
2,677
Now when the sequencer runs for the first time, exec command reads the first line i.e 3,123. The value 3 is then passed to one of the job parameter A and the value 123 is assigned to another job parameter B.
Again for 2nd run it will assign the values from 2nd line in similar manner...and so on .
I'm extracting the first value by
A=Field(Execute_Command_0.$CommandOutput, "," ,1, 1)
B=Field(Execute_Command_0.$CommandOutput, "," ,2, 1)
But its throwing the following error~
Controller problem: Error calling DSSetParam(Account_ID), code=-4
[ParamValue/Limitvalue is not appropriate]
Can anyone help me please?
I'm using execute command stage to read each line of a file at a time. The file looks like~
3,123
4,456
2,677
Now when the sequencer runs for the first time, exec command reads the first line i.e 3,123. The value 3 is then passed to one of the job parameter A and the value 123 is assigned to another job parameter B.
Again for 2nd run it will assign the values from 2nd line in similar manner...and so on .
I'm extracting the first value by
A=Field(Execute_Command_0.$CommandOutput, "," ,1, 1)
B=Field(Execute_Command_0.$CommandOutput, "," ,2, 1)
But its throwing the following error~
Controller problem: Error calling DSSetParam(Account_ID), code=-4
[ParamValue/Limitvalue is not appropriate]
Can anyone help me please?
Thanks
Moumita
Moumita
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi Ray,
The file has no new line at the end.
I've also checked in the forum and it is recommended to use @FM, so I tried with this command~
Field(Execute_Command_0.$CommandOutput,@FM ,2, 1)
but even then I'm getting the same error!
Is it an incorrect command?
Also can you please explain me why do we use @FM?
The file has no new line at the end.
I've also checked in the forum and it is recommended to use @FM, so I tried with this command~
Field(Execute_Command_0.$CommandOutput,@FM ,2, 1)
but even then I'm getting the same error!
Is it an incorrect command?
Also can you please explain me why do we use @FM?
Thanks
Moumita
Moumita
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Line terminators are mapped to @FM. In your case you correctly (originally) specified comma as the delimiter.
The problem is probably with the line terminators in your file. Can you please share how you are implementing "read each line of a file at a time"?
The problem is probably with the line terminators in your file. Can you please share how you are implementing "read each line of a file at a time"?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 17
- Joined: Tue Jan 25, 2011 5:24 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi Ray,ray.wurlod wrote:Line terminators are mapped to @FM. In your case you correctly (originally) specified comma as the delimiter.
The problem is probably with the line terminators in your file. Can you please share how you are implementing "read each line of a file at a time"?
My design is like~
Start Loop-->Exec Command-->MyJob-->End Loop
In the Exec Command stage I'm giving this command to fetch each line at a time:
sed -n '#StartLoop_Activity_3.$Counter#p' <filename>
I have set the counter from 1 to 3 to read the three lines.
Thanks
Moumita
Moumita
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Try this approach. Read the entire file before the loop. Convert the line terminators into, say, pipe characters and use that to delimit your "list of things" loop. Within the loop use Field() functions to parse the comma-delimited lines.
It's probably useful also to check that $Counter is not empty - perhaps a NestedCondition activity.
Code: Select all
ExecuteCommand: cat #filename# | tr '\n' '|'
StartLoop: Delimiter = "|"
Parameter derivation 1: Field(StartLoop.$Counter, ",", 1, 1)
Parameter derivation 2: Field(StartLoop.$Counter, ",", 2, 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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hi Ray,
Thanks a lot for the workaround!
Although my job has finished successfully and generating the desired output but the sequencer is aborting with the same error for the 4th iteration.
Since the output of your Exec command is generating a '|' delimiter at the end of the last record too hence the loop is going for 4 iterations instead of 3.
Its throwing the error only for the 4th iteration~
seq_num_rec_1..JobControl (@StartLoop_Activity_3): Loop through list (4 items): iteration 4
seq_num_rec_1..JobControl (@Job_Activity_5): Controller problem: Error calling DSSetParam(No_of_Rec), code=-4
[ParamValue/Limitvalue is not appropriate]
I tried to write a script to eliminate the last '|' charecter from the output of the command cat #filename# | tr '\n' '|', but even then its giving the same error!
Any suggestions for this problem?
Thanks a lot for the workaround!
Although my job has finished successfully and generating the desired output but the sequencer is aborting with the same error for the 4th iteration.
Since the output of your Exec command is generating a '|' delimiter at the end of the last record too hence the loop is going for 4 iterations instead of 3.
Its throwing the error only for the 4th iteration~
seq_num_rec_1..JobControl (@StartLoop_Activity_3): Loop through list (4 items): iteration 4
seq_num_rec_1..JobControl (@Job_Activity_5): Controller problem: Error calling DSSetParam(No_of_Rec), code=-4
[ParamValue/Limitvalue is not appropriate]
I tried to write a script to eliminate the last '|' charecter from the output of the command cat #filename# | tr '\n' '|', but even then its giving the same error!
Any suggestions for this problem?
Thanks
Moumita
Moumita
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI