forked from hercules-390/hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcckddump.hla
2287 lines (2106 loc) · 81.6 KB
/
cckddump.hla
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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*/* ----------------------------------------------------------------
* * build a dasd file from sysut1 to sysut2
* * ---------------------------------------------------------------- */
version EQU 0
release EQU 1
mod EQU 15 CZV70
*/* ----------------------------------------------------------------
* * macros
* * ---------------------------------------------------------------- */
MACRO
&L STLE &R,&A store little-endian
&L STC &R,&A
STCM &R,2,1+&A
STCM &R,4,2+&A
STCM &R,8,3+&A
MEND
MACRO
&L STHLE &R,&A store halfword little-endian
&L STC &R,&A
STCM &R,2,1+&A
MEND
MACRO
&L LLE &R,&A load little-endian
&L IC &R,&A
ICM &R,2,1+&A
ICM &R,4,2+&A
ICM &R,8,3+&A
MEND
MACRO
&L LHLE &R,&A load halfword little-endian
&L SLR &R,&R
IC &R,&A
ICM &R,2,1+&A
MEND
MACRO
&L #MSG &LVL,&MSG,&TYPE=CALL
LCLA &A,&N,&O
LCLC &C
GBLA &MSG_IX
GBLC &MSGS(256)
AIF ('&TYPE' EQ 'CALL').CALL, x
('&TYPE' EQ 'GEN').GEN
MNOTE 8,'Invalid type specified'
MEXIT
.*
.CALL ANOP
&C SETC '&LVL'
AIF ('&LVL' NE '').LVLOK
&C SETC '1'
.LVLOK ANOP
&L CLI msglvl,&C
BH #MG&SYSNDX.X
&MSG_IX SETA &MSG_IX+1
&MSGS(&MSG_IX) SETC '&MSG'
L re,=A(#MSG&MSG_IX)
LA rf,L'#MSG&MSG_IX
&A SETA 1
&O SETA 0
&N SETA N'&SYSLIST-2
AGO .PL0
.PLLOOP ANOP
LA re,&SYSLIST(&A+2)
&A SETA &A+1
AIF (&A GT &N).PLX14
LA rf,&SYSLIST(&A+2)
&A SETA &A+1
.PL0 AIF (&A GT &N).PLX15
LA r0,&SYSLIST(&A+2)
&A SETA &A+1
AIF (&A GT &N).PLX0
LA r1,&SYSLIST(&A+2)
&A SETA &A+1
AIF (&A GT &N).PLX1
STM re,r1,msgl+&O
&O SETA &O+16
AGO .PLLOOP
.PLX14 ST re,msgl+&O
AGO .CALL2
.PLX15 STM re,rf,msgl+&O
AGO .CALL2
.PLX0 STM re,r0,msgl+&O
AGO .CALL2
.PLX1 STM re,r1,msgl+&O
.CALL2 LA r1,msgl
L rf,=a(msg_rtn)
BALR re,rf
#MG&SYSNDX.X DS 0H
MEXIT
.*
.GEN ANOP
AIF ('&L' EQ '').GENNOL
&L DS 0H
.GENNOL ANOP
&A SETA 1
.GENLOOP AIF (&A GT &MSG_IX).MEND
#MSG&A DC C&MSGS(&A)
&A SETA &A+1
AGO .GENLOOP
.MEND MEND
*/* ----------------------------------------------------------------
* *
* * ---------------------------------------------------------------- */
main CSECT ,
main RMODE ANY
main AMODE 31
SAVE (14,12),,'cckddump main() &SYSDATE &SYSTIME '
pgmid EQU main+5
LR rc,rf
USING main,rc
LA rb,4095(,rc)
USING main+4095,rb
LR r2,r1
*/* ----------------------------------------------------------------
* * get/clear workareas
* * ---------------------------------------------------------------- */
STORAGE OBTAIN,LENGTH=vdw_len,BNDRY=PAGE
ST r1,8(,rd)
ST rd,4(,r1)
LR rd,r1
USING vdw,rd
MVC id,=C'vdw '
LA r0,vdw+8
L r1,=A(vdw_len-8)
SLR rf,rf
MVCL r0,re
ST rd,vdw_31
STORAGE OBTAIN,LENGTH=vdw24_len,LOC=BELOW,BNDRY=PAGE
ST r1,vdw_24
LR ra,r1
USING vdw24,ra
MVC id24,=C'vdw24'
LA r0,vdw24+4
L r1,=A(vdw24_len-4)
SLR rf,rf
MVCL r0,re
*/* ----------------------------------------------------------------
* * try to open print file
* * ---------------------------------------------------------------- */
MVC prdcb,model_prdcb
MVC prdcbe,model_prdcbe
pr USING IHADCB,prdcb
LA r1,prdcbe
ST r1,pr.DCBDCBE
MVC devtl,model_devtl
DEVTYPE pr.DCBDDNAM,(devta,L'devta),MF=(E,devtl)
LTR rf,rf
BNZ noprint
MVC openl,model_openl
OPEN (pr.IHADCB,OUTPUT),MODE=31,MF=(E,openl)
#MSG 1,'%s %d.%d.%d starting', x
pgmid,=A(version),=A(release),=A(mod)
#MSG 0,'main workarea is at address 0x%x, 24-bit workarea is x
at address 0x%x',vdw_31,vdw_24
noprint DS 0H
*/* ----------------------------------------------------------------
* * get parameters
* * ---------------------------------------------------------------- */
LR r1,r2
BAS r9,getopts
*/* ----------------------------------------------------------------
* * get device information for sysut1 [the volume to be dumped]
* * ---------------------------------------------------------------- */
MVC devtl,model_devtl
DEVTYPE =CL8'SYSUT1',(devta,L'devta), x
INFOLIST=devt_infol_2,MF=(E,devtl)
LTR rf,rf
BNZ ut1_devt_err
TM devta+2,UCB3DACC check for dasd device
BNO ut1_not_dasd
TM dev_flags,X'80' check for eckd
BNO ut1_not_eckd
L r3,cyls
M r2,trks_per_cyl total number of trks
ST r3,trks
*/* ----------------------------------------------------------------
* * get device information for sysut2 [the file to be dumped]
* * ---------------------------------------------------------------- */
MVC devtl,model_devtl
DEVTYPE =CL8'SYSUT2',(dw,L'devta), x
INFOLIST=devt_infol_2,MF=(E,devtl)
LTR rf,rf
BNZ out_devt_err
TM dw+2,UCB3DACC check for dasd device
BNO out_not_dasd
*/* ----------------------------------------------------------------
* * part 1 -- determine which tracks to dump
* *
* * From the vtoc, determine which tracks are to be dumped.
* * A vector [trk_vec] is built for each track on the volume.
* * If an entry is zero, then the track will not be dumped;
* * otherwise, the entry points to an entry in the dataset
* * table [dsn_area] which will contain statistics about each
* * dataset on the volume. The first 3 entries in the dataset
* * table are special, representing free space [**free**],
* * track 0 [**track 0] and the vtoc [**vtoc**], respectively.
* *
* * ---------------------------------------------------------------- */
*/* ----------------------------------------------------------------
* * open sysut1 vtoc
* * ---------------------------------------------------------------- */
vt USING IHADCB,vtdcb
MVC vtdcb,model_vtdcb
LA r1,exlst
STCM r1,7,vt.DCBEXLSA
LA r1,jfcb
ST r1,exlst
MVI exlst,X'87'
MVC openl24,model_openl24
RDJFCB (vt.IHADCB,INPUT),MF=(E,openl24)
LTR rf,rf
BNZ ut1_rdjfcb_err
j USING INFMJFCB,jfcb
MVI j.JFCBDSNM,4 vtoc name is all x'04's
MVC j.JFCBDSNM+1(L'JFCBDSNM-1),j.JFCBDSNM
MVC volser,j.JFCBVOLS
DROP j
OPEN vt.IHADCB,TYPE=J,MF=(E,openl24)
TM vt.DCBOFLGS,DCBOFOPN
BNO ut1_vtoc_open_err
L r2,vt.DCBDEBAD load deb address for cvaf
N r2,=A(X'00FFFFFF')
#MSG 1,'%s:6 vtoc opened',volser
#MSG 0,'%s:6 has %d cyls, %d trks/cyl and %d total trks', x
volser,cyls,trks_per_cyl,trks
*/* ----------------------------------------------------------------
* * read the format 4 dscb
* * ---------------------------------------------------------------- */
h USING BFLHDR,bflh
OI h.BFLHFL,BFLHDSCB
MVI h.BFLHNOE,1
e USING BFLE,bflent
LA r1,dscb4
ST r1,e.BFLEBUF
OI e.BFLEFL,BFLECHR
MVI e.BFLELTH,L'dscb4
MVC cvpl_area,model_cvpl
CVAFSEQ ACCESS=GTEQ,BUFLIST=h.BFLHDR,DEB=(r2), x
BRANCH=(YES,PGM),MF=(E,cvpl_area)
LTR rf,rf
BNZ ut1_dscb4_err
DROP h,e
f4 USING IECSDSL4-44,dscb4
CLI f4.DS4IDFMT,C'4'
BNE ut1_dscb4_err
*/* ----------------------------------------------------------------
* * calculate size of the vtoc and get an area for all dscbs
* * ---------------------------------------------------------------- */
SLR r4,r4
IC r4,f4.DS4DEVDT
ST r4,dscbs_per_trk
LA r1,f4.DS4VTOCE
BAL re,cnv_xtnt r0 - starting track, x
r1 - number of tracks
ST r1,vtoc_trks
MR r0,r4
ST r1,total_dscbs number of dscbs
MH r1,=Y(DS1END-IECSDSL1)
ST r1,vtoc_size size of vtoc
STORAGE OBTAIN,LENGTH=(r1),BNDRY=PAGE area for the vtoc
ST r1,vtoc_area
#MSG 0,'%s:6 vtoc has %d total dscbs', x
volser,total_dscbs
#MSG 0,'storage obtained for vtoc area, addr 0x%x size %d', x
vtoc_area,vtoc_size
*/* ----------------------------------------------------------------
* * read the entire vtoc a track at a time
* * ---------------------------------------------------------------- */
#MSG 0,'reading %s:6 vtoc',volser
L r3,vtoc_area
L r4,vtoc_trks
LA r5,=XL5'0'
BAL re,cvaf_bld
MVC cvpl_area,model_cvpl read the first track
CVAFSEQ ACCESS=GTEQ,BUFLIST=bflh,DEB=(r2), x
BRANCH=(YES,PGM),MF=(E,cvpl_area)
LTR rf,rf
BNZ ut1_cvaf_err
B vtocnext
vtocloop BAL re,cvaf_bld read another track
CVAFSEQ ACCESS=GT,BUFLIST=bflh,DEB=(r2), x
BRANCH=(YES,PGM),MF=(E,cvpl_area)
LTR rf,rf
BNZ ut1_cvaf_err
vtocnext BCT r4,vtocloop
CLOSE vtdcb,MF=(E,openl24)
#MSG 0,'%s:6 vtoc closed',volser
B process_vtoc
*/* ----------------------------------------------------------------
* * subroutine to build the cvaf control blocks
* *
* * r3 - pointer to buffer for dscb (updated)
* * r5 - cchhr of 1st dscb - points to last bflearg on exit
* * ---------------------------------------------------------------- */
cvaf_bld XC bflh,bflh
USING IECSDSL1,r3
h USING BFLHDR,bflh
OI h.BFLHFL,BFLHDSCB
L r0,dscbs_per_trk
STC r0,h.BFLHNOE
LA rf,bflent
USING BFLE,rf
cvaf_bld_loop DS 0H
XC BFLE(BFLELN),BFLE
OI BFLEFL,BFLECHR
MVI BFLELTH,DS1END-IECSDSF1
MVC BFLEARG,0(r5) arg only used for 1st entry
ST r3,BFLEBUF
LA r3,DS1END
LA r5,BFLEARG r5 will point to last bflearg
LA rf,BFLE+BFLELN on exit
BCT r0,cvaf_bld_loop
BR re
DROP r3,h,rf
*/* ----------------------------------------------------------------
* * count nbr datasets and get a dataset area
* * ---------------------------------------------------------------- */
process_vtoc DS 0H
L r0,total_dscbs
L r1,vtoc_area
USING IECSDSL1,r1
SLR r3,3 init nbr datasets
SLR rf,rf
cnt_dsn CLI DS1FMTID,C'1'
BNE cnt_dsn_next
LA r3,1(,r3)
LR rf,r1 remember last fmt1 dscb addr
cnt_dsn_next DS 0H
LA r1,DS1END
BCT r0,cnt_dsn
DROP r1
ST r3,dsn_nbr
ST rf,last_f1_dscb
#MSG 1,'%d datasets are on %s:6',dsn_nbr,volser
LA r3,3(,r3) for free, track 0 and vtoc
ST r3,dsn_nbr
M r2,=A(dsn_area_len)
ST r3,dsn_area_size
STORAGE OBTAIN,LENGTH=(R3),BNDRY=PAGE
ST r1,dsn_area_addr
LR r2,r1
SLR rf,rf
MVCL r2,re
USING dsn_area,r1
MVC dsn_name,=CL44'*** free ***'
LA r1,dsn_area_len(,r1)
MVC dsn_name,=CL44'*** track 0 ***'
MVC dsn_extents,=A(1)
MVC dsn_trks,=A(1)
MVC dsn_trks_dump,=A(1)
DROP r1
#MSG 0,'storage obtained for dsn area, addr 0x%x size %d', x
dsn_area_addr,dsn_area_size
*/* ----------------------------------------------------------------
* * get track vector
* *
* * each word corresponds to a track; if the word is non-zero
* * then it points to a dsn_area entry and the track will
* * be dumped.
* * ---------------------------------------------------------------- */
L r3,trks
SLL r3,2
ST r3,trk_vec_size
STORAGE OBTAIN,LENGTH=(r3),BNDRY=PAGE
ST r1,trk_vec
LR r2,r1
SLR rf,rf
MVCL r2,re
TM opts,ALLTRKS dumping all tracks ?
BNO init_trk_vec1 no, continue
L r3,trks
init_trk_vec DS 0H
MVC 0(4,r1),dsn_area_addr set entry to '*** none ***'
LA r1,4(,r1)
BCT r3,init_trk_vec
init_trk_vec1 DS 0H
L r1,trk_vec
L r2,dsn_area_addr
LA r2,dsn_area_len(,r2) track 0 dsn_area [2nd entry]
ST r2,0(,r1) set track 0 to dump
#MSG 0,'storage obtained for trk vector, addr 0x%x size %d', x
trk_vec,trk_vec_size
*/* ----------------------------------------------------------------
* * figure out which tracks to dump
* * ---------------------------------------------------------------- */
L r9,vtoc_area
L r4,dsn_area_addr
LA r4,dsn_area_len*2(,r4) point to 3rd entry [vtoc]
USING dsn_area,r4
fmt4 MVC dsn_name,=CL44'*** vtoc ***' first dscb is format 4
MVC dsn_extents,=A(1)
USING IECSDSL4-44,r9
LA r1,DS4VTOCE
BAL re,cnv_xtnt get vtoc start trk, size
ST r1,dsn_trks
ST r1,dsn_trks_dump
LA r1,DS4VTOCE
LA r2,1
SLR r3,r3
BCTR r3,0
BAL re,upd_trk_vec
LA r4,dsn_area_len(,r4)
DROP r9
USING IECSDSL1,r9
vtoc_loop LA r9,DS1END
CL r9,last_f1_dscb
BH vtoc_exit
CLI DS1FMTID,C'1'
BNE vtoc_loop
fmt1 MVC dsn_name,DS1DSNAM format 1 dscb processing
SLR r2,r2
IC r2,DS1NOEPV
ST r2,dsn_extents
LTR r2,r2
BZ f1_part2
*/* count number of tracks allocated for the dataset */
LA r6,DS1EXT1
LA r7,3 format 1 has 3 extents
f1_xt LR r1,r6
BAL re,cnv_xtnt
A r1,dsn_trks
ST r1,dsn_trks
SH r2,=Y(1)
BNP f1_part2
LA r6,10(,r6)
BCT r7,f1_xt
fmt3 LA r1,DS1PTRDS
BAL re,cnv_ptr
LR r8,r1
USING IECSDSL3,r8
LA r6,DS3EXTNT fmt 3 starts off with 4 extents
LA r7,4
f3_xt1 LR r1,r6
BAL re,cnv_xtnt
A r1,dsn_trks
ST r1,dsn_trks
SH r2,=Y(1)
BNP f1_part2
LA r6,10(,r6)
BCT r7,f3_xt1
LA r6,DS3ADEXT
LA r7,9 and has 9 additional extents
f3_xt2 LR r1,r6
BAL re,cnv_xtnt
A r1,dsn_trks
ST r1,dsn_trks
SH r2,=Y(1)
BNP f1_part2
LA r6,10(,r6)
BCT r7,f3_xt2
LA r1,DS3PTRDS
B fmt3
DROP r8
f1_part2 DS 0H
*/* check if dataset included or excluded */
L r1,dsn_incl_list
LTR r1,r1
BZ f1_in_ok
LA r0,DS1DSNAM
BAL re,chk_dsn_list
LTR rf,rf
BZ f1_in_ok
OI dsn_flag,dsn_not_incl
f1_in_ok L r1,dsn_excl_list
LTR r1,r1
BZ f1_ex_ok
LA r0,DS1DSNAM
BAL re,chk_dsn_list
LTR rf,rf
BNZ f1_ex_ok
OI dsn_flag,dsn_excl
#MSG 1,'%s:44 Excluded',DS1DSNAM Msg for DS exclude SOMITCW
f1_ex_ok TM dsn_flag,dsn_not_incl+dsn_excl
BNZ f1_exit
*/* check if we'll use ds1lstar */
SLR r3,r3 presume we won't use ds1lstar
BCTR r3,0
TM opts,ALLDATA+ALLTRKS
BNZ f1_no_lstar
TM DS1SMSFG,DS1PDSE+DS1STRP+DS1PDSEX+DS1DSAE
BNZ f1_no_lstar
CLC DS1DSORG,=AL1(DS1DSGPS,0)
BE f1_lstar_ok
CLC DS1DSORG,=AL1(DS1DSGPO,0)
BNE f1_no_lstar
f1_lstar_ok DS 0H
SLR r3,r3
ICM r3,3,DS1LSTAR
LA r3,1(,r3) number tracks in use
f1_no_lstar DS 0H
*/* scan the extents */
LA r0,3
LA r1,DS1EXT1
L r2,dsn_extents
f1_xt_2 BAL re,upd_trk_vec
LTR rf,rf
BNZ f1_exit
BCT r0,f1_xt_2
LA r1,DS1PTRDS
fmt3_2 BAL re,cnv_ptr
LR r8,r1
USING IECSDSL3,r8
LA r1,DS3EXTNT
LA r0,4
f3_xt1_2 BAL re,upd_trk_vec
LTR rf,rf
BNZ f1_exit
BCT r0,f3_xt1_2
LA r1,DS3ADEXT
LA r0,9
f3_xt2_2 BAL re,upd_trk_vec
LTR rf,rf
BNZ f1_exit
BCT r0,f3_xt2_2
LA r1,DS3PTRDS
B fmt3_2
DROP r8
f1_exit LA r4,dsn_area_len(,r4)
B vtoc_loop
vtoc_exit DS 0H
DROP r9,r4
L r1,vtoc_area
L r0,vtoc_size
STORAGE RELEASE,ADDR=(1),LENGTH=(0)
#MSG 0,'storage released for vtoc area, addr 0x%x size %d', x
vtoc_area,vtoc_size
XC vtoc_area,vtoc_area
XC last_f1_dscb,last_f1_dscb
XC vtoc_size,vtoc_size
* The dsn_excl_list memory is being freed here. SOMITCW
L r1,dsn_excl_list Load addr. of first list entry SOMITCW
in_free DS 0H SOMITCW
LTR r1,r1 See if a list entry to free SOMITCW
BZ in_freed All dsn_excl_list freed, go exit SOMITCW
L r2,0(,r1) Save the next address to free SOMITCW
FREEMAIN RU,LV=49,A=(1) Free the list entry SOMITCW
LR r1,r2 Set the next address to free SOMITCW
B in_free Go to free the next list entry SOMITCW
in_freed DS 0H SOMITCW
XC dsn_excl_list(4),dsn_excl_list Clear the anchor SOMITCW
*/* ----------------------------------------------------------------
* * count number of tracks we're going to dump
* * ---------------------------------------------------------------- */
SLR r2,r2
L r1,trk_vec
L r0,trks
SLR rf,rf
cnt_dump CL rf,0(,r1)
BE *+8
LA r2,1(,r2)
LA r1,4(,r1)
BCT r0,cnt_dump
ST r2,trks_dump
#MSG 0,'%d tracks out of %d will be dumped', x
trks_dump,trks
*/* ----------------------------------------------------------------
* * part 2 -- do the actual work
*/* ----------------------------------------------------------------
*/* ----------------------------------------------------------------
* * open sysut1 in excp mode
* * ---------------------------------------------------------------- */
ex USING IHADCB,exdcb
MVC exdcb,model_exdcb
LA r1,exlst
STCM r1,7,ex.DCBEXLSA
LA r1,jfcb
ST r1,exlst
MVI exlst,X'87'
MVC openl24,model_openl24
RDJFCB (ex.IHADCB,INPUT),MF=(E,openl24)
LTR rf,rf
BNZ ut1_rdjfcb_err
j USING INFMJFCB,jfcb
MVI j.JFCBDSNM,4 vtoc name is all x'04's
MVC j.JFCBDSNM+1(L'JFCBDSNM-1),j.JFCBDSNM
DROP j
OPEN ex.IHADCB,TYPE=J,MF=(E,openl24)
TM ex.DCBOFLGS,DCBOFOPN
BNO ut1_excp_open_err
*/* ----------------------------------------------------------------
* * update the deb so we can read the entire volume
* * [this requires key 0 - hence supervisor state]
* * ---------------------------------------------------------------- */
L r2,ex.DCBDEBAD load deb address
N r2,=A(X'00FFFFFF')
USING DEBBASIC,r2
LA r3,DEBBASND
USING DEBDASD,r3
MODESET MODE=SUP
IPK 0(r2)
SPKA 0
SLR r1,r1
STH r1,DEBSTRCC
STH r1,DEBSTRHH
L r1,cyls
BCTR r1,0
STCM r1,3,DEBENDCC
L r1,trks_per_cyl
BCTR r1,0
STCM r1,3,DEBENDHH
L r1,trks
C r1,=A(65535)
BNH *+8
L r1,=A(65535)
STCM r1,3,DEBNMTRK
SPKA 0(r2)
MODESET MODE=PROB
DROP r2,r3
*/* ----------------------------------------------------------------
* * build the sysut1 iob
* * ---------------------------------------------------------------- */
i1 USING IOBSTDRD,excp_iob
OI i1.IOBFLAG1,IOBDATCH+IOBCMDCH+IOBUNREL
LA r1,excp_ecb
ST r1,i1.IOBECBPT
LA r1,excp_ccws
ST r1,i1.IOBSTART
LA r1,exdcb
ST r1,i1.IOBDCBPT
*/* ----------------------------------------------------------------
* * get area for read track (rt)
* * ---------------------------------------------------------------- */
MVC trkcalcl,model_trkcalcl
TRKCALC FUNCTN=TRKBAL,TYPE=devta+3,R=1,K=0,DD=65535, x
MAXSIZE=YES,REGSAVE=YES,MF=(E,trkcalcl)
LR r3,r0 copy max r1 data size
A r3,=A(ha_len+count_len+8+count_len+8) x
add ha size, r0 size, x
r1 count and end-track marker
LA r3,511(,r3) round_up 512
SRL r3,9
SLL r3,9
ST r3,trk_size
M r2,trks_per_cyl
STORAGE OBTAIN,LENGTH=(r3),LOC=BELOW,BNDRY=PAGE
ST r1,excp_io_area
ST r3,excp_io_size
#MSG 0,'storage obtained for %s i/o area, addr 0x%x size %d',x
volser,excp_io_area,excp_io_size
*/* ----------------------------------------------------------------
* * get area for compression
* * ---------------------------------------------------------------- */
TM opts,COMPRESSION
BNO no_compress_1
L r2,trk_size
A r2,=A(4096)
SRL r2,12
SLL r2,12
STORAGE OBTAIN,LENGTH=(r2),BNDRY=PAGE
STM r1,r2,compr_area
#MSG 0,'storage obtained for compression, addr 0x%x size %d',x
compr_area,compr_size
LA r2,handle
LA r3,=A(32*1024)
LA r4,=A(1)
STM r2,r4,dw
OI dw+8,X'80'
LA r1,dw
L rf,=V(EDCXHOTL) create persistent c environ
BALR re,rf
#MSG 0,'persistent c environment created, handle=0x%x', x
handle
no_compress_1 DS 0H
*/* ----------------------------------------------------------------
* * open sysut2 (output file)
* * ---------------------------------------------------------------- */
o USING IHADCB,outdcb
MVC outdcb,model_outdcb
MVC outdcbe,model_outdcbe CZV70
LA r1,outdcbe CZV70
ST r1,o.DCBDCBE CZV70
OPEN (o.IHADCB,OUTPUT),MF=(E,openl24)
TM o.DCBOFLGS,DCBOFOPN
BNO out_open_err
#MSG 1,'file SYSUT2 opened for output'
*/* ----------------------------------------------------------------
* * get sysut2 i/o areas
* * ---------------------------------------------------------------- */
STORAGE OBTAIN,LENGTH=16384,BNDRY=PAGE
ST r1,out_buf first output buffer
MVC out_bufsz,=A(16384)
* build the headers
LR r3,r1
USING VDHDR,r3
ST r3,vdhdr_addr
LR r0,r3
L r1,=A(16384)
SLR rf,rf
MVCL r0,re
USING CKDDASD_DEVHDR,VDH_devhdr
* MVC CKD_devid,=cl8'CKD_C370' Deleted SOMITCW
* TR CKD_devid,e2aTab Deleted SOMITCW
MVC CKD_devid,=XL8'434B445F43333730' SOMITCW
L rf,trks_per_cyl
STLE rf,CKD_heads
L rf,trk_size
STLE rf,CKD_trksize
MVI CKD_devtype,x'90'
CLI devta+3,x'0f'
BE *+8
MVI CKD_devtype,x'80'
USING CCKDDASD_DEVHDR,VDH_devhdr2
MVC CCKD_vrm,=AL1(version,release,mod)
TM opts,DONTCOMPRESS
BO *+8
MVI CCKD_options,1
L rf,cyls
STLE rf,CCKD_cyls
* calculate number lvl 1 entries
L rf,trks
LR r2,rf
SRL r2,8 number of trks / 256
N rf,=A(X'000000ff') evenly divisible ?
BZ *+8
LA r2,1(,r2) no, increment number
STLE r2,CCKD_numl1tab
LA r1,256
STLE r1,CCKD_numl2tab
L r1,cckd_compr
STC r1,CCKD_compress
L r1,cckd_compr_level
STHLE r1,CCKD_compress_parm
LR r1,r2 calclate first pos
SLL r1,2 (at end ov lvl 1 tab)
AL r1,=A(VDH_l1tab-VDHDR)
ST r1,out_pos
ST r1,bytes_ovh
DROP r3
* get area for rewrites
LA r2,2(r2,r2) 2 entries for ea lvl 2 tab
MH r2,=Y(rw_len) plus the 1st buf + a spare
STORAGE OBTAIN,LENGTH=(r2),BNDRY=PAGE
STM r1,r2,rw_area
LR r0,r1 clear the rewrite area
LR r1,r2
SLR rf,rf
MVCL r0,re
L r2,rw_area set first rewrite entry
USING rw_ent,r2
MVC rw_buf,out_buf
ST r2,last_rw
LA r2,rw_next
ST r2,next_rw
DROP r2
*/* ----------------------------------------------------------------
* * read tracks
* * ---------------------------------------------------------------- */
SLR r2,r2 init relative track
L r3,trk_vec
read_loop CL r2,trks
BNL read_exit
LR rf,r2 get dsn area addr for trk
SLL rf,2
L r4,0(rf,r3)
LTR r4,r4
BZ read_next
SLR r6,r6
LR r7,r2
D r6,trks_per_cyl get cc [r7] and hh [r6]
XC i1.IOBSEEK,i1.IOBSEEK
STCM r7,3,i1.IOBCC
STCM r6,3,i1.IOBHH
* build locate record ccw
XC excp_ccws,excp_ccws
LA r5,excp_ccws
USING ccw0,r5
MVI CCW0CMD,lr
LA r1,lr_parms
STCM r1,7,CCW0ADDR
OI CCW0FLAG,CCW0CC
LA r1,L'lr_parms
STCM r1,3,CCW0CNT
LA r5,CCW0END
* build read track ccws, try to read to end-of-cylinder
L r0,trk_size
L r1,excp_io_area
USING ha,r1
read_rt MVI ha_bin,0 build a ha
STCM r7,3,ha_cc
STCM r6,3,ha_hh
LA rf,ha_end
DROP r1
MVI CCW0CMD,rt
STCM rf,7,CCW0ADDR
OI CCW0FLAG,CCW0SLI+CCW0CC
STCM r0,3,CCW0CNT
AR r1,r0 next i/o area addr
LA r6,1(,r6) increment hh
C r6,trks_per_cyl
BNL read_rt_x exit if next cylinder
LA r2,1(,r2) increment track nbr
LR rf,r2
SLL rf,2
L r4,0(rf,r3)
LTR r4,r4
BZ read_rt_x exit if trk_vec entry is 0
LA r5,CCW0END else point to next ccw
B read_rt and loop back
read_rt_x NI CCW0FLAG,255-CCW0CC unchain last ccw
DROP r5
SLR rf,rf
ICM rf,3,i1.IOBHH
SR r6,rf number of read rt ccws
* build locate record parameters
XC lr_parms,lr_parms
LA r5,lr_parms
USING lr_parm_area,r5
MVI lr_op,lr_orient_home+lr_read_tracks
STC r6,lr_count
MVC lr_seek_addr,i1.IOBCC
MVC lr_search_arg,i1.IOBCC
DROP r5
* issue excp
XC excp_ecb,excp_ecb
EXCP i1.IOBSTDRD
WAIT 1,ECB=excp_ecb
CLI excp_ecb,X'7f'
BNE ut1_io_err
* process each track image
L r1,excp_io_area
read_proc LA r7,ha_len(,r1) find end of the track
USING count,r7
read_proc1 CLC =X'ffffffffffffffff',count
BE read_proc2
SLR rf,rf
IC rf,count_key
SLR r0,r0
ICM r0,3,count_data
AR rf,r0
LA r7,count_end(rf)
B read_proc1
DROP r7
read_proc2 LA r0,8(,r7) get length of track image
SR r0,r1
ST r1,trk_addr
ST r0,trk_sz
ST r1,ctrk_addr
CH r0,=Y(37) track just an eof ?
BNE *+6
SLR r0,r0 yes, use 0 length
ST r0,ctrk_sz
* compress the track [but not the ha]
* void *__xhotu(void *handle, void *function, ...);
* int compress(uchar *dest, ulong *destLen,
* const uchar *source, ulong sourceLen);
TM opts,COMPRESSION
BNO no_compress2
LA re,handle set parms for edcxhotu
LA rf,=V(COMPRES2)
STM re,rf,zlib_pl
LM re,rf,compr_area dest area, length
MVC 0(ha_len,re),0(r1) copy the ha
MVI 0(re),1 flag indicating compressed trk
LA re,ha_len(,re) point past the ha
SH rf,=Y(ha_len) adjust dest length
ST rf,compr_used set dest length
LA rf,compr_used addr dest length
STM re,rf,zlib_pl+8 set dest addr, addr len
SH r0,=Y(ha_len) adjust source len
BNP no_compress2 don't compress if null track
ST r0,zlib_pl+20 set source length
LA r1,ha_len(,r1) adjust source addr
ST r1,zlib_pl+16 set source addr
L re,compr_level get compression level
ST re,zlib_pl+24 set compression level
LA r1,zlib_pl parameter list addr
L rf,=V(EDCXHOTU) call zlib compress function
BALR re,rf
LTR rf,rf test return code
BNZ no_compress2
L r1,compr_used get compressed length
LA r1,ha_len(,r1) add size of ha
C r1,trk_sz check lengths
BNL no_compress2 use uncompressed img
MVC ctrk_addr,compr_area
ST r1,ctrk_sz
no_compress2 DS 0H
* update byte counts
LM r0,r1,bytes_read total bytes read
AL r1,trk_sz
BC 12,*+8
AL r0,=A(1)
STM r0,r1,bytes_read
LM r0,r1,bytes_written total bytes written
AL r1,ctrk_sz
BC 12,*+8
AL r0,=A(1)
STM r0,r1,bytes_written
L r1,ctrk_addr calculate dsn entry address
USING ha_bin,r1
SLR re,re
SLR rf,rf
ICM rf,3,ha_cc
M re,trks_per_cyl
SLR re,re
ICM re,3,ha_hh
ALR rf,re
SLL rf,2
L r4,0(rf,r3)
DROP r1
USING dsn_area,r4
LM r0,r1,dsn_bytes_read dataset bytes read
AL r1,trk_sz
BC 12,*+8
AL r0,=A(1)
STM r0,r1,dsn_bytes_read
LM r0,r1,dsn_bytes_written dataset bytes written
AL r1,ctrk_sz
BC 12,*+8
AL r0,=A(1)
STM r0,r1,dsn_bytes_written
DROP r4
* call write track routine
LA r1,ctrk_addr point to addr, len
BAL re,write_track call write_track()
L r1,trk_addr