Return to the CL Tips
Example of executing a URL from a CLP
It gets the IP address of the incoming connection and then uses runrmtcmd to talk to the client. Drop me a line if you have any questions. PGM PARM(&URL) DCL VAR(&URL) TYPE(*CHAR) LEN(128) DCL VAR(&CMD) TYPE(*CHAR) LEN(256) DCL VAR(&DEVICENAME) TYPE(*CHAR) LEN(10) DCL VAR(&IPADDR) TYPE(*CHAR) LEN(15) DCL VAR(&WINPGM) TYPE(*CHAR) LEN(10) VALUE('start') DCL VAR(&SERVICE) TYPE(*CHAR) LEN(10) + VALUE('http://') /******************************/ /* Parameters for QDCRDEVD */ /******************************/ DCL VAR(&RECEIVER) TYPE(*CHAR) LEN(892) DCL VAR(&RCVRLENGTH) TYPE(*CHAR) LEN(4) DCL VAR(&FORMATNAME) TYPE(*CHAR) LEN(8) + VALUE('DEVD0600') /* The format for + display devices */ DCL VAR(&ERRORCODE) TYPE(*CHAR) LEN(4) + VALUE(X'00000000') /* Use normal error + handling */ RTVJOBA JOB(&DEVICENAME) /******************************/ /* Set length of receiver */ /******************************/ CHGVAR VAR(%BIN(&RCVRLENGTH)) VALUE(892) /******************************/ /* Get device info */ /******************************/ CALL PGM(QDCRDEVD) PARM(&RECEIVER &RCVRLENGTH + &FORMATNAME &DEVICENAME &ERRORCODE) CHGVAR VAR(&IPADDR) VALUE(%SST(&RECEIVER 878 15)) CHGVAR VAR(&CMD) VALUE(&WINPGM *BCAT &SERVICE *TCAT + &URL) RUNRMTCMD CMD(&CMD) RMTLOCNAME(&IPADDR *IP) + RMTUSER(SOMEUSER) RMTPWD('somepwd') MONMSG MSGID(CPF91CC) EXEC(SNDPGMMSG MSGID(CPF9898) + MSGF(QCPFMSG) MSGDTA('Unable to start web + page')) ENDPGM: ENDPGMby Michael Ryan on Midrange-L Mailing List. http://Midrange.com
[report a broken link by clicking here]