Hi, thanks for reading. I have a datastage job with a routine activity step. In the routine activity I use the following
"ls -1u /blah/blah/blah/FILENAME*.txt > /blah/blah/blah/FILENAME2.txt"
If FILENAME*.txt isn't found I get the 'no such file or directory error'. It is very common to not have a file in our situation. Can someone please show me how to modify the 'ls' command so that the error message is suppressed and the datastage job doesn't abort?
how to supress - no such file or directory unix error
Moderators: chulett, rschirm, roy
I have tried this
"ls -1u /blah/blah/blah/FILENAME*.txt > /blah/blah/blah/FILENAME2.txt > /dev/null"
and
"ls -1u /blah/blah/blah/FILENAME*.txt > /blah/blah/blah/FILENAME2.txt > 2 /dev/null"
but still get the error
/blah/blah/blah/FILENAME*.txt not found
do I need to change where/how I use "/dev/null' ?
"ls -1u /blah/blah/blah/FILENAME*.txt > /blah/blah/blah/FILENAME2.txt > /dev/null"
and
"ls -1u /blah/blah/blah/FILENAME*.txt > /blah/blah/blah/FILENAME2.txt > 2 /dev/null"
but still get the error
/blah/blah/blah/FILENAME*.txt not found
do I need to change where/how I use "/dev/null' ?
Code: Select all
ls -1u /blah/blah/blah/FILENAME*.txt > /blah/blah/blah/FILENAME2.txt 2>/dev/null
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Hi I gave it a shot, the DS sequencer still aborts. Looks like DS still knows somehow that the command could not find the file. Any other ideas are greatly appreciated.
rtneCreateList (ROUTINE DSU.ExecSH) started
13:05:33: rtneCreateList finished, reply=1
13:05:33: Exception raised: @rtneCreateList, Unhandled failure (1) encountered calling routine DSU.ExecSH
rtneCreateList (ROUTINE DSU.ExecSH) started
13:05:33: rtneCreateList finished, reply=1
13:05:33: Exception raised: @rtneCreateList, Unhandled failure (1) encountered calling routine DSU.ExecSH
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DataStage detects the exit status. You can generate a fake exit status of 0 to prevent the warning. But... what do you then want DataStage to do in the case that the file does not exist?
Code: Select all
ls -1u /blah/blah/blah/FILENAME*.txt > /blah/blah/blah/FILENAME2.txt 2>/dev/null ; echo ""
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.
Sorry, should have been more specific - that suppresses the message but as noted you still have to handle the non-zero return status rather than leave it "unhandled". That's an option you turned on in the Sequence job and you can override that behaviour by handling the error yourself. Simplest way to make it see that you are handling any problems is with two triggers from the stage: an "OK" and an "Otherwise" trigger. If you don't care that it found no files then simply run both to a Sequencer set to Any before going on to the next step.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers