Below code displays the filenames in the given directory separated by comma. The last filename will not have comma at the end. I call this code as batch program from execute command and next to ec command i have the start loop and in that I selected the list loop and given the ec_command.output as looping values and delimiter as comma. For example if i have three files in the directory, the loop should run for three times. but the loop iteration 3 fails and only two files gets processed.
Why not just use DIR /B *.CSV to get a list of the file names? Then convert the line terminators to commas (maybe in a User Variables activity) and make sure that no empty lines occur. I suspect that the empty value (the last line, which has no file name) is the culprit.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I tried with Convert(@FM,'',commandoutput) but still the same issue. i tried by giving a new line in the file. Currently I tried by having two file names in a sample file.
file1,file2
Above is the content of the file which i process.I use ec command activity and the command is "type filepath" In the trigger I remove the fieldmark and after execute command stage i have the start loop. First it takes file1 in the loop and processes perfectly. But for the sacond file am getting the error.
Please advise.
Sorry Ray, As am not a privileged user, am not able to see your comments. But thanks for giving your valuable inputs.
Right, except they've said repeatedly that it fails attempting to process the last filename, not that it tries to do one too many. So when they have two names it fails on the second iteration of the loop.
-craig
"You can never have too many knives" -- Logan Nine Fingers
dubuku_01 wrote:I tried with Convert(@FM,'',commandoutput) but still the same issue. i tried by giving a new line in the file. Currently I tried by having two file names in a sample file.
probably command output have new line at end
do this in user variable stage after command stage and read this value as input to loop: