-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathQSHIFSSCAR.RPGLE
93 lines (77 loc) · 2.52 KB
/
QSHIFSSCAR.RPGLE
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
88
89
90
91
92
93
**free
//-------------------------------------------------------------------------------------------
// QSHLOGSCAR - Scan Qshell Log File for Selected Value(s)
//-------------------------------------------------------------------------------------------
Dcl-F STDOUTQSH DISK(1000) Usage(*Input);
Dcl-Ds *N psds;
PROGID *PROC;
End-Ds;
Dcl-Ds qshlog;
record1 char(1000);
End-Ds;
// Parameter name list passed from CL
Dcl-Ds parmscanfor;
scancount bindec(4);
scanvals char(100) dim(20);
End-Ds;
// Program *entry parameter list prototype
Dcl-pi QSHIFSSCAR;
p_values CHAR(2002);
p_exactmatch CHAR(4);
p_rtnfound CHAR(1);
p_rtnval CHAR(100);
End-pi ;
DCL-S curelem packed(5:0);
DCL-S vvalue varchar(100);
DCL-S ifound packed(5:0);
p_RtnVal=*blanks;
p_RtnFound='0';
// Initialize parm arrays from passed in values
p_rtnfound='0';
parmscanfor=p_values;
// If no scan value passed, bail out now
if (scancount=0);
p_RtnFound='0';
*inlr=*on;
return;
endif;
// Set to beginning of file
setll *start STDOUTQSH;
// Read all selected documents and extract keywords ------------------------
dou %eof(STDOUTQSH);
// Read next record
read STDOUTQSH qshlog;
// If end of file, exit process loop
if %eof(STDOUTQSH);
p_RtnFound='0';
*inlr=*on;
return;
endif;
// Loop through all passed in values
// for current file data line.
// Once a value is found, exit
for curelem = 1 to scancount;
// Extract scanfor value
vvalue=%trim(scanvals(curelem));
// See if an exact value match to log entry ?
if p_ExactMatch = '*YES' ;
if %trim(vvalue) = %trim(QSHLOG);
p_rtnval=vvalue;
p_RtnFound='1';
*inlr=*on;
return;
endif;
// Do a contains search to check for value in string
else;
if %scan(%trim(vvalue):qshlog) > 0;
p_rtnval=vvalue;
p_RtnFound='1';
*inlr=*on;
return;
endif;
endif;
endfor;
enddo;
// Exit
*inlr=*on;
return;