- 论坛徽章:
- 0
|
Running Programs within Qshell
Qshell doesn't use the call command to start a program. Instead, you must type the program's name, in IFS style. The following example illustrates how a program can run within Qshell:
/qsys.lib/mylib.lib/myshellpgm.pgm
-------------
Usage for database operation
CL has a major restriction of using Data Manipulation Language (DML) such as Update, insert or selected delete with the DB2/400 database. To achieve this, we use roundabout ways such as RUNSQLSTM, writing new RPG program, etc.
Qshell makes life easier by using the following command:
Syntax: QSH CMD('db2 "<Db2/400 sql statement">)
Example:
QSH CMD('db2 "UPDATE MYLIB.MYFILE SET MYFLD = ''P''" ')
QSH CMD('db2 "INSERT INTO MYLIB.MYTABLE VALUES(''jagannath'', 104.20)"')
Things to note:
Usage for IFS operation
It is always a headache to handle IFS files using RPG programs. We have to write separate RPG programs using C APIs to handle this functionality. But QShell commands ease this process.
Syntax:
To replace the contents of the IFS and write the fresh text
QSH CMD('print It is working > /home/mydir/myfile.txt')
To append to the contents of the IFS file in next line
QSH CMD('print It is working >> /home/mydir/myfile.txt') |
|