-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVALLSRCP.MBR
More file actions
251 lines (198 loc) · 8.07 KB
/
Copy pathVALLSRCP.MBR
File metadata and controls
251 lines (198 loc) · 8.07 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
‚* Project : AB Utilities *
‚* Programmer : Ashish Bagaddeo *
‚* Date : 01/01/2014 *
‚* Description : This program will search all the libraries and *
‚* files to find the source members. *
‚* © Copyright : iCORE® mailto: support§icore.co.in *
‚**********************************************************************
H Debug Option(*NoDebugIO)
H CopyRight('iCORE® - Ashish Bagaddeo')
‚* File Specification
FVALLSRCD CF E WORKSTN SFILE(SRCSFL:SFLRRN)
‚* Variable Declaration
DVarDs1 DS
D Wk_Command 300 Inz(*Blanks)
D Wk_CmdLen 15P 5 Inz(*Zeros)
D SFLRRN 4 0 Inz(*Zeros)
‚* Indicators
D InKyPtr S * Inz(%ADDR(*IN))
DSubFileInd DS 99 Based(InKyPtr)
D SflDsp N Overlay(SubFileInd: 30)
D SflClr N Overlay(SubFileInd: 31)
D SflEnd N Overlay(SubFileInd: 32)
‚* Constants
DUCase C CONST('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
DLCase C CONST('abcdefghijklmnopqrstuvwxyz')
‚* Data Structures
‚* Subfile Data Structure
DSubFileDs DS
DSRCFILE 10
DSRCTYPE 10
DSRCLIBL 10
DSRCDESC 30
‚* Cursor Data Structure
DSrcFileDS DS
DSFile 10
DSLibl 10
DMbrRcvVar DS
D BytesRtn 10I 0
D BytesSize 10I 0
D MFileName 10
D MFileLibl 10
D MMbrName 10
D MFileAttb 10
D MSrcType 10
D MCrtDateT 13
D MLstDateT 13
D MMbrDesc 50
D MSrcFile 1
‚* Prototypes
D RtvMbrDsc PR EXTPGM('QUSRMBRD')
d RcvVar 135A
d RcvVarLen 10I 0 CONST
d FmtName 8A CONST
d FileName 20A CONST
d MbrName 10A CONST
d OvrProc 1A CONST
d ApiError 272A
d FndMbrProc 1A CONST
‚* Copybooks
/Copy RPGUTILS,CPYBK
D VALLSRCP PI
D InObjNm 10
D FndFlg N
/Free
// ----------------------------------------------------------
// Program Starts -
// ----------------------------------------------------------
// Set SQL Options
Exec SQL
SET OPTION COMMIT = *NONE, CLOSQLCSR = *ENDMOD;
// Initialize Variables
InObjNm = %XLate(LCase:UCase:InObjNm);
OBJNAME = InObjNm ;
FndFlg = *Off;
// Declare Cursor & Open Cursor
ExSr $DecCurSor;
// Find all source files and display
Exsr $Display;
// Close Cursor
ExSr $CloseCur;
// Exit Program
ExSr $ExitPgm;
// ----------------------------------------------------------
// Subroutines -
// ----------------------------------------------------------
// ----------------------------------------
// $Display - Display Screen
// ----------------------------------------
BegSr $Display;
ExSr $LoadSubFile;
If SflDsp = *On;
DoU *In03 = *On Or *In12 = *On;
Write HEADER;
Write FOOTER;
ExFmt SRCSFLCTL;
If *In03 <> *On And *In12 <> *On And RELRCD <> 0;
Chain RELRCD SRCSFL;
ExSr $ShowSource;
EndIf;
EndDo;
EndIf;
EndSr;
// ----------------------------------------
// $LoadSubFile - Load Subfile
// ----------------------------------------
BegSr $LoadSubFile;
SflClr = *On;
Write SRCSFLCTL;
SflClr = *Off;
SflRRN = 0;
ExSr $FetchNxt;
DoW SQLCOD = 0 And SflRRN < 9999;
Reset ApiErrorDs;
Reset MbrRcvVar;
ExSr $RtvMbrDsc;
If ApiErrorDs.MsgId = *Blanks;
SRCFILE = SFile;
SRCTYPE = MSrcType;
SRCLIBL = SLibl;
SRCDESC = MMbrDesc;
SflRRN += 1;
Write SRCSFL;
EndIf;
ExSr $FetchNxt;
EndDo;
If SflRRN > 0;
SflDsp = *On;
SflEnd = *On;
FndFlg = *On;
EndIf;
EndSr;
// ----------------------------------------
// $RtvMbrDsc - Retrive Member Description
// ----------------------------------------
BegSr $RtvMbrDsc;
CallP(E) RtvMbrDsc( MbrRcvVar
: %Size(MbrRcvVar)
: 'MBRD0100'
: Sfile + SLibl
: InObjNm
: '0'
: ApiErrorDS
: '1');
EndSr;
// ---------------------------------
// $ShowSource - Show Source Member
// ---------------------------------
BegSr $ShowSource;
Wk_Command = 'STRSEU' +
' SRCFILE(' + %Trim(SRCLIBL) + '/' +
%Trim(SRCFILE) + ')' +
' SRCMBR(' + %Trim(InObjNm ) + ')' +
' OPTION(5)';
Wk_CmdLen = %Len(%Trim(Wk_Command));
CallP(E) RunCmd(Wk_Command:Wk_CmdLen);
EndSr;
// ------------------------
// $ExitPgm - Exit Program
// ------------------------
BegSr $ExitPgm;
*InLr = *On;
Return;
EndSr;
/End-Free
‚* // -------------------------------------
‚* // $DecCurSor - Declare and Open Cursor
‚* // -------------------------------------
C $DecCurSor BegSr
C/EXEC SQL
C+ CLOSE SFILECUR
C/END-EXEC
C/EXEC SQL
C+ DECLARE SFILECUR CURSOR FOR
C+ SELECT DBXFIL, LIBNAM FROM LIBLISTF A, QADBXDIC B WHERE
C+ A.LIBNAM = B.DBXLIB AND B.DBXTYP = 'S'
C+ AND A.LIBTY1 IN ('S', 'B')
C+ FOR FETCH ONLY
C/END-EXEC
C/EXEC SQL
C+ OPEN SFILECUR
C/END-EXEC
C EndSr
‚* // ------------------------------------------
‚* // $FetchNxt - Fetch next record from cursor
‚* // ------------------------------------------
C $FetchNxt BegSr
C/EXEC SQL
C+ FETCH SFILECUR INTO :SRCFILEDS
C/END-EXEC
C EndSr
‚* // ------------------------------------------
‚* // $CloseCur - Close Cursor
‚* // ------------------------------------------
C $CloseCur BegSr
C/EXEC SQL
C+ CLOSE SFILECUR
C/END-EXEC
C EndSr