CL程序如下:
FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+..
*************** Beginning of data *********************************
0001.00 PGM
0002.00 QSH CMD('DB2 "INSERT INTO FILE02P +
0003.00 (PGMNAME) VALUES(''TEST'')" ')
0004.00 ENDPGM
****************** End of data ************************************
说明:
1. QSH的CMD参数内所有内容都在两个单引号(')之间!!!
2. SQL语句部分需要在两个双引号(")之间.
3. values内用的是单引号, 但为了防止CMD提前结束, 需要连用两个单引号表示一个单引号.
CALL CL12后的结果如下:
qsh: 001-0046 Syntax error on line 1: matching delimiter for quoted string no
t found.
Press ENTER to end terminal session.
DB20000I THE SQL COMMAND COMPLETED SUCCESSFULLY.
Press ENTER to end terminal session.
===>
F3=Exit F4=End of File F6=Print F9=Retrieve F17=Top
F18=Bottom F19=Left F20=Right F21=User Window
这里是call了两次, 第一次CMD内的参数有语法错误, 第二次是正确的.
关于QSH
The possible values are:
*NONE:No command is provided and an interactive session is started.commandA shell command to run. The command can be a maximum of 5000 bytes in length. If a blank or other special characters are used, the command must be enclosed in apostrophes ('). If an apostrophe is intended, two apostrophes must be used ('').Note: The case is preserved when lowercase characters are specified.
FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+..
*************** Beginning of data *********************************
0001.00 PGM
0002.00 QSH CMD('DB2 "INSERT INTO FILE02P +
0003.00 (PGMNAME) VALUES(''TEST'')" ')
0004.00 ENDPGM
****************** End of data ************************************
说明:
1. QSH的CMD参数内所有内容都在两个单引号(')之间!!!
2. SQL语句部分需要在两个双引号(")之间.
3. values内用的是单引号, 但为了防止CMD提前结束, 需要连用两个单引号表示一个单引号.
CALL CL12后的结果如下:
qsh: 001-0046 Syntax error on line 1: matching delimiter for quoted string no
t found.
Press ENTER to end terminal session.
DB20000I THE SQL COMMAND COMPLETED SUCCESSFULLY.
Press ENTER to end terminal session.
===>
F3=Exit F4=End of File F6=Print F9=Retrieve F17=Top
F18=Bottom F19=Left F20=Right F21=User Window
这里是call了两次, 第一次CMD内的参数有语法错误, 第二次是正确的.
关于QSH
Start QSH (STRQSH)
Where allowed to run: All environments (*ALL) Threadsafe: No | Parameters Examples Error messages |
The Start QSH (STRQSH) command, as known as QSH, starts the qsh shell interpreter.
If run in an interactive job, STRQSH starts an interactive shell session. If a shell session is not already active in the job, then:
Using the Terminal Window
The terminal window has two parts:
F3 (Exit)Close the terminal window and end the qsh session.F5 (Refresh)Refresh the output area.F6 (Print)Print the output area to a spool file.F7 (Up)Roll output area up one page.F8 (Down)Roll output area down one page.F9 (Retrieve)Retrieve a previous command. You can press this key multiple times to retrieve any previous command. For example, to retrieve the second to last command you entered, press this key two times. You can also select a specific command to be run again by placing the cursor on that command and pressing this key. When the interactive job is running in a double-byte CCSID, this key is not available.F11 (Toggle line wrap)Toggle the line wrap/truncate mode in the output area. In line wrap mode, lines longer than the width of the terminal window are wrapped to the next line. In truncate mode, the portion of a line beyond the width of the terminal window is not shown.F12 (Disconnect)Disconnect from the qsh session. This key only closes the terminal window and does not end the qsh session. You can redisplay the disconnected qsh session by running STRQSH again.F13 (Clear)Clear the output area.F17 (Top)Display top of output area.F18 (Bottom)Display bottom of output area.F19 (Left)Shift output area to the left.F20 (Right)Shift output area to the right.F21 (CL command entry)Display a command entry window where you can enter CL commands.Also, you can use SysReq 2 to interrupt the currently running command.
QSH0002Error found with QSH session, reason code &1, errno &2.
If run in an interactive job, STRQSH starts an interactive shell session. If a shell session is not already active in the job, then:
- A new shell session is started and a terminal window is displayed.
- qsh runs the commands from the file /etc/profile if it exists.
- qsh runs the commands from the file .profile in the user's home directory if it exists.
- qsh runs the commands from the file specified by the expansion of the ENV variable if it exists.
Using the Terminal Window
The terminal window has two parts:
- an input line for entering commands, and
- an output area that contains an echo of the commands you entered and any output generated by the commands.
F3 (Exit)Close the terminal window and end the qsh session.F5 (Refresh)Refresh the output area.F6 (Print)Print the output area to a spool file.F7 (Up)Roll output area up one page.F8 (Down)Roll output area down one page.F9 (Retrieve)Retrieve a previous command. You can press this key multiple times to retrieve any previous command. For example, to retrieve the second to last command you entered, press this key two times. You can also select a specific command to be run again by placing the cursor on that command and pressing this key. When the interactive job is running in a double-byte CCSID, this key is not available.F11 (Toggle line wrap)Toggle the line wrap/truncate mode in the output area. In line wrap mode, lines longer than the width of the terminal window are wrapped to the next line. In truncate mode, the portion of a line beyond the width of the terminal window is not shown.F12 (Disconnect)Disconnect from the qsh session. This key only closes the terminal window and does not end the qsh session. You can redisplay the disconnected qsh session by running STRQSH again.F13 (Clear)Clear the output area.F17 (Top)Display top of output area.F18 (Bottom)Display bottom of output area.F19 (Left)Shift output area to the left.F20 (Right)Shift output area to the right.F21 (CL command entry)Display a command entry window where you can enter CL commands.Also, you can use SysReq 2 to interrupt the currently running command.
Error messages for STRQSH
*ESCAPE MessagesQSH0002Error found with QSH session, reason code &1, errno &2.
Top |
Command (CMD)
Specifies the shell command to be run.The possible values are:
*NONE:No command is provided and an interactive session is started.commandA shell command to run. The command can be a maximum of 5000 bytes in length. If a blank or other special characters are used, the command must be enclosed in apostrophes ('). If an apostrophe is intended, two apostrophes must be used ('').Note: The case is preserved when lowercase characters are specified.