WolffPack differences report |
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
|
*S****SAG GENERATOR: WW-OBJECT-SUBP Version: 3.2.2
*S****SAG TITLE: ADD Maintenance
*S****SAG SYSTEM: FINANCIER
*S****SAG OBJECT-DESC: Record
*S****SAG PRIME-FILE: WF-ADD
*S****SAG PRIME-KEY: WF-ADD-KEY
*S****SAG HOLD-FIELD: WW-HOLD
*S****SAG OBJECT-PDA: WFADDDSD
*S****SAG RESTRICTED-PDA: WFADDDSR
*S****SAG DESCS(1): This subprogram performs I/O functions for the
*S****SAG DESCS(2): WF-ADD userview/file using the WF-ADD-KEY
*S****SAG DESCS(3): primary superdescriptor.
*S*************************************************************************
*S***
*S*** WolffPack
*S***
*S*** Subprogram: WFADDDSO
*S*** System : FINANCIER
*S*** Title : ADD Maintenance
*S*** Function : This subprogram performs I/O functions for the
*S*** WF-ADD userview/file using the WF-ADD-KEY
*S*** primary superdescriptor.
*S***
*S***
*S*** Copyright 1995 - 2010 WolffPack, Inc. All rights reserved.
*S***
*S*************************************************************************
*S**DEFINE DATA
*S** GLOBAL USING WWGDA
*S** PARAMETER USING WWPDA
*S***
*S** PARAMETER USING WFADDDSD
*S** PARAMETER USING WFADDDSR
*S** PARAMETER USING WWAOBJ
*S***
*S** LOCAL
*S***
*S*** Miscellaneous local variables.
*S** 01 #CURRENT-FIELD(A32) /* Current field name being proccessed
*S** 01 #DB-CALL(A1) /* D=Delete, U=Update, S=Store
*S** 01 #D1(P3) /* Temporary indices for MU and PE
*S** 01 #D2(P3)
*S** 01 #OBJECT(A20) INIT<'Record'>
*S** 01 #OLD-REC(L) /* Record existed before.
*S** 01 #SAVE-REC(L) /* True if record is non-null.
*S** 01 #DISP-BACKOUT(L) INIT<TRUE> /* Display message on BACKOUT TRANS
*S** 01 #SAVE-MSG(A79) /* Save previously defined messages
*S***
*S*** Views used to build object.
*S***
*S*** View for histogram on NEXT action.
*S** 01 NEXT-VIEW VIEW OF WF-ADD
*S** 02 WF-ADD-KEY
*S***
*S*** Primary object entity.
*S** 01 WF-ADD VIEW OF WF-ADD
*S** 02 WF-FAO
*S** 02 WF-AID-YEAR
*S** 02 WW-NAME-LF
*S** 02 WW-SYSTEM
*S** 03 WW-HOLD
*S** 03 WW-CDATE
*S** 03 WW-MDATE
*S** 02 WF-ADD-ATTRIBUTES
*S** 03 WW-ST-NM-LAST
*S** 03 WW-ST-NM-FIRST
*S** 03 WW-ST-NM-MI
*S** 03 WW-ST-SSN
*S** 03 WW-ST-DOB
*S** 03 WF-AD-COLLEGE
*S** 03 WF-AD-SOURCE
*S** 03 WF-AD-SEND-RSN
*S** 03 WF-AD-TRAN
*S** 03 WF-AD-RCVD-DATE
*S** 03 WF-AD-NEW-REJ
*S** 02 WF-ADD-REJECT
*S** 03 WF-AD-REJ-OVERRIDE
*S** 03 WF-AD-REJ1
*S** 03 REDEFINE WF-AD-REJ1
*S** 04 WF-AD-REJ(A1)
*S** 03 WF-AD-REJ2
*S** 03 WF-AD-REJ3
*S** 03 WF-AD-REJ4
*S** 03 WF-AD-REJ5
*S** 02 WF-ADD-CORRECTIONS
*S** 03 WF-AD-C-SSN
*S** 03 WF-AD-C-DOB
*S** 03 WF-AD-C-NL
*S** 03 WF-AD-C-NF
*S** 03 WF-AD-C-NM
*S** 02 WF-ADD-RECORD
*S** 03 WF-AD-REC01
*S** 03 WF-AD-REC02
*S** 03 WF-AD-REC03
*S** 03 WF-AD-REC04
*S** 03 WF-AD-REC05
*S** 03 WF-AD-REC06
*S** 03 WF-AD-REC07
*S** 03 WF-AD-REC08
*S** 03 WF-AD-REC09
*S** 03 WF-AD-REC10
*S** 03 WF-AD-REC11
*S** 03 WF-AD-REC12
*S** 03 WF-AD-REC13
*S** 03 WF-AD-REC14
*S** 03 WF-AD-REC15
*S** 03 WF-AD-REC16
*S** 03 WF-AD-REC17
*S** 03 WF-AD-REC18
*S** 03 WF-AD-REC19
*S** 03 WF-AD-REC20
*S**END-DEFINE
*S***
*S***
*S*** Populate WW-GDA from WW-PDA
*S**MOVE BY POSITION WW-PDA TO WW-GDA
*S***
*S***
*S*** Initialize output fields.
*S**ASSIGN #SAVE-MSG = ##MSG
*S**RESET WWAOBJ.OUTPUTS ##MSG ##MSG-DATA(*) ##RETURN-CODE
*S***
*S*** Build up prime key of the object.
*S**MOVE BY NAME WFADDDSD TO WFADDDSD-ID.STRUCTURE
*S***
*S*************************************************************************
*S***
*S*** Set up repeat to allow escape from within a subroutine.
*S**PROG.
*S**REPEAT
*S***
*S*** Decide what to do based on function supplied.
*S** DECIDE ON FIRST VALUE WWAOBJ.#FUNCTION
*S** VALUE 'GET' /* Read the object
*S** /*
*S** /* Object exists, get object
*S** PERFORM GET-OBJECT
*S** PERFORM SET-OBJECT-ID
*S** VALUE 'NEXT' /* Read the next higher object
*S** /*
*S** /* Histogram for next higher value from one in object.
*S** HISTOGRAM(2) NEXT-VIEW FOR WF-ADD-KEY
*S** STARTING FROM WFADDDSD-ID
*S** IF NEXT-VIEW.WF-ADD-KEY NE WFADDDSD-ID THEN
*S** ASSIGN WFADDDSD-ID = NEXT-VIEW.WF-ADD-KEY
*S** MOVE BY NAME WFADDDSD-ID.STRUCTURE TO WFADDDSD
*S** PERFORM GET-OBJECT
*S** ASSIGN ##MSG-DATA(1) = #OBJECT
*S** ESCAPE BOTTOM
*S** END-IF
*S** END-HISTOGRAM
*S** /*
*S** /* No records beyond current record.
*S** IF NOT WWAOBJ.#EXISTS
*S** ASSIGN ##MSG = 'End of data reached'
*S** ASSIGN ##RETURN-CODE = 'W' /* Warning.
*S** END-IF
*S** VALUE 'UPDATE','DELETE' /* Modify or purge current object
*S** /*
*S** /* Make sure the record was held prior to updating.
*S** IF WFADDDSD-ID NE WFADDDSR.HELD-ID THEN
*S** ASSIGN ##MSG = 'Record not in held status'
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** PERFORM HOLD-OBJECT
*S** PERFORM SET-OBJECT-ID
*S** IF WWAOBJ.#FUNCTION = 'DELETE'
*S** ASSIGN ##MSG = 'Record purged successfully'
*S** END-IF
*S** VALUE 'EXISTS' /* Existence check
*S** PERFORM CLEAR
*S** PERFORM CHECK-EXISTENCE
*S** VALUE 'STORE' /* Add new object
*S** PERFORM CREATE-OBJECT
*S** PERFORM SET-OBJECT-ID
*S** VALUE 'INITIALIZE'
*S** PERFORM CLEAR
*S** ANY
*S** PERFORM RELOAD-MSG
*S** MOVE BY POSITION WW-GDA TO WW-PDA
*S** ESCAPE BOTTOM(PROG.) IMMEDIATE /* All done.
*S** NONE /* Unknown action code
*S** ASSIGN ##MSG-DATA(1) = #OBJECT
*S** ASSIGN ##MSG-DATA(2) = WWAOBJ.#FUNCTION
*S** ASSIGN ##MSG = 'Invalid:1:function specified::2:'
*S** PERFORM PROCESS-ERROR
*S** END-DECIDE
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE PROCESS-ERROR
*S*************************************************************************
*S***
*S** IF ##MSG-DATA(1) = ' ' /* Set default for :1:.
*S** PERFORM SET-OBJECT-ID
*S** END-IF
*S** ASSIGN ##RETURN-CODE = 'E' /* Error.
*S** IF #DISP-BACKOUT
*S** WRITE 'Issuing Backout transaction for action:' #FUNCTION
*S** / ' in subprogram' *PROGRAM
*S** END-IF
*S** BACKOUT TRANSACTION
*S** MOVE BY POSITION WW-GDA TO WW-PDA
*S** ESCAPE BOTTOM(PROG.) IMMEDIATE
*S**END-SUBROUTINE /* PROCESS-ERROR
*S***
*S**END-REPEAT
*S***
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CREATE-OBJECT
*S*************************************************************************
*S***
*S** ASSIGN WFADDDSD.WW-CDATE = *DATX
*S***
*S*** Don't allow the key to be null.
*S** IF WFADDDSD-ID = NEXT-VIEW.WF-ADD-KEY /* Compare with null
*S** ASSIGN ##MSG-DATA(1) = #OBJECT
*S** ASSIGN ##MSG = ':1:identifier is required'
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** /*
*S** /* If object already exist, return with error.
*S** PERFORM CHECK-EXISTENCE
*S** IF WWAOBJ.#EXISTS THEN
*S** ASSIGN ##MSG = ':1:already exists'
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** PERFORM EDIT-OBJECT /* Pre-edit object header
*S** ASSIGN WF-ADD.WW-HOLD = *TIMN
*S** ASSIGN WFADDDSR.INTERVENING-UPD-FLD =
*S** WF-ADD.WW-HOLD
*S** ASSIGN WFADDDSR.HELD-ID = WFADDDSD-ID
*S** STORE WF-ADD
*S**END-SUBROUTINE /* CREATE-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE GET-OBJECT
*S*************************************************************************
*S***
*S*** Get the primary object record.
*S** PERFORM CLEAR
*S** FIND WF-ADD WITH WF-ADD-KEY = WFADDDSD-ID
*S** IF NO RECORDS FOUND
*S** /*
*S** /* Return the fact that the object does not exist.
*S** ESCAPE ROUTINE
*S** END-NOREC
*S** ASSIGN WWAOBJ.#EXISTS = TRUE
*S** /*
*S** /* "Hold" the record by capturing the value of the update flag.
*S** ASSIGN WFADDDSR.INTERVENING-UPD-FLD =
*S** WF-ADD.WW-HOLD
*S** /*
*S** /* Shift primary entity information to object
*S** MOVE BY NAME WF-ADD TO WFADDDSD
*S** ASSIGN WFADDDSR.HELD-ID = WFADDDSD-ID
*S** END-FIND
*S**END-SUBROUTINE /* GET-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE HOLD-OBJECT
*S*************************************************************************
*S***
*S*** Get primary entity and process it.
*S** HOLD-PRIME.
*S** FIND WF-ADD WITH
*S** WF-ADD-KEY = WFADDDSD-ID
*S** IF NO RECORDS FOUND
*S** /*
*S** /* Trying to process an object that doesn't exist.
*S** ASSIGN ##MSG = 'Intervening purge, please try again'
*S** RESET WFADDDSR
*S** PERFORM PROCESS-ERROR
*S** END-NOREC
*S** IF WFADDDSR.INTERVENING-UPD-FLD NE
*S** WF-ADD.WW-HOLD THEN
*S** ASSIGN ##MSG = 'Intervening update, please try again'
*S** RESET WFADDDSR
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** ASSIGN WWAOBJ.#EXISTS = TRUE
*S** PERFORM EDIT-OBJECT /* Pre-edit object header
*S** DECIDE ON EVERY VALUE WWAOBJ.#FUNCTION
*S** VALUE 'UPDATE'
*S** ASSIGN WF-ADD.WW-HOLD = *TIMN
*S** ASSIGN WF-ADD.WW-MDATE = *DATX
*S** ASSIGN WFADDDSR.INTERVENING-UPD-FLD =
*S** WF-ADD.WW-HOLD
*S** UPDATE(HOLD-PRIME.)
*S** VALUE 'DELETE'
*S** DELETE(HOLD-PRIME.)
*S** RESET WFADDDSR.HELD-ID
*S** NONE IGNORE
*S** END-DECIDE
*S** END-FIND
*S**END-SUBROUTINE /* HOLD-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CHECK-AND-UPDATE-OBJECT /* Process all sub-entities
*S*************************************************************************
*S***
*S** ESCAPE ROUTINE /* No sub-entities
*S**END-SUBROUTINE /* CHECK-AND-UPDATE-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE EDIT-OBJECT
*S*************************************************************************
*S***
*S** IF WWAOBJ.#FUNCTION = 'UPDATE' OR = 'STORE'
*S** /*
*S** /* Load file view
*S** MOVE BY NAME WFADDDSD TO WF-ADD
*S** END-IF
*S**END-SUBROUTINE /* EDIT-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CHECK-EXISTENCE
*S*************************************************************************
*S***
*S*** Check whether object currently exists.
*S** EXISTENCE-CHECK.
*S** HISTOGRAM(1) NEXT-VIEW FOR WF-ADD-KEY
*S** FROM WFADDDSD-ID THRU WFADDDSD-ID
*S** ASSIGN WWAOBJ.#EXISTS = TRUE
*S** END-HISTOGRAM
*S**END-SUBROUTINE /* CHECK-EXISTENCE
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CLEAR
*S*************************************************************************
*S***
*S** MOVE BY NAME WFADDDSD TO WFADDDSD-ID.STRUCTURE /* Capture key.
*S** RESET WFADDDSD WFADDDSR
*S** MOVE BY NAME WFADDDSD-ID.STRUCTURE TO WFADDDSD /* Restore key.
*S**END-SUBROUTINE /* CLEAR
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE GET-DB-CALL
*S*************************************************************************
*S***
*S**INCLUDE WWDBCALL
*S**END-SUBROUTINE /* GET-DB-CALL
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE SET-OBJECT-ID
*S*************************************************************************
*S***
*S** COMPRESS WFADDDSD.WF-AID-YEAR
*S** '-' WFADDDSD.WF-FAO
*S** '-' WFADDDSD.WW-ST-SSN
*S** '-' WFADDDSD.WF-AD-SOURCE
*S** TO ##MSG-DATA(1) LEAVING NO
*S** COMPRESS #OBJECT ##MSG-DATA(1) TO ##MSG-DATA(1)
*S**END-SUBROUTINE /* SET-OBJECT-ID
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE RELOAD-MSG
*S*************************************************************************
*S***
*S*** If no messages set in subprogram, reset passed message
*S** IF ##MSG = ' '
*S** ASSIGN ##MSG = #SAVE-MSG
*S** END-IF
*S**END-SUBROUTINE /* RELOAD-MSG
*S**END
|
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
|
*S****SAG GENERATOR: WW-OBJECT-SUBP Version: 3.2.2
*S****SAG TITLE: ADD Maintenance
*S****SAG SYSTEM: FINANCIER
*S****SAG OBJECT-DESC: Record
*S****SAG PRIME-FILE: WF-ADD
*S****SAG PRIME-KEY: WF-ADD-KEY
*S****SAG HOLD-FIELD: WW-HOLD
*S****SAG OBJECT-PDA: WFADDDSD
*S****SAG RESTRICTED-PDA: WFADDDSR
*S****SAG DESCS(1): This subprogram performs I/O functions for the
*S****SAG DESCS(2): WF-ADD userview/file using the WF-ADD-KEY
*S****SAG DESCS(3): primary superdescriptor.
*S*************************************************************************
*S***
*S*** WolffPack
*S***
*S*** Subprogram: WFADDDSO
*S*** System : FINANCIER
*S*** Title : ADD Maintenance
*S*** Function : This subprogram performs I/O functions for the
*S*** WF-ADD userview/file using the WF-ADD-KEY
*S*** primary superdescriptor.
*S***
*S***
*S*** Copyright 1995 - 2010 WolffPack, Inc. All rights reserved.
*S***
*S*************************************************************************
*S**DEFINE DATA
*S** GLOBAL USING WWGDA
*S** PARAMETER USING WWPDA
*S***
*S** PARAMETER USING WFADDDSD
*S** PARAMETER USING WFADDDSR
*S** PARAMETER USING WWAOBJ
*S***
*S** LOCAL
*S***
*S*** Miscellaneous local variables.
*S** 01 #CURRENT-FIELD(A32) /* Current field name being proccessed
*S** 01 #DB-CALL(A1) /* D=Delete, U=Update, S=Store
*S** 01 #D1(P3) /* Temporary indices for MU and PE
*S** 01 #D2(P3)
*S** 01 #OBJECT(A20) INIT<'Record'>
*S** 01 #OLD-REC(L) /* Record existed before.
*S** 01 #SAVE-REC(L) /* True if record is non-null.
*S** 01 #DISP-BACKOUT(L) INIT<TRUE> /* Display message on BACKOUT TRANS
*S** 01 #SAVE-MSG(A79) /* Save previously defined messages
*S***
*S*** Views used to build object.
*S***
*S*** View for histogram on NEXT action.
*S** 01 NEXT-VIEW VIEW OF WF-ADD
*S** 02 WF-ADD-KEY
*S***
*S*** Primary object entity.
*S** 01 WF-ADD VIEW OF WF-ADD
*S** 02 WF-FAO
*S** 02 WF-AID-YEAR
*S** 02 WW-NAME-LF
*S** 02 WW-SYSTEM
*S** 03 WW-HOLD
*S** 03 WW-CDATE
*S** 03 WW-MDATE
*S** 02 WF-ADD-ATTRIBUTES
*S** 03 WW-ST-NM-LAST
*S** 03 WW-ST-NM-FIRST
*S** 03 WW-ST-NM-MI
*S** 03 WW-ST-SSN
*S** 03 WW-ST-DOB
*S** 03 WF-AD-COLLEGE
*S** 03 WF-AD-SOURCE
*S** 03 WF-AD-SEND-RSN
*S** 03 WF-AD-TRAN
*S** 03 WF-AD-RCVD-DATE
*S** 03 WF-AD-NEW-REJ
*S** 02 WF-ADD-REJECT
*S** 03 WF-AD-REJ-OVERRIDE
*S** 03 WF-AD-REJ1
*S** 03 REDEFINE WF-AD-REJ1
*S** 04 WF-AD-REJ(A1)
*S** 03 WF-AD-REJ2
*S** 03 WF-AD-REJ3
*S** 03 WF-AD-REJ4
*S** 03 WF-AD-REJ5
*S** 02 WF-ADD-CORRECTIONS
*S** 03 WF-AD-C-SSN
*S** 03 WF-AD-C-DOB
*S** 03 WF-AD-C-NL
*S** 03 WF-AD-C-NF
*S** 03 WF-AD-C-NM
*S** 02 WF-ADD-RECORD
*S** 03 WF-AD-REC01
*S** 03 WF-AD-REC02
*S** 03 WF-AD-REC03
*S** 03 WF-AD-REC04
*S** 03 WF-AD-REC05
*S** 03 WF-AD-REC06
*S** 03 WF-AD-REC07
*S** 03 WF-AD-REC08
*S** 03 WF-AD-REC09
*S** 03 WF-AD-REC10
*S** 03 WF-AD-REC11
*S** 03 WF-AD-REC12
*S** 03 WF-AD-REC13
*S** 03 WF-AD-REC14
*S** 03 WF-AD-REC15
*S** 03 WF-AD-REC16
*S** 03 WF-AD-REC17
*S** 03 WF-AD-REC18
*S** 03 WF-AD-REC19
*S** 03 WF-AD-REC20
*S** 03 WF-AD-REC21
*S** 03 WF-AD-REC22
*S** 03 WF-AD-REC23
*S** 03 WF-AD-REC24
*S** 03 WF-AD-REC25
*S** 03 WF-AD-REC26
*S** 03 WF-AD-REC27
*S** 03 WF-AD-REC28
*S** 03 WF-AD-REC29
*S** 03 WF-AD-REC30
*S** 03 WF-AD-REC31
*S** 03 WF-AD-REC32
*S** 03 WF-AD-REC33
*S** 03 WF-AD-REC34
*S** 03 WF-AD-REC35
*S** 03 WF-AD-REC36
*S** 03 WF-AD-REC37
*S** 03 WF-AD-REC38
*S** 03 WF-AD-REC39
*S** 03 WF-AD-REC40
*S**END-DEFINE
*S***
*S***
*S*** Populate WW-GDA from WW-PDA
*S**MOVE BY POSITION WW-PDA TO WW-GDA
*S***
*S***
*S*** Initialize output fields.
*S**ASSIGN #SAVE-MSG = ##MSG
*S**RESET WWAOBJ.OUTPUTS ##MSG ##MSG-DATA(*) ##RETURN-CODE
*S***
*S*** Build up prime key of the object.
*S**MOVE BY NAME WFADDDSD TO WFADDDSD-ID.STRUCTURE
*S***
*S*************************************************************************
*S***
*S*** Set up repeat to allow escape from within a subroutine.
*S**PROG.
*S**REPEAT
*S***
*S*** Decide what to do based on function supplied.
*S** DECIDE ON FIRST VALUE WWAOBJ.#FUNCTION
*S** VALUE 'GET' /* Read the object
*S** /*
*S** /* Object exists, get object
*S** PERFORM GET-OBJECT
*S** PERFORM SET-OBJECT-ID
*S** VALUE 'NEXT' /* Read the next higher object
*S** /*
*S** /* Histogram for next higher value from one in object.
*S** HISTOGRAM(2) NEXT-VIEW FOR WF-ADD-KEY
*S** STARTING FROM WFADDDSD-ID
*S** IF NEXT-VIEW.WF-ADD-KEY NE WFADDDSD-ID THEN
*S** ASSIGN WFADDDSD-ID = NEXT-VIEW.WF-ADD-KEY
*S** MOVE BY NAME WFADDDSD-ID.STRUCTURE TO WFADDDSD
*S** PERFORM GET-OBJECT
*S** ASSIGN ##MSG-DATA(1) = #OBJECT
*S** ESCAPE BOTTOM
*S** END-IF
*S** END-HISTOGRAM
*S** /*
*S** /* No records beyond current record.
*S** IF NOT WWAOBJ.#EXISTS
*S** ASSIGN ##MSG = 'End of data reached'
*S** ASSIGN ##RETURN-CODE = 'W' /* Warning.
*S** END-IF
*S** VALUE 'UPDATE','DELETE' /* Modify or purge current object
*S** /*
*S** /* Make sure the record was held prior to updating.
*S** IF WFADDDSD-ID NE WFADDDSR.HELD-ID THEN
*S** ASSIGN ##MSG = 'Record not in held status'
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** PERFORM HOLD-OBJECT
*S** PERFORM SET-OBJECT-ID
*S** IF WWAOBJ.#FUNCTION = 'DELETE'
*S** ASSIGN ##MSG = 'Record purged successfully'
*S** END-IF
*S** VALUE 'EXISTS' /* Existence check
*S** PERFORM CLEAR
*S** PERFORM CHECK-EXISTENCE
*S** VALUE 'STORE' /* Add new object
*S** PERFORM CREATE-OBJECT
*S** PERFORM SET-OBJECT-ID
*S** VALUE 'INITIALIZE'
*S** PERFORM CLEAR
*S** ANY
*S** PERFORM RELOAD-MSG
*S** MOVE BY POSITION WW-GDA TO WW-PDA
*S** ESCAPE BOTTOM(PROG.) IMMEDIATE /* All done.
*S** NONE /* Unknown action code
*S** ASSIGN ##MSG-DATA(1) = #OBJECT
*S** ASSIGN ##MSG-DATA(2) = WWAOBJ.#FUNCTION
*S** ASSIGN ##MSG = 'Invalid:1:function specified::2:'
*S** PERFORM PROCESS-ERROR
*S** END-DECIDE
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE PROCESS-ERROR
*S*************************************************************************
*S***
*S** IF ##MSG-DATA(1) = ' ' /* Set default for :1:.
*S** PERFORM SET-OBJECT-ID
*S** END-IF
*S** ASSIGN ##RETURN-CODE = 'E' /* Error.
*S** IF #DISP-BACKOUT
*S** WRITE 'Issuing Backout transaction for action:' #FUNCTION
*S** / ' in subprogram' *PROGRAM
*S** END-IF
*S** BACKOUT TRANSACTION
*S** MOVE BY POSITION WW-GDA TO WW-PDA
*S** ESCAPE BOTTOM(PROG.) IMMEDIATE
*S**END-SUBROUTINE /* PROCESS-ERROR
*S***
*S**END-REPEAT
*S***
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CREATE-OBJECT
*S*************************************************************************
*S***
*S** ASSIGN WFADDDSD.WW-CDATE = *DATX
*S***
*S*** Don't allow the key to be null.
*S** IF WFADDDSD-ID = NEXT-VIEW.WF-ADD-KEY /* Compare with null
*S** ASSIGN ##MSG-DATA(1) = #OBJECT
*S** ASSIGN ##MSG = ':1:identifier is required'
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** /*
*S** /* If object already exist, return with error.
*S** PERFORM CHECK-EXISTENCE
*S** IF WWAOBJ.#EXISTS THEN
*S** ASSIGN ##MSG = ':1:already exists'
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** PERFORM EDIT-OBJECT /* Pre-edit object header
*S** ASSIGN WF-ADD.WW-HOLD = *TIMN
*S** ASSIGN WFADDDSR.INTERVENING-UPD-FLD =
*S** WF-ADD.WW-HOLD
*S** ASSIGN WFADDDSR.HELD-ID = WFADDDSD-ID
*S** STORE WF-ADD
*S**END-SUBROUTINE /* CREATE-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE GET-OBJECT
*S*************************************************************************
*S***
*S*** Get the primary object record.
*S** PERFORM CLEAR
*S** FIND WF-ADD WITH WF-ADD-KEY = WFADDDSD-ID
*S** IF NO RECORDS FOUND
*S** /*
*S** /* Return the fact that the object does not exist.
*S** ESCAPE ROUTINE
*S** END-NOREC
*S** ASSIGN WWAOBJ.#EXISTS = TRUE
*S** /*
*S** /* "Hold" the record by capturing the value of the update flag.
*S** ASSIGN WFADDDSR.INTERVENING-UPD-FLD =
*S** WF-ADD.WW-HOLD
*S** /*
*S** /* Shift primary entity information to object
*S** MOVE BY NAME WF-ADD TO WFADDDSD
*S** ASSIGN WFADDDSR.HELD-ID = WFADDDSD-ID
*S** END-FIND
*S**END-SUBROUTINE /* GET-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE HOLD-OBJECT
*S*************************************************************************
*S***
*S*** Get primary entity and process it.
*S** HOLD-PRIME.
*S** FIND WF-ADD WITH
*S** WF-ADD-KEY = WFADDDSD-ID
*S** IF NO RECORDS FOUND
*S** /*
*S** /* Trying to process an object that doesn't exist.
*S** ASSIGN ##MSG = 'Intervening purge, please try again'
*S** RESET WFADDDSR
*S** PERFORM PROCESS-ERROR
*S** END-NOREC
*S** IF WFADDDSR.INTERVENING-UPD-FLD NE
*S** WF-ADD.WW-HOLD THEN
*S** ASSIGN ##MSG = 'Intervening update, please try again'
*S** RESET WFADDDSR
*S** PERFORM PROCESS-ERROR
*S** END-IF
*S** ASSIGN WWAOBJ.#EXISTS = TRUE
*S** PERFORM EDIT-OBJECT /* Pre-edit object header
*S** DECIDE ON EVERY VALUE WWAOBJ.#FUNCTION
*S** VALUE 'UPDATE'
*S** ASSIGN WF-ADD.WW-HOLD = *TIMN
*S** ASSIGN WF-ADD.WW-MDATE = *DATX
*S** ASSIGN WFADDDSR.INTERVENING-UPD-FLD =
*S** WF-ADD.WW-HOLD
*S** UPDATE(HOLD-PRIME.)
*S** VALUE 'DELETE'
*S** DELETE(HOLD-PRIME.)
*S** RESET WFADDDSR.HELD-ID
*S** NONE IGNORE
*S** END-DECIDE
*S** END-FIND
*S**END-SUBROUTINE /* HOLD-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CHECK-AND-UPDATE-OBJECT /* Process all sub-entities
*S*************************************************************************
*S***
*S** ESCAPE ROUTINE /* No sub-entities
*S**END-SUBROUTINE /* CHECK-AND-UPDATE-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE EDIT-OBJECT
*S*************************************************************************
*S***
*S** IF WWAOBJ.#FUNCTION = 'UPDATE' OR = 'STORE'
*S** /*
*S** /* Load file view
*S** MOVE BY NAME WFADDDSD TO WF-ADD
*S** END-IF
*S**END-SUBROUTINE /* EDIT-OBJECT
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CHECK-EXISTENCE
*S*************************************************************************
*S***
*S*** Check whether object currently exists.
*S** EXISTENCE-CHECK.
*S** HISTOGRAM(1) NEXT-VIEW FOR WF-ADD-KEY
*S** FROM WFADDDSD-ID THRU WFADDDSD-ID
*S** ASSIGN WWAOBJ.#EXISTS = TRUE
*S** END-HISTOGRAM
*S**END-SUBROUTINE /* CHECK-EXISTENCE
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE CLEAR
*S*************************************************************************
*S***
*S** MOVE BY NAME WFADDDSD TO WFADDDSD-ID.STRUCTURE /* Capture key.
*S** RESET WFADDDSD WFADDDSR
*S** MOVE BY NAME WFADDDSD-ID.STRUCTURE TO WFADDDSD /* Restore key.
*S**END-SUBROUTINE /* CLEAR
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE GET-DB-CALL
*S*************************************************************************
*S***
*S**INCLUDE WWDBCALL
*S**END-SUBROUTINE /* GET-DB-CALL
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE SET-OBJECT-ID
*S*************************************************************************
*S***
*S** COMPRESS WFADDDSD.WF-AID-YEAR
*S** '-' WFADDDSD.WF-FAO
*S** '-' WFADDDSD.WW-ST-SSN
*S** '-' WFADDDSD.WF-AD-SOURCE
*S** TO ##MSG-DATA(1) LEAVING NO
*S** COMPRESS #OBJECT ##MSG-DATA(1) TO ##MSG-DATA(1)
*S**END-SUBROUTINE /* SET-OBJECT-ID
*S***
*S*************************************************************************
*S**DEFINE SUBROUTINE RELOAD-MSG
*S*************************************************************************
*S***
*S*** If no messages set in subprogram, reset passed message
*S** IF ##MSG = ' '
*S** ASSIGN ##MSG = #SAVE-MSG
*S** END-IF
*S**END-SUBROUTINE /* RELOAD-MSG
*S**END
|