Empty File check in Server Job Sequence

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
nkumar_home
Participant
Posts: 19
Joined: Fri Apr 02, 2004 10:13 am

Empty File check in Server Job Sequence

Post 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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
nkumar_home
Participant
Posts: 19
Joined: Fri Apr 02, 2004 10:13 am

Post 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.
Post Reply