
Function:
reads and executes SQL statements.
Format:

Description
XSQL is a tool which allows the user to execute any SQL statement in a UNIX-like style. This tool can be useful for testing purposes and for executing SQL statements from UNIX shell scripts.
If no arguments other than the options are specified, XSQL reads the commands from standard input. The results are written to standard output. The prompt and all messages are written to standard error (unless the -K option is specified). In addition, all commands as well as the messages are written to a file named sql.prot.
Options
The options -u, -U, and -d required for the connect are described in Section Establishing a Database Session.
-D <datetime format>
This date and time format ( INTERNAL, ISO, USA, EUR, JIS ) can be used instead of the one specified in the user-specific SET parameters.
-J <separator>
This separator can be used instead of the one specified in the user-specific SET parameters.
-p <decimal format>
This decimal format can be used instead of the one specified in the user-specific SET parameters.
-g <null value>
This representation for the null value can be used instead of the one specified in the user- specific SET parameters.
-h
provides a brief explanation of how to use XSQL.
-T
activates TRACE LONG.
-K
records all statements and return messages sent to standard output. If this option is not specified, the prompt as well as the return messages are written to standard error after executing a command. In addition, commands that are read from a file are not displayed on the screen.
-z
No AUTOCOMMIT. If this option is not specified, XSQL performs COMMIT WORK after each command.
-a
No header. If this option is not specified, a header is displayed for each SELECT statement.
-Q
shows each column on a separate line.
-k
ROLLBACK WORK in case of errors. If a user wants to perform a COMMIT WORK and there has been an error since the last COMMIT WORK, a ROLLBACK WORK is done instead. (-k has no effect if -z is not specified.)
-b
BATCH mode. A prompt is not displayed.
UNIX commands can be executed with !<command>.
Examples
xsql
calls XSQL with the user specifications of XUSER (parameter combination 'DEFAULT'). A prompt is displayed, where the SQL statements can be entered. A statement is always executed when the user
presses
. ^D or the command 'exit' terminates XSQL.
xsql -u sqltravel00,travel00 -d DB311 -b <infile >outfile
starts XSQL with the specified user parameters. The commands are read from the file 'infile' and executed by lines. The results are written to the file 'outfile'.
Files
sql.prot
All commands and messages are written to this file.
sql.pct
Trace file. If the option -T was specified, the TRACE LONG is written to this file.
