-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCDFCSI.asm
423 lines (423 loc) · 14.8 KB
/
RCDFCSI.asm
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
RCDFCSI TITLE 'RCDFCSI - UDTF call Catalog Search Interface'
RCDFCSI CEEENTRY AUTO=WORKSIZE,MAIN=YES,PLIST=OS
*----------------------------------------------------------------------
* RCDFCSI - Catalog Search Interface
*----------------------------------------------------------------------
yregs
using worka,r13
lr r10,r1 get pointer to parm
using parm,r10
* bras r14,debug
l r1,scratch
l r9,4(r1) get scr
l r2,calltype
clc 0(4,r2),=F'-2' SQLUDF_TF_FIRST -2
jne open
bras r14,checkp
j end
open clc 0(4,r2),=F'-1' SQLUDF_TF_OPEN -1
jne fetch
bras r14,alloc
j end
fetch clc 0(4,r2),=F'0' SQLUDF_TF_FETCH 0
jne close
bras r14,nextmemb
j end
close clc 0(4,r2),=F'1' SQLUDF_TF_CLOSE 1
jne final
bras r14,free
j end
final clc 0(4,r2),=F'2' SQLUDF_TF_FINAL 2
jne end
end ceeterm rc=0
*----------------------------------------------------------------------
* debug
*----------------------------------------------------------------------
debug st r14,debug_s
mvc debugl(2),=al2(80)
mvc debugt,=cl80' '
mvc debugt+0(8),=CL8'RCDFCSI'
l r1,calltype
mvc debugt+10(4),0(r1)
l r1,sqlstate
mvc debugt+20(5),0(r1)
mvc wto1(mwtol),mwto
la r3,debugl
wto text=(r3),mf=(E,wto1)
l r14,debug_s
br r14
*----------------------------------------------------------------------
* Checkp
*----------------------------------------------------------------------
checkp st r14,checkp_s
* mask
l r1,imask
clc 0(2,r1),=h'0'
jne invalid
l r1,mask
clc 0(2,r1),=h'0'
je invalid
clc 0(2,r1),=h'44'
jh invalid
* seltype
l r1,iseltype
clc 0(2,r1),=h'0'
je checkpr
l r1,seltype
clc 0(2,r1),=h'16'
jh invali2
checkpr l r14,checkp_s
br r14
invalid l r1,sqlstate
mvc 0(5,r1),=CL5'38601'
l r1,msgtxt
mvc 0(2,r1),=h'27'
mvc 2(27,r1),=cl27'Invalid parm value. Token 1'
j checkpr
invali2 l r1,sqlstate
mvc 0(5,r1),=CL5'38601'
l r1,msgtxt
mvc 0(2,r1),=h'27'
mvc 2(27,r1),=cl27'Invalid parm value. Token 2'
j checkpr
*----------------------------------------------------------------------
* Alloc
*----------------------------------------------------------------------
alloc st r14,alloc_s
storage OBTAIN,length=scrsize,loc=31 working storage
lr r9,r1
using scr,r9
l r1,scratch
st r9,4(r1) save scr in scratch
la r2,selcrita
using csifield,r2
mvc csicatnm,=cl44' '
mvc csiresnm,=cl44' '
mvc csidtypd(16),=cl16' '
mvc csiopts,=c'Y '
mvc csinumen,=h'2'
mvc csifiltk,=cl44' '
l r1,mask
lh r3,0(r1)
bctr r3,0
movefil mvc csifiltk(0),2(r1)
ex r3,movefil
l r1,seltype
ltr r1,r1
jz entries
lh r3,0(r1)
ltr r3,r3
jz entries
bctr r3,0
movesel mvc csidtypd(0),2(r1)
ex r3,movesel
entries mvc csients(16),=cl16'VOLSER DEVTYP '
drop r2
mvc buffcsi+0(4),=al4(l'buffcsi)
la r1,reasona
st r1,w1
la r1,selcrita
st r1,w2
la r1,buffcsi
st r1,w3
oi w3,x'80'
bras r14,callcsi
c r15,=f'8'
jnl allocerr
allocr l r14,alloc_s
br r14
allocerr l r1,sqlstate
mvc 0(5,r1),=cl5'38602'
l r1,msgtxt
mvc 0(2,r1),=h'26'
mvc 2(14,r1),=c'CSI error, rs:'
mvc 22(4,r1),reasona
mvi 26(r1),x'00'
unpk 17(9,r1),22(5,r1)
j allocr
*----------------------------------------------------------------------
* Call CSI
*----------------------------------------------------------------------
callcsi st r14,callcsi_s
la r1,w1
link ep=IGGCSI00
la r1,buffcsi
using csirwork,r1
lr r3,r1
a r3,csiusdln
la r2,head_end
lh r6,csinumfd
drop r1
st r2,saver2
st r3,saver3
st r6,saver6
l r14,callcsi_s
br r14
*----------------------------------------------------------------------
* Free
*----------------------------------------------------------------------
free st r14,free_s
storage RELEASE,length=scrsize,addr=(r9)
l r14,free_s
br r14
*----------------------------------------------------------------------
* Nextmemb
*----------------------------------------------------------------------
nextmemb st r14,nextmemb_s
l r2,saver2
l r3,saver3
l r6,saver6
using iggcsi_entry,r2
nextb cr r2,r3
jnl eob
cli csietype,x'F0' Cat Entry
jne entr
drop r2
using iggcsi_catalog,r2
la r2,csicente
j nextb
drop r2
using iggcsi_entry,r2
entr bras r14,fields
tm csieflag,csienter
bo nodata
lh r1,csitotln
b nextryp
nodata la r1,4
nextryp la r2,csiedata
ar r2,r1
drop r2
nextmembr st r2,saver2
l r14,nextmemb_s
br r14
eof equ *
l r1,sqlstate
mvc 0(5,r1),=CL5'02000'
j nextmembr
eob la r1,selcrita
using csifield,r1
cli csiresum,c'Y'
jne eof
drop r1
bras r14,callcsi
c r15,=f'8'
jl nextb
l r1,sqlstate
mvc 0(5,r1),=cl5'38602'
l r1,msgtxt
mvc 0(2,r1),=h'26'
mvc 2(14,r1),=c'CSI error, rs:'
mvc 22(4,r1),reasona
mvi 26(r1),x'00'
unpk 17(9,r1),22(5,r1)
j nextmembr
*----------------------------------------------------------------------
* Fields
*----------------------------------------------------------------------
fields st r14,fields_s
using iggcsi_entry,r2
fname l r1,entry
mvc 0(44,r1),csiename
l r1,ientry
mvc 0(2,r1),=h'0'
ftype l r1,type
mvc 0(1,r1),csietype
l r1,itype
mvc 0(2,r1),=h'0'
la r4,csilenf1
lr r7,r4
bctr r6,0
sll r6,1
ar r7,r6
tm csieflag,csiedata_f
jz eor
fvolser l r1,ivolser
mvc 0(2,r1),=h'-1'
lh r5,0(r4)
ch r5,=h'0'
jle fdevt
l r1,volser
sth r5,0(r1)
bctr r5,0
movvol mvc 2(0,r1),0(r7)
ex r5,movvol
ar r7,r5
la r7,1(r7)
l r1,ivolser
mvc 0(2,r1),=h'0'
fdevt la r4,2(r4)
l r1,idevtype
mvc 0(2,r1),=h'-1'
lh r5,0(r4)
ch r5,=h'0'
jle eor
l r1,devtype
sth r5,0(r1)
bctr r5,0
movdev mvc 2(0,r1),0(r7)
ex r5,movdev
ar r7,r5
la r7,1(r7)
l r1,idevtype
mvc 0(2,r1),=h'0'
eor l r14,fields_s
br r14
drop r2
*----------------------------------------------------------------------
* constants
*----------------------------------------------------------------------
ppa ceeppa , constants describing the code block
ltorg , place literal pool here
mwto WTO TEXT=,MF=L
mwtol EQU *-mwto
*----------------------------------------------------------------------
* work
*----------------------------------------------------------------------
worka dsect
org *+ceedsasz leave space for dsa fixed part
ds 0d
alloc_s ds a
free_s ds a
checkp_s ds a
nextmemb_s ds a
callcsi_s ds a
fields_s ds a
debug_s ds a
wto1 ds xl(mwtol)
debugl ds xl2
debugt ds cl80
worksize equ *-worka
*----------------------------------------------------------------------
* workarea en scratchpad
*----------------------------------------------------------------------
scr dsect
saver2 ds f
saver3 ds f
saver6 ds f
w1 ds a
w2 ds a
w3 ds a
reasona ds f
ds 0d
selcrita ds xl(l_csifield)
l_csifield equ (csients-csifield)+800
ds 0d
buffcsi ds xl(64000)
scrsize equ *-scr
*----------------------------------------------------------------------
* mapas
*----------------------------------------------------------------------
ceedsa , mapping of the dynamic save area
ceecaa , mapping of the common anchor area
COPY IGGCSINA
CSIRWORK DSECT CSI RETURN WORK AREA
CSIUSRLN DS F TOTAL LENGTH OF WORK AREA. USER PROVIDED.
CSIREQLN DS F MINIMUM REQUIRED WORK AREA FOR 1 CATALOG
* NAME ENTRY AND 1 DATA ENTRY
CSIUSDLN DS F TOTAL LENGTH OF WORK AREA USED IN
* RETURNING ENTRIES.
CSINUMFD DS H NUMBER OF FIELD NAMES PLUS 1.
HEAD_END EQU *
*
IGGCSI_CATALOG DSECT
CSISFLG DS X CATALOG FLAG INFORMATION
CSINTICF EQU X'80' NON-ICF CATALOG, NOT SUPPORTED.
CSINOENT EQU X'40' NO ENTRY FOUND FOR THIS CATALOG.
CSINTCMP EQU X'20' DATA GOTTEN FOR THIS CATALOG IS NOT
* COMPLETE.
CSICERR EQU X'10' WHOLE CATALOG NOT PROCESSED DUE TO ERROR.
CSICERRP EQU X'08' CATALOG PARTIALLY PROCESSED DUE TO ERROR.
* X'07' RESERVED.
CSICTYPE DS C CATALOG TYPE. HEX 'F0'
CSICNAME DS CL44 CATALOG NAME
CSICRETN DS 0CL4 RETURN INFORMATION FOR CATALOG.
CSICRETM DS CL2 CATALOG RETURN MODULE ID
CSICRETR DS X CATALOG RETURN REASON CODE
CSICRETC DS X CATALOG RETURN CODE
CSICENTE EQU *
*
IGGCSI_ENTRY DSECT
CSIEFLAG DS X ENTRY FLAG INFORMATION.
CSIPMENT EQU X'80' PRIMARY ENTRY.
* 0.... .... THIS ENTRY ASSOCIATES
* WITH THE PRECEDING
* PRIMARY ENTRY.
CSIENTER EQU X'40' ERROR INDICATION IS SET
* FOR THIS ENTRY AND ERROR
* CODE FOLLOWS CSIENAME.
CSIEDATA_F EQU X'20' DATA IS RETURNED FOR
* THIS ENTRY.
* ...1 1111 RESERVED.
CSIETYPE DS C ENTRY TYPE.
* A NON-VSAM DATA SET
* B GENERATION DATA GROUP
* C CLUSTER
* D DATA COMPONENT
* G ALTERNATE INDEX
* H GENERATION DATA SET
* I INDEX COMPONENT
* R PATH
* X ALIAS (MVS/DFP 3.2.0.AND LATER ONLY)
* U USER CATALOG CONNECTOR ENTRY
* (MVS/DFP 3.2.0 AND LATER ONLY)
* L ATL LIBRARY ENTRY
* (DFSMS/MVS 1.1.0 AND LATER ONLY)
* W ATL VOLUME ENTRY
* (DFSMS/MVS 1.1.0 AND LATER ONLY)
CSIENAME DS CL44 ENTRY NAME.
CSIERETN DS 0CL4 ERROR RETURN INFORMATION
* FOR ENTRY. ONLY EXISTS
* IF CSIENTER IS 1.
CSIERETM DS CL2 ENTRY RETURN MODULE ID
CSIERETR DS X ENTRY RETURN REASON CODE
CSIERETC DS X ENTRY RETURN CODE
ORG CSIERETN
CSIEDATA EQU * RETURNED DATA FOR ENTRY.
* ONLY EXISTS IF CSIENTER
* IS 0.
CSITOTLN DS XL2 TOTAL LENGTH OF RETURNED
* INFORMATION INCLUDING
* THIS FIELD AND LENGTH
* FIELDS. THE NEXT ENTRY
* BEGINS AT THIS OFFSET
* PLUS THIS LENGTH.
DS XL2 RESERVED.
CSILENFD DS 0XL2 LENGTH OF FIELDS. THERE
* IS ONE LENGTH FIELD
* RETURNED FOR EACH FIELD
* NAME PASSED ON INPUT.
CSILENF1 DS XL2 FIRST LENGTH FIELD.
*
IGGCSI_FIELD DSECT
CSIFDDAT EQU * FIELD DATA. FOR EACH
* FIELD NAME PASSED ON
* INPUT, THERE WILL BE A
* DATA ITEM CORRESPONDING
* TO ITS LENGTH.
* THE NEXT ENTRY WOULD
* BEGIN HERE IF MORE THAN
* 1 ENTRY IS RETURNED.
* THE NEXT CATALOG ENTRY
* WOULD BEGIN AFTER ALL OF
* THE ENTRIES IF MORE THAN
* 1 CATALOG IS SEARCHED.
parm dsect
mask ds a pointer to mask - input
seltype ds a pointer to seltype - input
entry ds a pointer to entry - output
type ds a pointer to type - output
volser ds a pointer to volser- output
devtype ds a pointer to devtype - output
imask ds a pointer to mask indicator
iseltype ds a pointer to seltype indicator
ientry ds a pointer to entry indicator
itype ds a pointer to type indicator
ivolser ds a pointer to volser indicator
idevtype ds a pointer to devtype indicator
sqlstate ds a pointer to sql state
family ds a pointer to function family name
specific ds a pointer to function specific name
msgtxt ds a pointer to diagnostic message
scratch ds a pointer to scratch patch area
calltype ds a pointer to call type parameter
end RCDFCSI