The DB2 Command part of the Natural Tools for DB2 enables you to issue DB2 commands from a Natural environment.
A file is maintained for each user on the FUSER file. This file is stored under the object name DB2$CMD in the Natural library of the current user.
You can select a command and submit it, save the command file and save and/or print the output report.
This section covers the following topics:
To invoke the Interactive SQL function
Enter function code "D" on the Natural Tools for DB2 Main Menu.
The Execute DB2 Command screen is displayed:
16:07:56 ***** NATURAL TOOLS FOR DB2 ***** 2006-05-24 - Execute DB2 Command - Code Function C Display Commands O Display Output ? Help . Exit Code .. _ Library .. DBA_____ Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Help Exit Canc |
The following functions are available:
Code | Decription |
C |
Displays your command file. If you have not saved a command file yet, a default file is displayed. |
O |
If an output file exists, the output report is displayed. |
The following parameter can be specified:
Library: You can enter a user name or library. The default is the currrent user ID.
To display the command file
Enter function code "C" on the DB2 command menu.
The DB2 Commands screen is displayed:
16:12:11 ***** NATURAL TOOLS FOR DB2 ***** 2006-05-24 - DB2 Commands - Mark the line of the command you want to execute with 'S' and press PF4 Cmd 1 _ -DISPLAY THREAD (*)......................................... Cmd 2 _ -DISPLAY LOCATION........................................... Cmd 3 _ -DISPLAY DATABASE(*) LIMIT(2500)............................ ............................................................ Cmd 4 _ -DISPLAY PROCEDURE (*)...................................... ............................................................ Cmd 5 _ -DISPLAY DATABASE(DSNDB04) LIMIT (*)........................ ............................................................ Cmd 6 _ ............................................................ ............................................................ Cmd 7 _ ............................................................ ............................................................ Cmd 8 _ ............................................................ ............................................................ ............................................................ Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Exit Subm Save Next Canc |
Use PF11 to scroll to the next page.
You can modify the command file. Save your modifications with PF5.
To execute a command
Mark the command with "S" and press PF4.
The results are displayed on the DB2 Commands Output screen:
16:13:23 ***** NATURAL TOOLS FOR DB2 ***** 2006-05-24 - DB2 Commands Output - Command: -DISPLAY DATABASE(DSNDB04) LIMIT (*) Return Code 1: 00000000 Return Code 2: 00000000 Length of Output: 00001AFB DSNT360I - *********************************** DSNT361I - * DISPLAY DATABASE SUMMARY * GLOBAL DSNT360I - *********************************** DSNT362I - DATABASE = DSNDB04 STATUS = RW DBD LENGTH = 72674 DSNT397I - NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ---- ------------------ -------- -------- -------- ----- ADRESSE TS RW ALIASRBY TS RW ALLDATA0 TS RW Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Exit Save -- - + ++ Canc |
To save the command file, use PF5; the output file is stored under the object name DB 2$OUT in the Natural library of the current user.
To return to the command file, use PF3.
You can submit further commands.
To display the last output record
Enter function code "O" on the DB2 command menu.
The DB2 Commands Output screen is displayed:
16:13:57 ***** NATURAL TOOLS FOR DB2 ***** 2006-05-24 - DB2 Commands Output - Command: -DISPLAY DATABASE(*) LIMIT(2500) Return Code 1: 00000000 Return Code 2: 00000000 Length of Output: 00007468 DSNT360I - *********************************** DSNT361I - * DISPLAY DATABASE SUMMARY * * GLOBAL * DSNT360I - *********************************** DSNT362I - DATABASE = DSNDB01 STATUS = RW DBD LENGTH = 8000 DSNT397I - NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ---- ------------------ -------- -------- -------- ----- DBD01 TS RW SPT01 TS RW SCT02 TS RW Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Exit Print -- - + ++ Canc |
To print the output record, use PF5.