-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
zginstall.rex
executable file
·2037 lines (1910 loc) · 72.6 KB
/
zginstall.rex
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
/* REXX - must start in column 1 */
/* --------------------------------------------------------- *
| Name: zginstall.rex |
| |
| Function: ZIGI Package Installation Script |
| |
| Syntax: ./zginstall.rex hlq \ option |
| |
| Usage: If hlq is not provided it will be prompted for |
| and used for the z/OS dataset hlq. |
| |
| \ - delimeter |
| |
| x - any non-blank will cause zginstall to |
| copy individual files into the PDS instead |
| of all at once.. |
| |
| Installation: This script should be installed in the root |
| OMVS directory for the ZIGI managed Git |
| repository. |
| |
| It is included in this library so that it |
| can be accessed by ZIGI to prime a new, or |
| existing, repository. |
| |
| Usage Notes: |
| 1. Prompt for |
| - default HLQ to be used |
| 2. Sequential files that have no lowercase |
| will be processed. |
| 3. Directories that are all uppercase will |
| be assumed to be PDS directories |
| 4. Upon completing the upload of all z/OS |
| datasets the hlq.ZGSTAT.EXEC dataset will |
| be generated. It will be pre-configured for |
| the uploaded datasets and when executed will |
| apply the ISPF statistics to all partitioned |
| dataset members from the ISPF statistics |
| files found in the .zigi directory. |
| |
| Author: Lionel B. Dyck |
| |
| History: (most recent on top) |
| 01/23/23 LBD - Add zgpop4 panel |
| 01/21/23 LBD - Update zigistat subroutine |
| 05/16/22 LBD - Remove duplicate routines |
| 04/09/22 LBD - Update zigistat to current level |
| - Create zgstat.exec if mixed ds |
| 06/03/21 LBD - Change SHAREAS to REQUIRED |
| 05/14/21 HBK - Don't parse lowercase folders |
| 05/11/21 LBD - Correction for mixed text/binary |
| 05/06/21 LBD - support allmems > 32k |
| 01/06/21 LBD - use .zigi/dsn for z/OS dataset |
| determination |
| 11/17/20 LBD - Use Dovetail PUTPDS if available |
| as it is faster than cp |
| 10/25/20 LBD - Improve usssafe routine |
| 10/11/20 LBD - Correct test for existing dsns |
| 08/08/20 LBD - Generalize get_binfiles |
| 07/29/20 LBD - Add _EDC_ZERO_RECLEN=Y to env. |
| 07/24/20 LBD - Adjust Popup Panel Location |
| - Prompt to Proceed after display |
| of target datasets |
| 07/12/20 LBD - Define OMVS env stem |
| 07/04/20 LBD - Use Clear to clear screen |
| 06/29/20 LBD - Add generic installer prose |
| 06/28/20 LBD - Add text graphics |
| - Add prose about INPUT state |
| 06/27/20 LBD - Use a single cp if the pds is |
| not mixed (text & binary) |
| 06/26/20 LBD - Fixup zgstat.exec dsname quotes |
| 06/11/20 LBD - Redesign self contained exec |
| 06/10/20 LBD - Tweak for zgstat.exec dsn |
| 06/09/20 LBD - Creation from zigickot |
| ---------------------------------------------------------- |
| zigi - the z/OS ISPF Git Interface |
| Copyright (C) 2020 - Henri Kuiper and Lionel Dyck |
| |
| This program is free software: you can redistribute it |
| and/or modify it under the terms of the GNU General |
| Public License as published by the Free Software |
| Foundation, either version 3 of the License, or (at |
| your option) any later version. |
| |
| This program 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. |
| |
| You should have received a copy of the GNU General |
| Public License along with this program. If not, see |
| <https://www.gnu.org/licenses/>. |
* ---------------------------------------------------------- */
arg options
parse value options with ckothlq'\'opt
ckothlq = strip(ckothlq)
x = bpxwunix('clear')
say copies('-',73)
say " .zZ. Zz "
say " ZZZZZZZZ ZZZZZZZ "
say " ZZZZZZZZZZZZZZZZZZZZZZ ZZ ZZZ zZ "
say " ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ZZZ .zZZ ZZ "
say " ZZZZZZZZZZZZZZZZ ZZZZZZZ ZZ ZZZ ..zZZZ Zz "
say " ZZZZZZZZZZ, ZZZZZZZZZ ZZZ ZzZ ZZ ZZ ZZZZZZZ"
say " ZZZZ ZZZZZZZZ ZZZ ZZZZZZZZZZZ ZZZZZZZZZZZ "
say " ZZZZZZZZ ZZZZ ZZZZZZ ZZZZZZZZZg "
say " ZZZZZZZZ ZZZ ZZZZZZZZZ "
say " ZZZZZZZ zZZZZZZZZZZZZZZ Common"
say " ZZZZZZZ ZZZZZZZZZZZZZZ Installation"
say " .ZZZZZZZ ZZZZZZZZZZZZZZ Tool"
say " ZZZZZZZZZZZZZZZZZZZZZZ "
say " ZZZZZZZZZZZZZZZZZ zOS ISPF Git Interface "
say " ZZZZZZZZZZZZ "
say " ZZZZZZZZZZ The git interface for the rest of us"
say " ZZZZZZZZ "
say " ZZZZZZZ Henri Kuiper & Lionel Dyck "
say copies('-',73)
/* --------------------- *
| Set Default Env and |
| Get current directory |
* --------------------- */
env.1 = '_BPX_SHAREAS=MUST'
env.2 = '_BPX_SPAWN_SCRIPT=YES'
env.3 = '_EDC_ZERO_RECLEN=Y'
env.0 = 3
cmd = 'pwd'
x = bpxwunix(cmd,,so.,se.,env.)
ckotdir = strip(so.1)
x = bpxwunix('command -v putpds',,so.,se.)
if so.0 = 0 then enhanced = 0
else do
enhanced = 1
putpds = so.1
end
Restart:
/* ------------------- *
| Prompt for z/OS HLQ |
* ------------------- */
if ckothlq = '' then do
say 'Enter the z/OS High Level Qualifier to use:'
pull ckothlq
if ckothlq = '' then do
say 'no qualifier entered - exiting for now.'
exit 8
end
ckothlq = translate(strip(ckothlq))
end
/* -------------------------------------------------------- *
| Issue the ls command to get file names and sizes for all |
| files in the current directory and sub-directories. |
* -------------------------------------------------------- */
cmd = 'ls -laRk' ckotdir
rc = bpxwunix(cmd,,stdout.,stderr.,env.)
/* ---------------------------------------------- *
| Display any error messages and if so then exit |
* ---------------------------------------------- */
if stderr.0 > 0 then do
do i = 1 to stderr.0
say stderr.i
end
exit 8
end
/* ------------------------- *
| Define our work variables |
* ------------------------- */
parse value '' with subs files null zgstat_flag
mgen = 0
hit = 0
filec = 0
/* -------------------------------------------------------------- *
| Inform the user that if there are directories with a lot of |
| members to be copied into a PDS tht the OMVS shell may enter |
| an INPUT state and to just press F10 - meanwhile the copy (cp) |
| is proceeding. |
* -------------------------------------------------------------- */
if opt = null then do
call zmsg ' '
call zmsg 'If the repository being installed has partitioned datasets'
call zmsg 'with a large number of members, the copy operation will take'
call zmsg 'longer than the TN3270 polling expects. This will cause'
call zmsg 'the OMVS Shell to change from RUNNING to INPUT.'
call zmsg 'Just press the F10 key to return to a RUNNING state. '
call zmsg ' '
call zmsg 'Do not worry, however, as the copy operation is still running'
call zmsg 'and will report out when it completes (but only if the shell'
call zmsg 'is in a RUNNING state.'
call zmsg ' '
end
/* ------------------------------------ *
| Read in ../.zigi/dsn to get dcb info |
| and for z/OS dsn info |
* ------------------------------------ */
cmd = 'cd' ckotdir '&& ls -la .zigi'
x = bpxwunix(cmd,,co.,ce.,env.)
if x > 0 then do
def_recfm = 'FB'
def_lrecl = 80
def_blksize = 32720
def. = null
end
else do
ckdd = 'ck'time('s')
x = bpxwunix("cat '"ckotdir"/.zigi/dsn'",,ck.)
def. = null
zdsn. = null
do i = 1 to ck.0
if left(ck.i,1) = '#' then iterate
if word(ck.i,1) = '*' then do
parse value ck.i with . def_dsorg def_recfm def_lrecl def_blksize .
end
else do
dsn = word(ck.i,1) /* dataset name less hlq */
def.dsn = subword(ck.i,2) /* dataset dsorg */
zdsn.dsn = word(ck.i,6) /* file extension */
end
end
end
Address TSO
/* ------------------------------- *
| Get the list of Binary Datasets |
* ------------------------------- */
call get_binfiles
/* ---------------------------------------------------- *
| Process the results of the ls command to: |
| 1. collect number of members per sub-directory |
| 2. collect bytes count (in k) for each sub-directory |
| 3. collect info on sequential files |
* ---------------------------------------------------- */
if stdout.0 > 0 then
do i = 1 to stdout.0
select
when pos(ckotdir,stdout.i) > 0 then do
parse value stdout.i with (ckotdir)sub':'
if left(sub,1) = '/' then sub = substr(sub,2)
if strip(sub) /= '' then do
size.sub = 0
dir.sub = 0
si = 0
if left(sub,1) /= '.' then do
xx = translate(sub,'??????????????????????????',,
'abcdefghijklmnopqrstuvwxyz')
if pos('?',xx) > 0 then iterate /* No lowercase things */
subs = subs sub
end
end
end
when word(stdout.i,1) = 'total' then do
hit = hit + 1
end
when hit > 1 & left(stdout.i,1) = '-' then
if strip(sub) /= '' then do
size.sub = size.sub + word(stdout.i,5)
dir.sub = dir.sub + 1
end
when hit = 1 & left(stdout.i,1) = '-' then do
file = word(stdout.i,9)
if def.file = null then iterate
if left(file,1) = '.' then iterate
fx = translate(file,'??????????????????????????', ,
'abcdefghijklmnopqrstuvwxyz')
if pos('?',fx) > 0 then iterate
size.file = word(stdout.i,5)
files = files file
end
otherwise nop
end
end
call zmsg 'The following Datasets will be Created or Recreated:'
if words(files) > 0 then
do fi = 1 to words(files)
wdsn = "'"ckothlq"."word(files,fi)"'"
call zmsg wdsn
if check_file(wdsn) > 0
then call zmsg '--- Dataset exists and will be recreated.'
end
do fi = 1 to words(subs)
wdsn = "'"ckothlq"."word(subs,fi)"'"
call zmsg wdsn
if check_file(wdsn) > 0
then call zmsg '--- Dataset exists and will be recreated.'
end
call zmsg ' '
say ' '
say 'Enter Y to Proceed or anything to Retry:'
pull zgans
if translate(zgans) /= 'Y' then do
ckothlq = null
signal ReStart
end
/* -------------------------------------------- *
| Process the individual files, if any |
| Allocation and Copy |
* -------------------------------------------- */
do i = 1 to words(files)
parse value '' with zs1 zs2 zs3 zs4 zs5 zs6 zs7 zs8 zs9
sub = word(files,i)
fileg = "'"ckothlq"."sub"'"
odir = "'"ckotdir"/"sub"'"
bin = is_binfile(sub)
if bin = 1 then do
type = 'Binary'
zgstat_flag = 1
end
else type = 'Text'
say 'Copying' odir 'to' fileg 'as' type
filec = filec + 1
zfile.filec = fileg
x = check_file(fileg)
if x > 0 then do
call outtrap 'x.'
'delete' fileg
call outtrap 'off'
end
tracks = (size.sub%50000 + 1) * 2
call get_dcb
'alloc ds('fileg') new spa('tracks','tracks') tr dsorg(ps)' ,
'recfm('recfm') lrecl('lrecl') blksize('blksize')'
'free ds('fileg')'
'oget' odir fileg type
end
/* -------------------------------------------- *
| Process the sub-directories and initiate the |
| Allocation and Copy |
| Ignore subdirectories |
* -------------------------------------------- */
do isub = 1 to words(subs)
parse value '' with zs1 zs2 zs3 zs4 zs5 zs6 zs7 zs8 zs9
sub = word(subs,isub)
bin = is_binfile(sub)
if bin = 1 then do
type = 'Binary'
zgstat_flag = 1
end
else type = 'Text'
fx = translate(sub,'??????????????????????????', ,
'abcdefghijklmnopqrstuvwxyz')
if pos('?',fx) > 0 then iterate
tracks = (size.sub%50000 + 1) * 2
call alloc_copy_pds
end
/* ------------------------------------------ *
| Now update and create the zgstat.exec file |
* ------------------------------------------ */
if enhanced = 0 | zgstat_flag = 1 then do
c = 0
hit = 0
last = sourceline()
do i = 1 to last
card = sourceline(i)
if left(card,8) = '>ZGSTATE' then leave
if hit = 0 then
if left(card,8) = '>ZGSTAT ' then do
hit = 1
iterate
end
else iterate
if pos('$$$$$$',card) > 0 then do
parse value card with var '=' .
if translate(var) = 'REPODIR' then
card = " repodir ='"ckotdir"'"
if translate(var) = 'HLQ' then
card = " hlq ='"ckothlq"'"
end
c = c + 1
zg.c = card
end
zg.0 = c
Address syscall
path = ckotdir'/lrhg.rex'
'open' path O_rdwr+O_creat+O_trunc 660
if retval = -1 then do
say 'Unable to open the output file for ZGSTAT.EXEC'
say 'so ISPF statistics will not be able to be recreated.'
exit 8
end
fd = retval
do i = 1 to zg.0
rec = zg.i ESC_N
'write' fd 'rec' length(rec)
end
'close' fd
Address TSO
zgstat_dsn = "'"ckothlq".ZGSTAT.EXEC'"
say ' '
cmd = 'cp -v lrhg.rex "//'zgstat_dsn '"'
cmd = cmd '&& rm lrhg.rex'
x = bpxwunix(cmd,,so.,se.,env.)
if so.0 > 0 then
do i = 1 to so.0;say so.i;end
if se.0 > 0 then
do i = 1 to se.0;say se.i;end
end
/* -------------------- *
| Done with everything |
* -------------------- */
say ' '
say 'Completed - z/OS datasets created:'
say ' '
do i = 1 to filec
say zfile.i
end
if enhanced = 0 | zgstat_flag = 1 then do
say ' '
say 'Note that using this installation path does not allow the ISPF'
say 'statistics to be recreated. Other than the missing ISPF statistics'
say 'everything has been successfully installed on z/OS.'
if if enhanced /= 0 then if zgstat_flag = 1 then do
say ' '
say 'One, or more, partitioned datasets (PDS) had both text and binary'
say 'members. This prevented the ISPF statistics from being created'
say 'for that PDS.'
end
say ' '
say 'To recreate the ISPF statistics execute the following command'
say 'after returning to TSO/ISPF:'
say ' '
say 'TSO EX' zgstat_dsn 'EX'
say ' '
say 'After it completes successfully it can be deleted.'
end
Exit
zmsg:
parse arg message
if strip(message) = null then
message = copies('-',63)
say '* 'left(message,63)' *'
return
/* ----------------------------------------------------- */
/* number format code thanks to Doug Nadel */
/* ----------------------------------------------------- */
fix_num: procedure
arg bytes
str=strip(translate('0,123,456,789,abc,def', ,
right(bytes,16,','), ,
'0123456789abcdef'),'L',',')
bytes = strip(str)
return bytes
/* ----------------------------------------------------------------- *
| Allocate the PDS and perform the copy using cp |
| - if the target PDS exists as a PDS, delete and realloc as a PDSE |
| - if the target is a PDSE then it will NOT be reallocated |
| - The target PDS will be allocated as a PDSE version 2. |
| - if maxgen (mgen) is provided then member generations will |
| also be defined at allocation |
| - Uppercase and remove defined extension for members |
* ----------------------------------------------------------------- */
Alloc_Copy_PDS:
pds = "'"ckothlq"."sub"'"
odir = "'"ckotdir"/"sub"/'"
filec = filec + 1
zfile.filec = pds
x = check_file(pds)
if x > 0 then do
call outtrap 'x.'
Address TSO ,
'delete' pds
call outtrap 'off'
end
call get_dcb
if recfm = 'U' then do
type = 'Load module'
end
say 'Copying' odir 'to' pds
if mgen > 0 then gens = 'maxgens('mgen')'
else gens = null
'Alloc new spa('tracks','tracks') recfm('recfm') lrecl('lrecl')' ,
'Blksize('blksize') Dsntype(Library,2) dsorg(po) dir(1)' ,
'dsn('pds')' gens
'Free ds('pds')'
/* ---------------------------------------------------- *
| Read directory to get all member file names and then |
| adjust according and then do individual cp |
* ---------------------------------------------------- */
target = strip(pds,'B',"'")
address syscall
rdir = strip(odir,'B',"'")
rdir = strip(rdir,'T','/')
'readdir' rdir 'mems.'
tcount = mems.0 - 2
mixed = check_mixed_bintext(sub)
if mixed = 0 then do
bin = is_binfile(sub)
if bin = 1 then binopt = '-B'
else binopt = null
if recfm = 'U' then binopt = '-X -I'
if binopt = null then type = 'Text'
else if binopt = '-B' then type = 'Binary'
else if recfm = 'U' then type = 'Load module'
if type = 'Binary' then
zgstat_flag = 1
say 'Copying' tcount 'members as' type
if enhanced = 0 | recfm = 'U' then do
zos = usssafe("//'"target"'")
cmd = 'cp -A -U -v' binopt usssafe(rdir'/*') '"'zos'"'
end
else do
putpds_opts = null
if pos('-B',binopt) > 0 then putpds_opts = '-b'
sp = lastpos('/',rdir,length(rdir)-1)
sfile = substr(rdir,sp+1)
putpds_opts = putpds_opts '-M st='ckotdir'/.zigi/'sfile
zos = usssafe("//"target)
cmd = putpds putpds_opts usssafe(rdir)'/*' zos
end
x = docmd(cmd)
if x > 0 then do
say ' '
say 'Copy command:' cmd
say ' '
say 'Standard messages:'
say ' '
do vs = 1 to so.0;say so.vs;end
say ' '
say 'Error messages:'
say ' '
do vs = 1 to se.0;say se.vs;end
end
end
else do /* mixed text and binary in same PDS */
mcount = 0
do ii = 1 to mems.0
if mems.ii = "." | mems.ii = ".." then do
/* skip the . and .. things */
iterate
end
m = mems.ii /* ignore the translation */
if zdsn.sub /= null then
if right(m,length(zdsn.sub)) = zdsn.sub then do
parse value m with m'.'.
m = translate(m)
end
src = rdir'/'mems.ii
bin = is_binfile(sub'/'mems.ii)
if bin = 1 then binopt = '-B'
else binopt = null
if recfm = 'U' then binopt = '-X -I'
src = usssafe(mems.ii)
if left(src,1) = '#' then src = '\'src
zos = usssafe("//'"target"("m")'")
mcount = mcount + 1
if binopt = null then type = 'Text'
else if binopt = '-B' then type = 'Binary'
else if recfm = 'U' then type = 'Load module'
if type = 'Binary' then
zgstat_flag = 1
say left('Copying' mcount 'of' tcount,24) 'Member:' m 'as' type
cmd = 'cd' usssafe(rdir)
cmd = cmd '&& cp -U -v' binopt src '"'zos'"'
x = docmd(cmd)
if x > 0 then do
say ' '
say 'Standard messages:'
say ' '
do vs = 1 to so.0;say so.vs;end
say ' '
say 'Error messages:'
say ' '
do vs = 1 to se.0;say se.vs;end
end
end
end
return
get_dcb:
if def.sub /= null then do
parse value def.sub with dsorg recfm lrecl blksize .
recfm = left(recfm,1) substr(recfm,2,1) substr(recfm,3,1)
end
else do
recfm = left(def_recfm,1) substr(def_recfm,2,1) substr(def_recfm,3,1)
lrecl = def_lrecl
blksize = def_blksize
end
return
Check_File: Procedure
arg dsn
call outtrap 'x.'
Address TSO 'Listd' dsn
call outtrap 'off'
if x.0 > 3 then return 8
else return 0
/* ---------------------------------------- *
| Check if a PDS has mixed binary and text |
| 0 = not mixed 1 = mixed |
* ---------------------------------------- */
Check_Mixed_BinText:
parse arg checkForBinFile
cmbtRC = 0
if datatype(binfiles.0) /= 'NUM' then return 0
do bi = 1 to binfiles.0
parse value binfiles.bi with cmbtfile'/'cmbtmbr
parse value checkForBinFile with checkFile'/'checkmbr
if cmbtfile = checkFile then
if cmbtmbr = '*' then cmbtRC = 0
else return 1
if binfiles.bi = checkForBinFile then return 1
end
return cmbtRC
usssafe:
parse arg safe_command
safe_ret = 1
if pos('\$',safe_command) > 0 then safe_ret = 0
if pos('\#',safe_command) > 0 then safe_ret = 0
if safe_ret = 0 then return safe_command
if pos('$',safe_command) > 0 then safe_ret = 1
if pos('#',safe_command) > 0 then safe_ret = 1
if safe_ret = 0 then return safe_command
safe$pos = 1
do forever
pos$safe = pos('$',safe_command,safe$pos)
if pos$safe < 1 then leave
left$safe = left(safe_command,pos$safe-1)
right$save = substr(safe_command,pos$safe)
safe_command = left$safe'\'right$save
safe$pos = pos$safe + 2
end
safe$pos = 1
do forever
pos$safe = pos('#',safe_command,safe$pos)
if pos$safe < 1 then return safe_command
left$safe = left(safe_command,pos$safe-1)
right$save = substr(safe_command,pos$safe)
safe_command = left$safe'\'right$save
safe$pos = pos$safe + 2
end
return safe_command
strreplace: Procedure
string = arg(1)
strfrom = arg(2)
strto = arg(3)
null = ''
if pos(strfrom,string) = 0 then return string
newString = null
do i = 1 to length(string)
if substr(string,i,1) /= strfrom
then newstring = newstring''substr(string,i,1)
else newstring = newstring''strto
end
return newstring
get_binfiles:
/* ---------------------------------------------------------\
| Name: binfiles |
| |
| Function: Fills the global binfiles. stem with all |
| current repo files that are added as binary. |
\---------------------------------------------------------- */
cmd = 'cd' ckotdir'/ &&'
cmd = 'cat -W filecodeset=UTF-8,pgmcodeset=IBM-1047' ckotdir'/.gitattributes'
cmd = cmd ' | grep BINARY'
cmd = cmd '| cut -d" " -f1'
x = docmd(cmd)
if so.0 = 0 then do
binfiles.0 = 0
return 0
end
do b = 1 to so.0
binfiles.b = so.b
end
binfiles.0 = so.0
return 0
is_binfile: procedure expose binfiles.
/* ---------------------------------------------------------\
| Name: is_binfile |
| |
| Function: Checks the global binfiles. stem for the |
| provided dataset or dataset/member |
\---------------------------------------------------------- */
parse arg file
if datatype(binfiles.0) /= 'NUM' then return 0
do bi = 1 to binfiles.0
if right(binfiles.bi,1) = '*' then do
parse value file with test'/'.
if left(binfiles.bi,length(binfiles.bi)-2) = test
then return 1
end
if binfiles.bi = file then return 1
end
return 0
docmd:
parse arg cmd
drop so. se.
x = bpxwunix(cmd,,so.,se.,env.)
return x
/*
>ZGSTAT *** Inline ZGSTAT that will be updated and uploaded */
/*--------------------- rexx procedure -------------------- *
| Name: ZGSTAT |
| |
| Function: To work with the ZIGI Generic Installation |
| tool to add the ISPF statistics to the ZIGI |
| managed partitioned datasets after they have |
| been created by the ZGINSTALL. |
| |
| Syntax: ex zgstat ex |
| |
| Dependencies: Uses a modified copy of the ZIGI zigistat |
| exec |
| |
| Author: Lionel B. Dyck |
| |
| History: (most recent on top) |
| 06/11/20 LBD - Put inline in zginstall.rex |
| 06/10/20 LBD - Usability enhancements |
| 06/09/20 LBD - Creation |
| |
| ---------------------------------------------------------- |
| ZIGI - the z/OS ISPF Git Interface |
| Copyright (C) 2020 - Henri Kuiper and Lionel Dyck |
| |
| This program is free software: you can redistribute it |
| and/or modify it under the terms of the GNU General |
| Public License as published by the Free Software |
| Foundation, either version 3 of the License, or (at |
| your option) any later version. |
| |
| This program 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. |
| |
| You should have received a copy of the GNU General |
| Public License along with this program. If not, see |
| <https://www.gnu.org/licenses/>. |
* ---------------------------------------------------------- */
/* ------------------------------------------------ *
| These variables will be updated by zginstall.rex |
* ------------------------------------------------ */
repodir = '$$$$$$'
hlq = '$$$$$$'
Address ISPExec
load_info = loadispf()
address syscall ,
'readdir' repodir 'files.'
if files.0 = 0 then do
zedsmsg = 'Error'
zedlmsg = 'The directory specified is not the correct directory.'
'setmsg msg(isrz001)'
exit 8
end
do if = 1 to files.0
file = files.if
if left(file,1) = '.' then iterate
/* check for lower case so ignore these */
fx = translate(file,'??????????????????????????', ,
'abcdefghijklmnopqrstuvwxyz')
if pos('?',fx) > 0 then iterate
dsname = "'"hlq"."file"'"
x = listdsi(dsname)
if sysdsorg /= 'PO' then iterate
msg1 = 'Applying ISPF Statistics to:'
msg2 = dsname
call pfshow 'off' /* make sure pfshow is off */
'Control Display Lock'
'Addpop row(8) column(11)'
'Display Panel(zgpop)'
'Rempop'
call pfshow 'reset' /* restore pfshow setting */
x = zigistat(dsname repodir'/.zigi/'file 'U')
end
Done:
x = dropispf(load_info)
zedsmsg = 'Completed.'
zedlmsg = 'ZGSTAT completed ISPF statistics updates.'
'setmsg msg(isrz001)'
exit 0
Cancel:
x = dropispf(load_info)
Say 'ZGSTAT utility canceled.'
exit 8
/* ------------------------------------------------------ *
| The pfshow routine will: |
| 1. check to see the passed option |
| 2. if Off then it will save the current pfshow setting |
| - save the current setting |
| - turn off pfshow |
| 3. if the option is Reset then it will |
| - test if pfshow was on and turn it back on |
* ------------------------------------------------------ */
pfshow:
if zpfshow = 'OFF' then return
arg pfkopt
if pfkopt = 'RESET' then do
if pfkeys = 'ON' then
'select pgm(ispopf) parm(FKA,ON)'
end
if pfkopt = 'OFF' then do
'vget (zpfshow)'
pfkeys = zpfshow
if pfkeys /= 'OFF' then
'select pgm(ispopf) parm(FKA,OFF)'
end
return
/* Inline ISPF Elements - must remain within a comment
>Start
>Panel zgstat
)Attr
_ type(input) caps(on) hilite(uscore)
$ type(input) caps(off) hilite(uscore)
)Body Window(65,7)
+
+Enter the z/OS Dataset HLQ (Prefix):
_hlq +
+
+Enter the OMVS Directory for the Repository:
$repodir +
+
)Init
&zwinttl = 'ZIGI Statistics Apply Utility'
)Proc
ver (&hlq,nb,dsname)
ver (&repodir,nb)
)End
>Panel zgpop
)Attr
@ type(output) caps(off) intens(low)
)Body Window(46,4)
+
@msg1
@msg2
+
)Init
&zwinttl = 'ZIGI Statistics Apply Utility'
)Proc
ver (&hlq,nb,dsname)
ver (&repodir,nb)
)End
>Panel zgpop4
)Attr
$ type(output) caps(off)
)Body Window(62,6)
+
$zs1
$zs2
$zs3
$zs4
)Init
&zwinttl = 'ZIGI Status Popup'
)Proc
)end
/* -------------------------------------------------------- */
/* ZIGI - the z/OS ISPF Git Interface */
/* Copyright (C) 2020 GPL V3 - Henri Kuiper and Lionel Dyck */
/* -------------------------------------------------------- */
>End */
/* -------------------- rexx procedure -------------------- *
| Name: zigistat |
| |
| Function: Collect or Compare the ISPF Stats for all |
| members in a PDS |
| |
| Syntax: x=zigistat(dsname filepath option) |
| |
| dsname is the z/OS dataset name to work with |
| |
| filepath is the OMVS file where the stats are |
| stored and consists of: |
| localdir/repodir/.ZIGI/filename |
| filename is the OMVS file that represents |
| the z/OS PDS dataset name |
| |
| Options: C - compare stats |
| S - save stats |
| U - update stats to those saved |
| used when creating/refreshing datasets |
| |
| Vars: statmems ispf variable for selective update |
| |
| Usage |
| Notes: Subroutine of ZIGI |
| Returns string of members changed |
| |
| Dependencies: |
| ISPF services |
| |
| Return: |
| 0 - stats saved or stats applied |
| 8 - no dsname provided |
| 12 - no filepath provided |
| 16 - no option provided |
| 20 - stats file in /.zigi missing |
| string - string of members with different stats |
| |
| Author: Lionel B. Dyck |
| |
| History: (most recent on top) |
| 10/16/22 LBD - Delete amdlist sysprint tmp dsn |
| 07/19/22 LBD - Fix chtag mixed error |
| 06/19/22 LBD - Fix suffix check compare |
| 04/25/22 TPM - Add 2 dropped statements |
| (LBD - my bad) |
| 03/23/22 TPM - list of repo files not in PDS |
| merged by LBD |
| 03/07/22 LBD - Update usssafe routine tests |
| 03/05/22 LBD - Update usssafe routine for # |
| 03/04/22 LBD - Add ISPF Stats if PDS member |
| does not have them |
| 03/03/22 LBD - Correct debugfil variable |
| 02/15/22 LBD - Correct if no Dovetail |
| 02/07/22 LBD - Fix stats if NOCOZ |
| 12/18/21 LBD - Correct dsorg/recfm test |
| 10/18/21 LBD - Correctly tag stats file |
| 10/08/21 LBD - Check for background |
| 08/18/21 LBD - Correct AMBLIST for Link and |
| Add AMBLIST analysis popups |
| 08/16/21 LBD - Align amblist (lmod) file |
| - Support PDSE lmod libraries |
| 08/04/21 LBD - Use encoding to tag stats file |
| 08/02/21 LBD - Correct use of dovedir variable |
| - use AMBLIST for load libraries |
| 07/26/21 LBD - Fix allmems missing one member |
| 06/03/21 LBD - Change SHAREAS to REQUIRED |
| 05/29/21 LBD - Clean up environment setup |
| 05/26/21 LBD - Use dovetail getpds for stats |
| 05/18/21 LBD - More popups with info and fix |
| allmems variables setup |
| 05/06/21 LBD - Multiple allmems variables |
| 10/25/20 LBD - Improve usssafe routine |
| 09/27/20 LBD - Compare stats improved |
| 08/14/20 LBD - Don't update if readonly repo |
| 06/19/20 LBD - Ignore LMOD aliases as the main |
| lmod will have them included |
| 06/16/20 LBD - Use DEFRUID if it exists |
| 06/09/20 LBD - Bypass stat update for lmod |
| 05/08/20 LBD - Support Load Libraries |
| 01/08/20 LBD - Selecitve stat update if statmems|
| 01/05/20 LBD - Correct special chars in filepath|
| using usssafe routine |
| 11/22/19 LBD - If a member has no stats - add |
| 11/18/19 LBD - Many fixes and add Debug |
| 11/15/19 LBD - Creation |
| |
| ---------------------------------------------------------- |
| ZIGI - the z/OS ISPF Git Interface |
| Copyright (C) 2020-2021 - Henri Kuiper and Lionel Dyck |
| |
| This program is free software: you can redistribute it |
| and/or modify it under the terms of the GNU General |
| Public License as published by the Free Software |
| Foundation, either version 3 of the License, or (at |
| your option) any later version. |
| |
| This program 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. |
| |
| You should have received a copy of the GNU General |