Menu

[r26]: / common / systemRES.cbl  Maximize  Restore  History

Download this file

314 lines (313 with data), 12.2 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
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
>>source free
*>********************************************
*> *
*> System REStore in the System file *
*> For all four records *
*> From a seq file. *
*> *
*>********************************************
*>
identification division.
program-id. SystemRES.
*>**
*> author. Vincent Bryan Coen, FBCS, FIDM, FIDPM, CPL.
*> For Applewood Computers.
*>**
*> Security. Copyright (C) 2016 - 2025 & later, Vincent Bryan Coen.
*> Distributed under the GNU General Public License.
*> See the file COPYING for details.
*>**
*> Written. 3 June 2023.
*>**
*> Remarks. This module only uses the System file but all four records.
*>
*> This outputs copy of file record/s from source as a ISAM
*> records to a Sequential file with extension of .seq and
*> acts as a back up use prognameRES to restore the file.
*> If the file exists but produces any errors because of
*> a bad file** etc, it will attempt to read the RDB table
*> instead, and a message to that effect will be issued.
*>
*> ** This can occur if a change of ISAM library is used
*> where the new one is incompatable with the old one.
*>
*> ALL program output goes to file SYS-DISPLAY.log as an
*> extended opened file. So after finishing reading,
*> delete it.
*>
*> This program creates FOUR records in ORDER :
*> Parameter
*> Default
*> Final
*> Totals - SL & PL.
*>
*> ALL RECORDS USE 1024 BYTES AS PER THE SIZE OF THE PARAM RECORD.
*>
*> For use with ACAS v3.02 and later only.
*>**
*> Version. See prog-name in Ws.
*>**
*> Called Modules. ACAS-Sysout
*>**
*> Error messages used.
*> SY001A.
*> SY001B.
*> SY001C.
*> SY001D.
*> SY004.
*> SY007.
*> SY008.
*> SY009.
*> SY019.
*> SY020
*>**
*> Changes.
*> 28/05/23 vbc - .00 systemRES Source taken from systemLD and vers reset.
*> .01 Logic adjust if rdb details in file rec etc.
*> 29/05/23 vbc - .02 Tidy up o/p to SYS-DISPLAY.log reporting DB status.
*> 30/05/23 vbc - .03 Add rec counts in, created and total out to rep file.
*> 03/06/23 vbc - .00 Created from systemUNL.
*> 16/04/24 vbc Copyright notice update superseding all previous notices.
*>**
*>
*>*************************************************************************
*>
*> From copyright.cob.
*>
*> Copyright Notice.
*> ****************
*>
*> This notice supersedes all prior copyright notices & was updated 2024-04-16.
*>
*> These files and programs are part of the Applewood Computers Accounting
*> System and is Copyright (c) Vincent B Coen. 1976-2025 and later.
*>
*> This program is now free software; you can redistribute it and/or modify it
*> under the terms listed here and of the GNU General Public License as
*> published by the Free Software Foundation; version 3 and later as revised
*> for PERSONAL USAGE ONLY and that includes for use within a business but
*> EXCLUDES repackaging or for Resale, Rental or Hire in ANY way.
*>
*> Persons interested in repackaging, redevelopment for the purpose of resale or
*> distribution in a rental or hire mode must get in touch with the copyright
*> holder with your commercial plans and proposals.
*>
*> ACAS is distributed in the hope that it will be useful, but WITHOUT
*> ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
*> FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
*> for more details. If it breaks, you own both pieces but I will endeavour
*> to fix it, providing you tell me about the problem.
*>
*> You should have received a copy of the GNU General Public License along
*> with ACAS; see the file COPYING. If not, write to the Free Software
*> Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*>
*>*************************************************************************
*>
*>
environment division.
*>-------------------
*>
copy "envdiv.cob".
input-output section.
*>------------------------------
*>
file-control.
*>-----------
*>
copy "selsys.cob".
select System-File-Seq assign "system.seq"
organization sequential
status FS-Reply.
*>
data division.
*>------------
*>
file section.
*>-----------
*>
copy "fdsys.cob".
fd system-file-seq.
copy "wssystem.cob" replacing System-Record by System-Record-Seq
File-System-Used by WS-File-System-Used
File-Duplicates-In-Use by WS-File-Duplicates-In-Use
FS-Cobol-Files-Used by WS-FS-Cobol-Files-Used
FS-Duplicate-Processing by WS-FS-Duplicate-Processing
RDBMS-DB-Name by WS-RDBMS-DB-Name
RDBMS-User by WS-RDBMS-User
RDBMS-Passwd by WS-RDBMS-Passwd
RDBMS-Port by WS-RDBMS-Port
RDBMS-Host by WS-RDBMS-Host
RDBMS-Socket by WS-RDBMS-Socket.
*>
working-storage section.
*>----------------------
77 prog-name pic x(20) value "SystemRES (3.02.03)".
77 z binary-char value zero.
77 OS-Delimiter pic x value "/".
77 ACAS_BIN pic x(512) value spaces.
77 ACAS_LEDGERS pic x(500) value spaces.
77 Arg-Number pic 9 value zero.
*>
*> holds program parameter values from command line
01 Arg-Vals value spaces.
03 Arg-Value pic x(525) occurs 2.
01 Arg-Test pic x(525) value spaces.
*>
01 work-fields.
03 ws-Rec-Cnt-In pic 9999 value zero.
03 ws-Rec-Cnt-Out pic 9999 value zero.
03 ws-Rec-Cnt-R-Out pic 9999 value zero.
03 ws-reply pic x.
03 WS-Temp-Text pic x(40) value spaces.
03 WS-Dflt-Flag pic 9 value 1. *> record read
03 WS-Final-Flag pic 9 value 1. *> ditto
03 WS-Sys4-Flag pic 9 value 1. *> ditto
03 WS-Rec-Length-1 pic 9(5) value zero.
*>
01 SO-Print pic x(160) value spaces.
*>
copy "Test-Data-Flags.cob". *> set sw-testing to zero to stop logging.
*>
copy "wssystem.cob" replacing System-Record by WS-System-Record.
copy "wsdflt.cob". *> rec 2 - defaults
copy "wsfinal.cob". *> rec 3 - Final accounts
copy "wssys4.cob". *> rec 4 - totals for sales and purchase
copy "wsfnctn.cob".
copy "wsnames.cob".
copy "wscall.cob".
*>
01 Error-Messages.
03 SY001A pic x(28) value "SY001A System 1 read err = ".
03 SY001B pic x(28) value "SY001B System 2 read err = ".
03 SY001C pic x(28) value "SY001C System 3 read err = ".
03 SY001D pic x(28) value "SY001D System 4 read err = ".
03 SY004 pic x(38) value "SY004 Problem with opening system file".
03 SY007 pic x(35) value "SY007 Program arguments incorrect: ".
03 SY008 pic x(31) value "SY008 Note message & Hit return".
03 SY009 pic x(53) value "SY009 Environment variables not yet set up : ABORTING".
03 SY019 pic x(37) value "SY019 DB is NOT set up in Param file.".
03 SY020 pic x(34) value "SY020 DB IS set up in Param file :".
*>
procedure division.
*>=================
*>
aa000-Main-Start.
perform zz020-Get-Program-Args.
move 0 to WS-Log-System. *> 1 = IRS, 2=GL, 3=SL, 4=PL, 5=Stock used in FH logging, 6=SL & PL
move 10 to WS-Log-File-no. *> for FHlogger
*>
*> Get the system param for the various RDB fields
*>
move zeros to ws-Rec-Cnt-Out ws-Rec-Cnt-In.
open input System-File-seq.
if fs-reply not = zero
display Prog-Name at 0101
display SY004 at 0401
accept fs-reply at 0440
close System-File
move 128 to return-code
goback
end-if
initialise *> initialise all secondary records in WS
WS-System-Record
Default-Record
Final-Record
System-Record-4 with filler.
*>
read system-file-seq next record into WS-System-Record at end
move 256 to return-code
goback.
if fs-reply not = zero
display Prog-Name at 0101
display SY001A at 0401
display fs-reply at 0428
display "Not set up ?" at 0431
else
add 1 to ws-Rec-Cnt-In
end-if
display System-record-Seq at 0101 with erase eos.
display "system rec" at 2201.
display sy008 at 2301 with erase eol.
accept fs-reply at 2334.
*>
read System-File-seq next record into Default-Record.
if fs-reply not = zero
display Prog-Name at 0101
display SY001B at 0501
display fs-reply at 0528
display "Not set up ?" at 0531
else
add 1 to ws-Rec-Cnt-In
end-if
display System-record-Seq at 0101 with erase eos.
display "default rec" at 2201.
display sy008 at 2301 with erase eol.
accept fs-reply at 2334.
*>
read System-File-seq next record into Final-Record.
if fs-reply not = zero
display Prog-Name at 0101
display SY001C at 0601
display fs-reply at 0628
display "Not set up ?" at 0631
else
add 1 to ws-Rec-Cnt-In
end-if
display System-record-Seq at 0101 with erase eos.
display "final rec" at 2201.
display sy008 at 2301 with erase eol.
accept fs-reply at 2334.
*>
read System-File-seq next record into System-Record-4.
if fs-reply not = zero
display Prog-Name at 0101
display SY001D at 0701
display fs-reply at 0728
display "Not set up ?" at 0731
else
add 1 to ws-Rec-Cnt-In
end-if
display System-record-Seq at 0101 with erase eos.
display "system 4 rec" at 2201.
display sy008 at 2301 with erase eol.
accept fs-reply at 2334.
*>
open output system-file.
*>
move 1 to rrn.
write System-Record from System-Record. *> rec 1
add 1 to WS-Rec-Cnt-Out.
*>
move 2 to rrn.
write System-Record from Default-Record. *> rec 2
add 1 to WS-Rec-Cnt-Out.
*>
move 3 to rrn.
write System-Record from Final-Record. *> rec 3
add 1 to WS-Rec-Cnt-Out.
*>
move 4 to rrn.
write System-Record from System-Record-4. *> rec 4
add 1 to WS-Rec-Cnt-Out.
*>
close System-File-Seq
System-File.
move spaces to SO-Print.
string
"Records in = "
ws-Rec-Cnt-In
" Records Total out = "
WS-Rec-Cnt-Out
into SO-Print.
perform Call-Sysout.
move "CLOSE " to SO-Print.
perform Call-Sysout.
move zero to Return-Code.
goback.
*>
copy "Proc-Get-Env-Set-Files.cob". *> Only uses ACAS_LEDGERS now
*>
Call-Sysout.
call "ACAS-Sysout" using SO-Print.
*>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.