-
Notifications
You must be signed in to change notification settings - Fork 19
/
QSHDEMO01R.RPGLE
64 lines (48 loc) · 1.76 KB
/
QSHDEMO01R.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
//-------------------------------------------------------------------------------------------
// QSHDEMO01R - Read QSHELL log file STDOUTQSH from QTEMP and display
// the first 52 bytes of each record with DSPLY as an
// example. Your apps could do whatever they want with
// the returned data.
//-------------------------------------------------------------------------------------------
Dcl-F STDOUTQSH DISK(1000) Usage(*Input) USROPN;
Dcl-Ds *N psds;
PROGID *PROC;
End-Ds;
Dcl-Ds qshlogrec;
record1 char(1000);
End-Ds;
Dcl-S recdsp1 Char(52);
Dcl-S p_Value Char(1024);
Dcl-S p_ExactMatch char(4);
Dcl-S p_RtnFound char(1);
C* *entry plist
C* parm p_Value
C* parm p_ExactMatch
C* parm p_RtnFound
p_RtnFound='0';
// Monitor for errors
monitor;
// Attempt to open file
open STDOUTQSH;
// Set to beginning of file
setll *start STDOUTQSH;
// Read all records from the STDOUTQSH log file and process
// as needed. This example simply displays each entry.
dou %eof(STDOUTQSH);
// Read next record
READ STDOUTQSH qshlogrec;
// If end of file, exit process loop
if %eof(STDOUTQSH);
leave;
endif;
recdsp1=record1;
DSPLY recdsp1;
enddo;
// Attempt to close file
close stdoutqsh;
ON-ERROR;
DSPLY 'Error occured. Check joblog.';
ENDMON;
// Exit program. we're done
*inlr=*on;
return;