Page 1 of 2
trimming line terminator
Posted: Thu Sep 09, 2010 3:32 pm
by allavivek
Hi All,
I was trying to trim line terminator that was causing my sequence to get aborted..
In sequence i am using loop through list of items.The last field is taking line terminator and causing termination...
I tried convert(@FM,",", Execute_Command.$CommandOutput)
before loop activity but it didnt work...
How to remove line terminator??
thnak you
Posted: Thu Sep 09, 2010 3:40 pm
by allavivek
I even tried
Convert(@FM,',',Trim(Execute_Command.$CommandOutput," "))
not working still
Any suggestions
Posted: Thu Sep 09, 2010 5:14 pm
by ray.wurlod
Please explain what "didn't work" entails? Your first expression should have removed the terminator, but replaced it with a comma. What command are you executing?
Posted: Thu Sep 09, 2010 6:17 pm
by allavivek
Hi ray,
basically i was reading delimited values from file to loop to perform list loop.
When it comes to last field the sequence is getting executed.
......execute_command1 --->start loop---->user variable----->execute command2 ---->stop------
The execute command 2 was getting failed because of last field because of extra termination character ...
so i added user variable activity and tried to remove the extra character of last field....
is this correct approach or i should do any thing to get my loop finish succesfully....
thank you..
Posted: Thu Sep 09, 2010 7:20 pm
by chulett
In your post, "termination character" means what? An extra comma on the end of the loop list or a trailing Field Mark there from the Execute Command?
Posted: Thu Sep 09, 2010 7:31 pm
by allavivek
Chulett,
Im my file i have like
aaa,bbb,ccc
while processing loop for values aaa,bbb it was processing good but for ccc the sequence is getting failed...
in loop iam having execute command as ...
. somescript param1 param2
the error coming was..
command : . somescript param1
reply: param2
execution failed.
What i thought was along with ccc , termination char was coming which was leading failure of sequence...
How to get rid of this??
Posted: Thu Sep 09, 2010 9:47 pm
by chulett
Doesn't really answer the question, I'm afraid. Can you post your actual, unedited error message?
Posted: Fri Sep 10, 2010 7:20 am
by allavivek
Sorry chulett , actually i was out of my office yesterday so i couldnt post error message..
seq_xxxxxxxxxxxxx..JobControl (@yyyyyy): Executed: . script.ksh BEGIN param1 param2 param3 30 param4 param5
Reply= param6 param7 seq_xxxxxxxxxxxxx
Output from command ====>
seq_xxxxxxxxx..JobControl (@yyyyyyy): Command . did not finish OK, reply = '-1'
param5 contains values from loop....for last value in loop sequence is getting aborted..
Any suggestions please....
Posted: Fri Sep 10, 2010 7:31 am
by chulett
Do you have the 'automatically handle' option turned on? It considers any 'non-zero' return code to be a failure. What happens if you turn that off if on?
Posted: Fri Sep 10, 2010 7:37 am
by allavivek
Hi chulett,
I turned off the "automatically handle option" , but the error persists..
i was using
..execute command....>user variable--->statr loop---->command---->stop....
In user variable iam giving
convert(@FM,'',Execute_Command.$CommandOutput)
Is this correct way to handle...
Posted: Fri Sep 10, 2010 7:42 am
by chulett
Yes - *if* that is the problem. However, doesn't sound like it is. What is your script actually
doing? What kind of status does it return?
![Confused :?](./images/smilies/icon_confused.gif)
Posted: Fri Sep 10, 2010 7:47 am
by allavivek
Hi chulett,
My script is reporting event to log database.it is working fine for all iterations..but for last one its getting failed..
Any suggestions..
Posted: Fri Sep 10, 2010 7:59 am
by allavivek
Hi chulett,
On searching this forum i found
"Trim the final field mark from the command's output and convert the other field marks to a printable delimiter "
Can you tell me the funtion for the above statement...
thank you..
Posted: Fri Sep 10, 2010 8:16 am
by ArndW
CONVERT(@FM,CHAR(10),FIELD(Execute_Command.$CommandOutput,@FM,1,DCOUNT(Execute_Command.$CommandOutput,@FM)-1))
This removes the last field then converts all field marks into char(10)
Posted: Fri Sep 10, 2010 8:22 am
by allavivek
Hi andrw ,
I tried your code but it didnt worked...
Thank you..