Reputation: 41
I am using the following statement in Unix script to load the table in DB2. The command was success but still echo $?
is returning 2. Could anyone clarify why it is returning 2?
db2 "load client from /user/abc.ixf of IXF insert into EMP NONRECOVERABLE";
echo $?
is returning 2.
Upvotes: 1
Views: 720
Reputation: 12267
The exit-code 2 represents a WARNING, so the load completed successfully but either at least one line from the file being loaded had some issue that you may want to check (data truncation, data conversion etc) OR there was some operational issue ( e.g. a resource constraint limited the number of resources available, or the tablespace(s) are in a certain state etc.). Much depends on your context.
To find such things, you should use the MESSAGES option and specify a file relative to your client where Db2 can record such information. You can then read or parse that text file to get more details. Consider using also the WARNINGCOUNT option to for Db2 to return an error if more than your-specified number of warnings happen.
See the documentation for your Db2-version.
Upvotes: 2