-
Notifications
You must be signed in to change notification settings - Fork 19
/
QSHBASHC.CLLE
87 lines (76 loc) · 4.61 KB
/
QSHBASHC.CLLE
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
76
77
78
79
80
81
82
83
84
85
86
87
PGM PARM(&CMDLINE &SETPKGPATH &DSPSTDOUT +
&LOGSTDOUT &PRTSTDOUT &DLTSTDOUT +
&IFSSTDOUT &IFSFILE &IFSOPT &CCSID +
&PRTSPLF &PRTUSRDTA &PRTTXT &PRTHOLD +
&PRTOUTQALL &OUTFILE &MBROPT &PASEJOBNAM)
/*----------------------------------------------------------------------------*/
/* Variables */
/*----------------------------------------------------------------------------*/
DCL VAR(&PASEJOBNAM) TYPE(*CHAR) LEN(10)
DCL VAR(&MBROPT) TYPE(*CHAR) LEN(10)
DCL VAR(&OUTFILE) TYPE(*CHAR) LEN(20)
DCL VAR(&OUTFILPATH) TYPE(*CHAR) LEN(255)
DCL VAR(&OFILE) TYPE(*CHAR) LEN(10)
DCL VAR(&OLIB) 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(&BSHCMDLINE) 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))
/*----------------------------------------------------------------------------*/
/* Extract output file info. Added V1.0.16 */
/*----------------------------------------------------------------------------*/
CHGVAR VAR(&OFILE) VALUE(%SST(&OUTFILE 1 10))
CHGVAR VAR(&OLIB) VALUE(%SST(&OUTFILE 11 10))
/*----------------------------------------------------------------------------*/
/* MAIN */
/*----------------------------------------------------------------------------*/
/* Build bash command line to pass to qshell */
CHGVAR VAR(&BSHCMDLINE) VALUE('bash -c' |> &QT |< +
&CMDLINE |< &QT)
/* Run the bash command via QSHEXEC */
QSHONI/QSHEXEC CMDLINE(&BSHCMDLINE) +
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) +
OUTFILE(&OLIB/&OFILE) MBROPT(&MBROPT) +
PASEJOBNAM(&PASEJOBNAM)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('QShell +
bash command completed') MSGTYPE(*COMP)
RETURN
ERRORS:
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('QShell +
bash command failed') MSGTYPE(*ESCAPE)
ENDPGM:
ENDPGM