Difference between revisions of "Qshell - Utilities"
Line 19: | Line 19: | ||
==Select records from within QSHELL using db2== | ==Select records from within QSHELL using db2== | ||
− | The db2 utility allows you select records from database files, from within QSHELL. See this [http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzahz/rzahzdb2utility.htm link] for the IBM explanation. | + | The db2 utility allows you select records from database files, from within QSHELL. See this [http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzahz/rzahzdb2utility.htm link] for the IBM explanation. |
+ | |||
+ | Please note that IBM does '''NOT''' support the DB2 utility (see this [http://www-03.ibm.com/systems/i/software/db2/qshellperl.html link]). | ||
+ | |||
+ | |||
====db2 Example==== | ====db2 Example==== |
Latest revision as of 16:00, 11 August 2009
Contents
Background
A large number of utilities exist under Qshell which will make your live considerably easier. This write-up will help to highlight some of the hidden gems that exist under QShell.
Read or write record files - rfile
This Qshell utility reads record (database and device) files, and displays it to standard output, or reads information from standard input, and write the data to record files. See this link for the IBM explanation.
RFile Example - Alternative to CPYTOIMPF
If you have a plaintext file with a single field, that you want to copy to the IFS, the following will be easy to use:
rfile -rlQ LIBNAME/FILENAME > /tmp/filename.txt
This will not work correctly when displaying data for fields which has numeric or date values.
Select records from within QSHELL using db2
The db2 utility allows you select records from database files, from within QSHELL. See this link for the IBM explanation.
Please note that IBM does NOT support the DB2 utility (see this link).
db2 Example
This utility will allow you to select different type of fields, and display the data on the console:
db2 "select * from libname.filename where xxx = 'yyy'"