先解释下这个API...
Execute Command (QCMDEXC) API
Required Parameter Group:
1 | Command string | Input | Char(*) |
2 | Length of command string | Input | Packed (15,5) |
Optional Parameter:
3 | IGC process control | INPUT | Char(3) |
Default Public Authority: *USE
Threadsafe: Yes.
See for command considerations.
The Execute Command (QCMDEXC) API runs a single command. It is used to run a command from within a high-level language (HLL) program or from within a CL program where it is not known at compile time what command is to be run or what parameters are to be used.
QCMDEXC is called from within your HLL program and the command it runs is passed to it as a parameter on the CALL command.
After the command runs, control returns to your HLL program.
Notes:
- Command strings in System/38 syntax can use the QCAEXEC API. The QCAEXEC API accepts the same parameters as QCMDEXC.
- The Process Commands (QCAPCMD) API also provides similar functions.
- If the command to be executed is a proxy command, the QCMDEXC API will resolve to the target command. If the target command is also a proxy, the process repeats until either a non-proxy command is found, or the proxy chain becomes greater than the allowed maximum. Once a non-proxy command is found, the resolved command will replace the proxy command in the command string to be executed.
- Proxy commands will be resolved before the command exit points QIBM_QCA_CHG_COMMAND and QIBM_QCA_RTV_COMMAND are called.
再具体就去查IBM信息中心。
使用方法一: 【CALL风格】
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 .
*************** Beginning of data *********************************
0001.00 *
0002.00 DTMP1 S Z
0003.00 DTMP2 S Z
0004.00 DEXCMD S 100A
0005.00 DCMDLEN S 15P 5
0006.00 *
0007.00 C EVAL EXCMD='DLYJOB DLY(5)'
0008.00 C EVAL CMDLEN = 13
0009.00 C EVAL TMP1=%TIMESTAMP
0010.00 C CALL 'QCMDEXC'
0011.00 C PARM EXCMD
0012.00 C PARM CMDLEN
0013.00 C EVAL TMP2=%TIMESTAMP
0014.00 C TMP1 DSPLY
0015.00 C TMP2 DSPLY
0016.00 C SETON LR
0017.00 C RETURN
****************** End of data ************************************
结果就不上图了,延时5s嘛~
这种风格也是我接触的第一中风格,本来我以为API都是这么调用的。。。。后来,我被推翻了。。。
使用方法二: 【CALLP风格】
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 .
*************** Beginning of data *********************************
0001.00 *
0002.00 DTMP1 S Z
0003.00 DTMP2 S Z
0004.00 Dqcmdexc PR EXTPGM('QCMDEXC')
0005.00 D COMMAND 3000A CONST OPTIONS(*VARSIZE)
0006.00 D LENGTH 15P 5 CONST
0007.00 *
0008.00 C EVAL TMP1=%TIMESTAMP
0009.00 C CALLP QCMDEXC('DLYJOB DLY(5)': 13)
0010.00 C EVAL TMP2=%TIMESTAMP
0011.00 C TMP1 DSPLY
0012.00 C TMP2 DSPLY
0013.00 C SETON LR
0014.00 C RETURN
****************** End of data ************************************
刚看到这个方法时我很凌乱,不懂是什么意思。然后一顿查资料才知道有CALL, CALLB, CALLP!!!!
CALL Call a Program
CALLB Call a Bound Procedure
CALLP Call a Prototyped Procedure or Program. (D行用PR声明Prototype)
有看到别人说什么静态调用,动态调用的,真心不懂。。。等懂了再更新上来吧~
使用方法三:
有别的使用风格么?我也不知道了。。。
阅读(2768) | 评论(1) | 转发(0) |