File sort using qshell (this time with tags)
Hi,
I'm trying to use qshell to do a sort of a (non-keyed) DB2 database file to remove duplicate records. I use the following command :-
sort -u /QSYS.LIB/$1.LIB/$2.FILE/$3.MBR | cat > /QSYS.LIB/$1.LIB/$2.FILE/$3.MBR
Where $1 = Library name, $2 = File name, $3 = Member name.
The command does a sort, removing duplicate records, and replaces the data in the original file with the sorted version of the data. This works fine when I try it with a small test file.
When I try this with a larger test file I get the following error in the qshell :-
001-0055 Error found creating file ....... Resource busy.
I'm running this on a machine with plenty of capacity, so I don't think that's an issue here. I think that the cat is starting to write the output before all the input has been read by the sort. Is there a nice way around this without sorting to another file first? Eventually I'll need to use this with some very large files.
I've already tried using a command substitution for the sort :-
$(sort -u /QSYS.LIB/$1.LIB/$2.FILE/$3.MBR) | cat > /QSYS.LIB/$1.LIB/$2.FILE/$3.MBR
But this didn't seem to make any difference.
Thanks in advance for any help,
Martin Gilbert.



