Re: unload in Informix
Posted in 1998
Manoj Kumar Sutar wrote: > > Hi , > > If I unload from an empty table OR 0 row qualify for unload > to a file say file1 . What this file file1 will contain . I have a > program which will work fine if file1 contains 0 rows . It must not > contain anyting . My program is expected to run on Unix . > > A part of my shell script is ... > > echo " unload .... to file1 select ......" > unload.sql > isql database_name unload.sql > if [ -s file1 ] > then > echo " OK , I want this " > else > echo " My program will fail " > fi > > I do not have Informix installed at our office . Can any one > tell me whether my program will work as I wanted ? Yes it will as Informix will indeed create a zero length file for the unload of zero rows. However, even if it did not your script could read: echo "unload to file1 select ..." | isql database_name - if [ -s file1 ] # Which BTW tests if the file length is > 0! then echo "OK, I want this" else echo "Got to fix this" touch file1 fi Note that your script is incorrect and will flag a problem in error if the file length is indeed zero. Perhaps you really wanted: if [ -f file1 ] -OR- if [ -r file1 ] Art S. Kagel