-
Notifications
You must be signed in to change notification settings - Fork 20
/
QSHPORTCHC.CLP
55 lines (47 loc) · 2.72 KB
/
QSHPORTCHC.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
PGM PARM(&LOCALPORT &CONNTYPE &OUTFILE)
DCL VAR(&LOCALPORT) TYPE(*DEC) LEN(5)
DCL VAR(&CONNTYPE) TYPE(*CHAR) LEN(4)
DCL VAR(&EMPTYERROR) TYPE(*CHAR) LEN(4)
DCL VAR(&IFILE) TYPE(*CHAR) LEN(10) VALUE(QCUSTCDT)
DCL VAR(&ILIB) TYPE(*CHAR) LEN(10) VALUE(QIWS)
DCL VAR(&OUTFILE) TYPE(*CHAR) LEN(20)
DCL VAR(&TEMPFILE) TYPE(*CHAR) LEN(10) VALUE(CUST1)
DCL VAR(&TEMPLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&SQL) TYPE(*CHAR) LEN(5000)
DCL VAR(&SQLQUERY) TYPE(*CHAR) LEN(5000)
DCL VAR(&RECORDS) TYPE(*DEC) LEN(10)
DCL VAR(&RECORDSC) TYPE(*CHAR) LEN(10)
DCL VAR(&COMPMSGTYP) TYPE(*CHAR) LEN(10) +
VALUE(*COMP)
DCL VAR(&QT) TYPE(*CHAR) LEN(1) VALUE('''')
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS))
/*----------------------------------------------------------------------------*/
/* Set up SQL query for port */
/*----------------------------------------------------------------------------*/
CHGVAR VAR(&SQL) VALUE('SELECT * FROM +
QSYS2.NETSTAT_INFO WHERE +
CONNECTION_TYPE=' |< &QT |< &CONNTYPE |< +
&QT |> 'AND LOCAL_PORT=' |< +
%CHAR(&LOCALPORT))
/*----------------------------------------------------------------------------*/
/* Parse outfile parm */
/*----------------------------------------------------------------------------*/
CHGVAR VAR(&TEMPLIB) VALUE(%SST(&OUTFILE 11 10))
CHGVAR VAR(&TEMPFILE) VALUE(%SST(&OUTFILE 1 10))
/*----------------------------------------------------------------------------*/
/* Run the DB2 services query */
/*----------------------------------------------------------------------------*/
QSHONI/QSHQRYTMP SQL(&SQL) OUTFILE(&TEMPLIB/&TEMPFILE) +
EMPTYERROR(*YES)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Port' +
|> %CHAR(&LOCALPORT) |> 'appears to be +
active on connection type' |> &CONNTYPE) +
MSGTYPE(*COMP)
RETURN
ERRORS:
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Errors +
occurred running TCP port' |> +
%CHAR(&LOCALPORT) |> 'check. Most likely +
the selected port is not active') +
MSGTYPE(*ESCAPE)
ENDPGM