Page 1 of 1

Empty File check in Server Job Sequence

Posted: Mon Nov 01, 2004 4:28 pm
by nkumar_home
I am using the test -s filename command in the ExecuteCommand stage to check for a an empty file. A return code of 0 continues control to the next job else the sequence aborts. However this does not work. Always aborts with following message whether the file is empty or not.

"JobSeqLoadAdExtract..JobControl (@EmptyFileCheck): Executed: /usr/bin/test -s Users.csv
Reply=1
Output from command ====>
/usr/bin/test[7]: test: Specify a parameter with this command."

I changed to use wc instead. It passes through even for empty files.

wc -c Users.csv|cut -c1|grep [1-9]

Any workaround?


thanx

Posted: Mon Nov 01, 2004 4:38 pm
by kduke
There are several. You could use a shell script which does an exit 0 or exit 1 when it fails. You would need to do more error checking.

You could do an openseq in BASIC. The status command will give you the size of the sequential file. Do a search Ray and others have posted code on the status command.

Posted: Mon Nov 01, 2004 4:45 pm
by chulett
Is your filename to check - Users.csv - a job parameter? The Execute Command stage doesn't parse them correctly. Yes, the log entry looks just peachy but the actual command executed includes the untranslated job parameter, which may be what's tripping you up.

Me, I'd do this in a routine and use DSExecute. You have alot more control over how to handle the output of the command and what gets passed back to the Sequence job.

Posted: Mon Nov 01, 2004 4:54 pm
by nkumar_home
chulett wrote:Is your filename to check - Users.csv - a job parameter? The Execute Command stage doesn't parse them correctly. Yes, the log entry looks just peachy but the actual command executed includes the untranslated job parameter, which may be what's tripping you up.

Me, I'd do this in a routine and use DSExecute. You have alot more control over how to handle the output of the command and what gets passed back to the Sequence job.
Thanks all. The problem was with the way it parses the parameters. I am now doing it as a routine.