-
Notifications
You must be signed in to change notification settings - Fork 19
/
QSHCURLC.CLP
75 lines (65 loc) · 3.87 KB
/
QSHCURLC.CLP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
PGM PARM(&CMDLINE &SETPKGPATH &DSPSTDOUT +
&LOGSTDOUT &PRTSTDOUT &DLTSTDOUT +
&IFSSTDOUT &IFSFILE &IFSOPT &CCSID +
&PRTSPLF &PRTUSRDTA &PRTTXT &PRTHOLD +
&PRTOUTQALL &PASEJOBNAM)
/*----------------------------------------------------------------------------*/
/* Variables */
/*----------------------------------------------------------------------------*/
DCL VAR(&PASEJOBNAM) TYPE(*CHAR) LEN(10)
DCL VAR(&PRTHOLD) TYPE(*CHAR) LEN(4)
DCL VAR(&PRTOUTQALL) TYPE(*CHAR) LEN(20)
DCL VAR(&PRTOUTQ) TYPE(*CHAR) LEN(10)
DCL VAR(&PRTOUTQLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&CMDLINE) TYPE(*CHAR) LEN(5000)
DCL VAR(&CURLCMDLIN) TYPE(*CHAR) LEN(5000)
DCL VAR(&SETPKGPATH) TYPE(*CHAR) LEN(4)
DCL VAR(&DSPSTDOUT) TYPE(*CHAR) LEN(4)
DCL VAR(&LOGSTDOUT) TYPE(*CHAR) LEN(4)
DCL VAR(&DLTSTDOUT) TYPE(*CHAR) LEN(4)
DCL VAR(&PRTSTDOUT) TYPE(*CHAR) LEN(4)
DCL VAR(&IFSSTDOUT) TYPE(*CHAR) LEN(4)
DCL VAR(&IFSOPT) TYPE(*CHAR) LEN(10)
DCL VAR(&IFSFILE) TYPE(*CHAR) LEN(255)
DCL VAR(&PRTSPLF) TYPE(*CHAR) LEN(10)
DCL VAR(&PRTUSRDTA) TYPE(*CHAR) LEN(10)
DCL VAR(&PRTTXT) TYPE(*CHAR) LEN(30)
DCL VAR(&QT) TYPE(*CHAR) LEN(1) VALUE('''')
DCL VAR(&CCSID) TYPE(*CHAR) LEN(10)
/*----------------------------------------------------------------------------*/
/* MONITOR FOR GLOBAL ERROR. ANY ERROR IS A CAUSE TO BLOW OUT OF HERE */
/* AND WE WANT A GRACEFUL EXIT. */
/*----------------------------------------------------------------------------*/
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS))
/*----------------------------------------------------------------------------*/
/* Extract output queue info. */
/*----------------------------------------------------------------------------*/
CHGVAR VAR(&PRTOUTQ) VALUE(%SST(&PRTOUTQALL 1 10))
CHGVAR VAR(&PRTOUTQLIB) VALUE(%SST(&PRTOUTQALL 11 10))
/*----------------------------------------------------------------------------*/
/* MAIN */
/*----------------------------------------------------------------------------*/
/* Build curl command line to pass to qshell */
CHGVAR VAR(&CURLCMDLIN) VALUE('curl' |> +
&CMDLINE)
/* Run the curl command via QSHEXEC */
QSHONI/QSHEXEC CMDLINE(&CURLCMDLIN) +
SETPKGPATH(&SETPKGPATH) +
DSPSTDOUT(&DSPSTDOUT) +
LOGSTDOUT(&LOGSTDOUT) +
PRTSTDOUT(&PRTSTDOUT) +
DLTSTDOUT(&DLTSTDOUT) +
IFSSTDOUT(&IFSSTDOUT) IFSFILE(&IFSFILE) +
IFSOPT(&IFSOPT) CCSID(&CCSID) +
PRTSPLF(&PRTSPLF) PRTUSRDTA(&PRTUSRDTA) +
PRTTXT(&PRTTXT) PRTHOLD(&PRTHOLD) +
PRTOUTQ(&PRTOUTQLIB/&PRTOUTQ) +
PASEJOBNAM(&PASEJOBNAM)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('QShell +
curl command completed') MSGTYPE(*COMP)
RETURN
ERRORS:
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('QShell +
curl command failed') MSGTYPE(*ESCAPE)
ENDPGM:
ENDPGM