forked from MVS-sysgen/sysgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsysgen.py
More file actions
executable file
·2465 lines (2038 loc) · 102 KB
/
sysgen.py
File metadata and controls
executable file
·2465 lines (2038 loc) · 102 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
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
#!/usr/bin/env python3
import sys
import os
import datetime
import logging
import subprocess
import threading
import queue
import socket
import time
import argparse
from pathlib import Path
import shutil
from pprint import pprint
from datetime import datetime
try:
from colorama import init, Fore, Style
has_colorama = True
except ModuleNotFoundError:
has_colorama = False
pass
VERSION = "V1R0M0"
CODENAME = 'UNEXPECTED SLOTH'
error_check = [
'open error',
'Creating crash dump',
'DISASTROUS ERROR',
'HHC01023W Waiting for port 3270 to become free for console connections',
'disabled wait state 00020000 80000005'
]
logname='sysgen.log'
usermods = ["AY12275","JLM0001","JLM0002","JLM0003","JLM0004","SLB0002","SYZM001","TIST801","TJES801", #usermods1.jcl
"TMVS804","TMVS816","TTSO801","VS49603","WM00017","ZP60001","ZP60002","ZP60003","ZP60004", #usermods2.jcl
"ZP60005","ZP60006","ZP60007","ZP60008","ZP60009","ZP60011","ZP60012","ZP60013","ZP60014", #usermods3.jcl
"ZP60015","ZP60016","ZP60017","ZP60018","ZP60019","ZP60020","ZP60021","ZP60022","ZP60026", #usermods4.jcl
"ZP60027","ZP60028","ZP60029","ZP60030","ZP60031","ZP60032","ZP60033","ZP60034","ZP60035", #usermods5.jcl
"ZP60036","ZP60037","ZP60038","ZP60039","ZUM0007","ZUM0008", #usermods6.jcl
"SYZJ2001", "TNIP800", "ZP60025", "UZ61025" #"DYNPROC"
]
logo = '''
==============================================================
= ===== == ==== === =========== === === =
= === == ==== == ==== ========= === === == =======
= = = == ==== == ==== ======== === ======== =======
= == == == ==== === ============ ==== ======== =======
= ===== == == ===== ========= ===== ======== ===
= ===== === == ======== ====== ====== ======== =======
= ===== === == === ==== ==== ======= ======== =======
= ===== ==== ==== ==== === ========= === == =======
= ===== ===== ====== === =========== === =
==============================================================
'''
release_readme = '''
# MVS Community Edition
Release: {codename}
Version: {version}
To run MVS/CE run the script `bash start_mvs.sh` and connect your tn3270 client
to localhost (127.0.0.1) on port 3270 (e.g. `x3270 localhost:3270`)
Users:
{users}
For more information see: https://github.com/MVS-sysgen/sysgen
'''
reply_num = 0
if has_colorama:
init(autoreset=True)
colors = {
"BLACK" : Fore.BLACK,
"RED": Fore.RED,
"GREEN": Fore.GREEN,
"YELLOW": Fore.YELLOW,
"BLUE": Fore.BLUE,
"MAGENTA": Fore.MAGENTA,
"CYAN": Fore.CYAN,
"WHITE": Fore.WHITE,
"RESET": Fore.RESET
}
quit_herc_event = threading.Event()
kill_hercules = threading.Event()
reset_herc_event = threading.Event()
STDERR_to_logs = threading.Event()
running_folder = os.path.dirname(os.path.abspath(__file__)) + "/"
os.chdir(os.path.dirname(sys.argv[0]))
logging.basicConfig(filename=running_folder+logname,
filemode='w',
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%H:%M:%S',
level=logging.DEBUG)
USERJOB = ('''//{usern} JOB (1),'ADD TSO USERS',CLASS=S,MSGLEVEL=(1,1),
// MSGCLASS=A
// EXEC TSONUSER,ID={usern},
// PW='{passwd}',
// PR='{proc}',
// OP='{oper}',
// AC='{acct}',
// JC='{jcl}',
// MT='{mount}'
''')
class sysgen:
''' sysgen class to build hercules '''
def __init__(self,
hercbin='hercules',
config='sysgen.conf',
version=False,
username=False,
password=False,
timeout=False,
no_compress=False,
users=False,
profiles=False,
keeptemp=False,
keepbackup=False,
release=False,
install_path = "MVSCE/DASD",
no_brexx = False,
no_rakf = False,
no_ispf = False,
):
self.print_logo()
self.herccmd = hercbin
logging.debug("herccmd set to {}".format(hercbin))
self.configs = {}
self.version = version
self.username = username
self.password = password
self.no_compress = no_compress
self.users = users
self.profiles = profiles
self.keeptemp = keeptemp
self.keepbackup = keepbackup
self.release = release
self.path = Path(running_folder+install_path)
self.timeout = timeout
self.git_hash = ''
self.step = ''
self.substep = ''
self.no_rakf = no_rakf
self.no_brexx = no_brexx
self.no_ispf = no_ispf
self.no_mvp = False
if no_brexx:
self.no_rakf = True
if self.version:
logging.debug("Version set to {}".format(version))
if self.username:
logging.debug("Username set to {}".format(username))
if self.password:
logging.debug("Password set to {}".format(password))
if self.no_compress:
logging.debug("DASD compression disabled")
if self.users:
logging.debug("users files set to {}".format(users))
if self.profiles:
logging.debug("profile file set to {}".format(profiles))
if self.timeout:
logging.debug("Timeout set to {}".format(timeout))
if self.release:
logging.debug("Release Enabled")
try:
os.remove('prt00e.txt')
logging.debug('Removed prt00e.txt')
except OSError:
pass
if self.no_brexx:
self.print("BREXX Install disabled")
logging.debug("BREXX install disabled")
logging.debug("BREXX install disabled, disabling MVP install")
self.no_mvp = True
if self.no_rakf:
self.print("RAKF Install disabled")
logging.debug("RAKF install disabled")
logging.debug("RAKF install disabled, disabling MVP install")
self.no_mvp = True
if self.no_ispf:
self.print("Wally ISPF Install disabled")
logging.debug("Wally ISPF install disabled")
#self.print("Creating MVSCE folder if it does not exist")
Path(running_folder+"MVSCE").mkdir(parents=True, exist_ok=True)
Path(running_folder+"backup").mkdir(parents=True, exist_ok=True)
Path(running_folder+"temp").mkdir(parents=True, exist_ok=True)
self.print("Reading config file: {}".format(running_folder+config))
self.read_configs(running_folder+config)
self.hercproc = False
self.set_version()
self.stderr_q = queue.Queue()
self.stdout_q = queue.Queue()
def install(self, step, substep):
logging.debug("Install: step/substep {}/{}".format(step,substep))
self.skip_steps = False
if step:
self.skip_steps = True
try:
if not step or step == "step_01_build_starter":
self.step_01_build_starter()
step = "step_02_install_smp4"
if step == 'step_02_install_smp4':
self.step_02_install_smp4()
step = "step_03_build_dlibs"
if step == 'step_03_build_dlibs':
self.step_03_build_dlibs(substep)
substep = False
step = "step_04_system_generation"
if step == 'step_04_system_generation':
self.step_04_system_generation(substep)
substep = False
step = "step_05_usermods"
if step == 'step_05_usermods':
self.step_05_usermods(substep)
substep = False
step = "step_06_fdz1d02"
if step == 'step_06_fdz1d02':
self.step_06_fdz1d02()
step = "step_07_customization"
if step == 'step_07_customization':
self.step_07_customization(substep)
substep = False
step = "step_08_rakf"
if step == 'step_08_rakf':
if not self.no_rakf:
self.step_08_rakf()
step = "step_09_mvp"
if step == 'step_09_mvp':
if not self.no_mvp:
self.step_09_mvp()
step = "step_10_extras"
if step == 'step_10_extras':
self.step_10_extras()
step = "step_11_ispf"
if step == 'step_11_ispf':
self.step_11_ispf()
step = "step_12_cleanup"
if step == 'step_12_cleanup':
self.step_12_cleanup()
finally:
s, ss = self.get_step()
if s and not ss:
self.print("Install terminated at step {}. Use '-C' to restart at this step.".format(s),color="RED")
elif s and ss:
self.print("Install terminated at step/substep {}/{}. Use '-C' to restart at this step.".format(s,ss),color="RED")
self.quit_hercules()
def kill(self):
self.hercproc.kill()
def start_threads(self):
# start a pair of threads to read output from hercules
self.stdout_thread = threading.Thread(target=self.queue_stdout, args=(self.hercproc.stdout,self.stdout_q))
self.stderr_thread = threading.Thread(target=self.queue_stderr, args=(self.hercproc.stderr,self.stderr_q))
self.check_hercules_thread = threading.Thread(target=self.check_hercules, args=[self.hercproc])
# self.queue_printer_thread = threading.Thread(target=self.queue_printer, args=('prt00e.txt',self.printer_q))
self.stdout_thread.daemon = True
self.stderr_thread.daemon = True
# self.queue_printer_thread.daemon = True
self.check_hercules_thread.daemon = True
self.stdout_thread.start()
self.stderr_thread.start()
self.check_hercules_thread.start()
# self.queue_printer_thread.start()
def queue_stdout(self, pipe, q):
''' queue the stdout in a non blocking way'''
global reply_num
while True:
l = pipe.readline()
if len(l.strip()) > 0:
if len(l.strip()) > 3 and l[0:2] == '/*' and l[2:4].isnumeric():
reply_num = l[2:4]
logging.debug("Reply number set to {}".format(reply_num))
if "HHC90020W" not in l and "HHC00007I" not in l and "HHC00107I" not in l and "HHC00100I" not in l:
# ignore these messages, they're just noise
# HHC90020W 'hthread_setschedparam()' failed at loc=timer.c:193: rc=22: Invalid argument
# HHC00007I Previous message from function 'hthread_set_thread_prio' at hthreads.c(1170)
logging.debug("[HERCLOG] {}".format(l.strip()))
q.put(l)
for errors in error_check:
if errors in l:
print("Quiting! Irrecoverable Hercules error: {}".format(l.strip()))
kill_hercules.set()
if reset_herc_event.is_set():
break
def queue_stderr(self, pipe, q):
''' queue the stderr in a non blocking way'''
while True:
l = pipe.readline()
if len(l.strip()) > 0:
if STDERR_to_logs.is_set():
logging.debug("[DIAG] {}".format(l.strip()))
if 'MIPS' in l:
logging.debug("[DIAG] {}".format(l.strip()))
q.put(l)
for errors in error_check:
if "Creating crash dump" in l:
os._exit(1)
if errors in l:
print("Quiting! Irrecoverable Hercules error: {}".format(l.strip()))
kill_hercules.set()
if reset_herc_event.is_set():
break
def check_hercules(self, hercproc):
''' check to make sure hercules is still running '''
while hercproc.poll() is None:
if quit_herc_event.is_set() or reset_herc_event.is_set():
logging.debug("Quit Event enabled exiting hercproc monitoring")
return
if kill_hercules.is_set():
hercproc.kill()
break
continue
self.print("ERROR - Hercules Exited Unexpectedly", color="RED")
os._exit(1)
def print_logo(self):
if has_colorama:
print(Style.BRIGHT+ Fore.BLUE + logo, flush=True)
else:
print(logo, flush=True)
def print(self, text='', color="WHITE"):
now = datetime.now()
if has_colorama:
print(Style.BRIGHT+ f"[+] [{now.strftime('%H:%M:%S')}] " + colors[color] + text, flush=True)
else:
print(f"[+] [{now.strftime('%H:%M:%S')}] " + text, flush=True)
logging.debug(text)
def send_herc(self, command=''):
''' Sends hercules commands '''
logging.debug("Sending Hercules Command: {}".format(command))
self.hercproc.stdin.write(command+"\n")
self.hercproc.stdin.flush()
def send_oper(self, command=''):
''' Sends operator/console commands (i.e. prepends /) '''
self.send_herc("/{}".format(command))
def send_reply(self, command=''):
''' Sends operator/console commands with automated number '''
self.send_herc("/r {},{}".format(reply_num,command))
def read_configs(self, config_file=''):
logging.debug("Reading {}".format(config_file))
''' Reads the config file and populates self.configs '''
with open(config_file, 'r') as config:
for line in config.readlines():
l = line.strip()
if len(l) > 2 and "## SECTION:" in l:
section = l.split()[2]
self.configs[section] = []
elif (len(l) > 0 and l[0] == "#") or len(l) == 0:
continue
else:
self.configs[section].append(line.strip())
def set_configs(self, config_section='generic'):
logging.debug("Setting Hercules options")
for config_item in self.configs[config_section]:
if config_item.startswith("0"):
#self.send_herc('detach {}'.format(config_item.split()[0]))
self.send_herc('attach {}'.format(config_item))
else:
self.send_herc(config_item)
self.wait_for_string(config_item)
def unset_configs(self, config_section='generic'):
logging.debug("Dettaching Hercules interfaces")
for config_item in self.configs[config_section]:
if config_item.startswith("0"):
self.send_herc('detach {}'.format(config_item.split()[0]))
#self.wait_for_string('detach {}'.format(config_item.split()[0]))
def set_step(self, step, substep=False):
logging.debug('Setting step to {} Setting substep to {}'.format(step,substep))
self.step = step
self.substep = substep
with open(".step", 'w') as outfile:
if substep:
outfile.write("{} {}".format(step,substep))
else:
outfile.write("{}".format(step))
def get_step(self):
return self.step, self.substep
def devinit(self, dev, upfile):
self.send_herc("devinit {} {}{}".format(dev, running_folder,upfile))
def step_01_build_starter(self):
self.print("Step 1. Building Starter System",color="CYAN")
self.set_step("step_01_build_starter")
if os.path.exists(self.path):
shutil.rmtree(self.path)
self.print("Creating MVSCE/DASD folder if it does not exist")
self.path.mkdir(parents=True, exist_ok=True)
self.reset_hercules()
STDERR_to_logs.set()
self.dasdinit('starter')
self.set_configs('build_starter')
self.send_herc("ipl 280")
self.send_herc("/")
self.wait_for_string('HHC00010A Enter input for console 0:0009')
self.print("[1/4] DASDI Initialization of the START1 DASD volume")
logging.debug("Submitting instart1.sajob")
self.send_oper("input=1442,00c")
self.wait_for_string('/IBC154A READY READER 00C. DEPRESS INTERRUPT KEY.')
self.wait_for_psw('1111')
logging.debug("instart1.sajob complete")
self.send_herc('stop')
self.send_herc("ipl 280")
self.wait_for_psw('FFFF')
self.send_herc("/")
self.wait_for_string('HHC00010A Enter input for console 0:0009')
self.print("[2/4] Performing restore of the START1 DASD volume")
logging.debug("Submitting rsstart1.sajob")
self.send_oper("input=1442,00d")
self.wait_for_psw('EEEE')
logging.debug("rsstart1.sajob complete")
self.send_herc('stop')
self.send_herc("ipl 281")
self.wait_for_psw('FFFF')
self.send_herc("/")
self.wait_for_string('HHC00010A Enter input for console 0:0009')
self.print("[3/4] DASDI Initialization of the SPOOL0 DASD volume")
logging.debug("Submitting inspool0.sajob")
self.send_oper("input=1442,00e")
self.wait_for_psw('1111')
logging.debug("inspool0.sajob complete")
self.send_herc('stop')
self.send_herc("ipl 281")
self.wait_for_psw('FFFF')
self.send_herc("/")
self.wait_for_string('HHC00010A Enter input for console 0:0009')
self.print("[4/4] Performing restore of the SPOOL0 DASD volume")
logging.debug("Submitting rsspool0.sajob")
self.send_oper("input=1442,00f")
self.wait_for_psw('EEEE')
logging.debug("rsspool0.sajob complete")
self.send_herc('stop')
self.quit_hercules(msg=False)
#self.unset_configs('build_starter')
# Wait for the last item to be detached before continuing
#self.wait_for_string("HHC01603I detach {}".format(self.configs['build_starter'][-1].split()[0]))
self.backup_dasd("01_build_starter")
self.print("Build Starter System Complete",color="GREEN")
STDERR_to_logs.clear()
def step_02_install_smp4(self):
self.print("Step 2. Using SMP4 to Build the Distribution Libraries",color="CYAN")
self.set_step("step_02_install_smp4")
self.restore_dasd("01_build_starter")
self.reset_hercules()
self.dasdinit('distribution_libs')
self.set_configs('smp1')
self.wait_for_string("0:0151 CKD")
self.print("Installing SMP 4.44 on the Starter System")
self.send_herc("ipl 150")
self.wait_for_string("HHC00010A Enter input for console 0:001F")
self.send_oper('r 0,clpa')
self.wait_for_string("00 $HASP426 SPECIFY OPTIONS - HASP-II, VERSION JES2 4.0")
self.print("Formatting SPOOL0")
self.send_oper('r 0,format,noreq')
self.wait_for_string('$HASP436 REPLY Y OR N TO CONFIRM CHECKPOINT RECORD CHANGE')
self.send_reply("y")
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.send_oper('$pi2-3')
self.wait_for_string('IS PURGED')
self.print('System Online, mounting DASD')
self.send_herc('attach 148 3350 MVSCE/DASD/smp000.3350')
self.send_herc('attach 149 3350 MVSCE/DASD/work00.3350')
self.send_herc('attach 14a 3350 MVSCE/DASD/work01.3350')
self.wait_for_string('HHC00414I 0:0148 CKD file')
self.print("Installing SMP 4.44")
self.send_herc("devinit 12 jcl/smp4p44.jcl")
self.wait_for_string('HHC02245I 0:0012 device initialized')
self.send_herc('devinit 170 tape/zdlib1.het')
self.wait_for_string("IEF238D SMP4P44 - REPLY DEVICE NAME OR 'CANCEL'.")
self.send_reply('170')
self.wait_for_string('IEC501A SMP4P44,S2')
self.send_herc('devinit 170 tape/smp4b.het')
self.wait_for_string("IEC507D REPLY 'U'-USE OR 'M'-UNLOAD")
self.send_reply('u')
self.wait_for_string("IEC507D REPLY 'U'-USE OR 'M'-UNLOAD")
self.send_reply('u')
self.wait_for_string("IEC507D REPLY 'U'-USE OR 'M'-UNLOAD")
self.send_reply('u')
self.print("Initializing WORK00, WORK01 and SMP000")
self.wait_for_string("IEH841D 148 CONFIRM REQUEST TO INITIALIZE")
self.send_reply('u')
self.wait_for_string('IEH841D 149 CONFIRM REQUEST TO INITIALIZE')
self.send_reply('u')
self.wait_for_string('IEH841D 14A CONFIRM REQUEST TO INITIALIZE')
self.send_reply('u')
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.print("SMP 4.44 Install Complete",color="GREEN")
self.check_maxcc(jobname='SMP4P44')
self.shutdown_mvs()
#self.wait_for_string('HHC01603I detach 014A')
self.quit_hercules(msg=True)
self.backup_dasd("02_install_smp4")
if quit:
self.quit_hercules()
def step_03_build_dlibs(self, start=False):
'''macro function to run the various steps
The start variable allows you to skip to specific steps'''
logging.debug("step_03_build_dlibs: starting at step {}".format(start))
self.skip_steps = False
self.set_step("step_03_build_dlibs")
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
if not start or start == "smpmount":
self.smpmount()
start = "smpjob00"
if start == 'smpjob00':
self.smpjob00()
start = "smpjob01"
if start == 'smpjob01':
self.smpjob01()
start = "smpjob02"
if start == 'smpjob02':
self.smpjob02()
start = "smpjob03"
if start == 'smpjob03':
self.smpjob03()
start = "smpjob04"
if start == 'smpjob04':
self.smpjob04()
start = "smpjob06"
if start == 'smpjob06':
self.smpjob06()
start = "smpjob07"
if start == 'smpjob07':
self.smpjob07()
self.print("Building the MVS 3.8j Distribution Libraries Complete",color="GREEN")
def smpmount(self, quit=False):
self.set_step("step_03_build_dlibs","smpmount")
self.restore_dasd("02_install_smp4")
self.reset_hercules()
self.set_configs('smp2')
self.send_herc('detach 0012')
self.send_herc('attach 0012 3505 jcl/smpmount.jcl eof')
self.send_herc("ipl 150")
self.wait_for_string("HHC00010A Enter input for console 0:001F")
self.send_herc('/')
self.wait_for_string("$HASP426 SPECIFY OPTIONS - HASP-II, VERSION JES2 4.0")
self.send_oper('r 0,noreq')
self.wait_for_string("IEF166D REPLY Y/N TO EXECUTE/SUPPRESS COMMAND")
self.print("Assingning the volume SMP000 to the class of PRIVATE")
self.send_reply('y')
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
self.check_maxcc(jobname='SMPMOUNT')
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("03_SMPMOUNT")
def smpjob00(self):
self.set_step("step_03_build_dlibs","smpjob00")
self.restore_dasd("03_SMPMOUNT")
if self.skip_steps:
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
self.reset_hercules()
self.set_configs('smp2')
self.smpjobs_ipl('Allocating and initializing required datasets')
self.send_herc("devinit 12 jcl/smpjob00.jcl")
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
# The first step - IEHPROGM - receives a condition code of 0008 because it is attempting to delete datasets that are not present.
# The second step - IEFBR14 - is pre-allocating datasets.
# The third step - SMP - is initializing control information in several of the SMP datasets.
# One of the first tasks it attempts is to delete a target that is not there (remember the
# datasets were just allocated and are empty), so it gets a condition code of 0008. It will
# always get that code, so it is expected and acceptable.
self.check_maxcc(jobname='SMPJOB00', steps_cc={'IEHPROGM':'0008', 'DLBUCL' : '0008' })
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("04_SMPJOB00")
def smpjob01(self):
self.set_step("step_03_build_dlibs","smpjob01")
self.restore_dasd("04_SMPJOB00")
if self.skip_steps:
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
self.reset_hercules()
self.set_configs('smp2')
self.smpjobs_ipl('Loading MVS 3.8j product elements into SMP from tape')
self.send_herc("devinit 12 jcl/smpjob01.jcl")
self.wait_for_string("IEF247I SMPJOB01 - 471,570,571,670,671 NOT ACCESSIBLE")
self.send_herc('devinit 170 tape/zdlib1.het')
self.send_reply('170')
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.check_maxcc(jobname='SMPJOB01')
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("05_SMPJOB01")
def smpjob02(self):
self.set_step("step_03_build_dlibs","smpjob02")
self.restore_dasd("05_SMPJOB01")
if self.skip_steps:
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
self.reset_hercules()
self.set_configs('smp2')
self.smpjobs_ipl('Copying 1,482 PTFs into SMP datasets')
self.send_herc("devinit 12 jcl/smpjob02.jcl")
self.wait_for_string("IEF247I SMPJOB02 - 471,570,571,670,671 NOT ACCESSIBLE")
self.send_herc('devinit 170 tape/ptfs.het')
self.send_reply('170')
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.check_maxcc(jobname='SMPJOB02')
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("06_SMPJOB02")
def smpjob03(self):
self.set_step("step_03_build_dlibs","smpjob03")
self.restore_dasd("06_SMPJOB02")
if self.skip_steps:
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
self.reset_hercules()
self.set_configs('smp2')
self.print("Updating SMP 4.44 to SMP 4.48")
self.smpjobs_ipl('Accepting product elements and PTFs')
self.send_herc("devinit 12 jcl/smpjob03.jcl")
self.print(" !!This step can take upwards of twenty minutes!!")
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE', timeout=3600)
self.check_maxcc(jobname='SMPJOB03', steps_cc={"DLBUCL2":"0004", "DLBUCL4":"0004" })
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("07_SMPJOB03")
def smpjob04(self):
self.set_step("step_03_build_dlibs","smpjob04")
self.restore_dasd("07_SMPJOB03")
if self.skip_steps:
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
self.reset_hercules()
self.set_configs('smp2')
self.smpjobs_ipl('Installing Jim Morrison Usermods for 3375, 3380, and 3390 DASD devices')
self.send_herc("devinit 12 jcl/smpjob04.jcl")
self.wait_for_string("IEF247I SMPJOB04 - 471,570,571,670,671 NOT ACCESSIBLE")
self.send_herc("devinit 170 tape/j90009.het")
self.send_reply('170')
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.check_maxcc(jobname='SMPJOB04')
self.send_herc("devinit 12 jcl/smpjob05.jcl")
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.check_maxcc(jobname='SMPJOB05', steps_cc={"DLBUCL":"0004"})
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("08_SMPJOB04-05")
def smpjob06(self):
self.set_step("step_03_build_dlibs","smpjob06")
self.restore_dasd("08_SMPJOB04-05")
if self.skip_steps:
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
self.reset_hercules()
self.set_configs('smp2')
self.smpjobs_ipl('Cleaning up')
self.send_herc("devinit 12 jcl/smpjob06.jcl")
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.check_maxcc(jobname='SMPJOB06', steps_cc={"DLBUCL":"0004"})
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("09_SMPJOB06")
def smpjob07(self):
self.set_step("step_03_build_dlibs","smpjob07")
self.restore_dasd("09_SMPJOB06")
if self.skip_steps:
self.print("Step 3. Building the MVS 3.8j Distribution Libraries",color="CYAN")
self.reset_hercules()
self.set_configs('smp2')
self.smpjobs_ipl('Building ICKDSF Utility and Re-Linking IFOX00')
self.send_herc("devinit 12 jcl/smpjob07.jcl")
self.wait_for_string("IEC507D REPLY 'U'-USE OR 'M'-UNLOAD")
self.send_reply('u')
self.wait_for_string("IEC507D REPLY 'U'-USE OR 'M'-UNLOAD")
self.send_reply('u')
self.wait_for_string("IEC507D REPLY 'U'-USE OR 'M'-UNLOAD")
self.send_reply('u')
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
self.check_maxcc(jobname='SMPJOB07')
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("10_SMPJOB07")
def smpjobs_ipl(self, step_text=''):
self.print(step_text)
self.send_herc('detach 0012')
self.send_herc('attach 0012 3505 jcl/null.jcl eof')
self.send_herc("ipl 150")
self.wait_for_string("HHC00010A Enter input for console 0:001F")
self.send_herc('/')
self.wait_for_string("$HASP426 SPECIFY OPTIONS - HASP-II, VERSION JES2 4.0")
self.send_oper('r 0,noreq')
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
# SYSGEN
def step_04_system_generation(self, start=False):
'''macro function to run the various steps
The start variable allows you to skip to specific steps'''
logging.debug("step_04_system_generation: starting at step {}".format(start))
self.set_step("step_04_system_generation")
self.skip_steps = False
self.print("Step 4. Performing a System Generation - Building MVS 3.8j",color="CYAN")
if not start or start == 'sysgen00':
self.sysgen00()
start = "sysgen01"
if start == 'sysgen01':
self.sysgen01()
start = "sysgen01a"
if start == 'sysgen01a':
self.sysgen01a()
start = "sysgen01b"
if start == 'sysgen01b':
self.sysgen01b()
start = "sysgen01c"
if start == 'sysgen01c':
self.sysgen01c()
start = "sysgen01d"
if start == 'sysgen01d':
self.sysgen01d()
start = "sysgen01e"
if start == 'sysgen01e':
self.sysgen01e()
start = "sysgen01f"
if start == 'sysgen01f':
self.sysgen01f()
start = "sysgen02"
if start == 'sysgen02':
self.sysgen02()
start = "sysgen03"
if start == 'sysgen03':
self.sysgen03()
start = "sysgen04"
if start == 'sysgen04':
self.sysgen04()
start = "sysgen05"
if start == 'sysgen05':
self.sysgen05()
start = "sysgen05a"
if start == 'sysgen05a':
self.sysgen05a()
start = "sysgen06"
if start == 'sysgen06':
self.sysgen06()
self.print("System Generation - Building MVS 3.8j Complete",color="GREEN")
def sysgenjobs_ipl(self, step_text=''):
self.print(step_text)
self.reset_hercules()
self.set_configs('sysgen2')
#self.wait_for_string("0:0151 CKD")
self.send_herc("ipl 150")
self.wait_for_string("HHC00010A Enter input for console 0:001F")
self.send_oper('r 0,clpa')
self.wait_for_string("00 $HASP426 SPECIFY OPTIONS - HASP-II, VERSION JES2 4.0")
self.send_oper('r 0,noreq')
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
# self.send_oper('$pi2-3')
# self.wait_for_string('$HASP250 INIT IS PURGED')
# self.wait_for_string('$HASP250 INIT IS PURGED')
# self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
def sysgen00(self):
self.set_step("step_04_system_generation","sysgen00")
self.restore_dasd("10_SMPJOB07")
if self.skip_steps:
self.print("Step 4. Performing a System Generation - Building MVS 3.8j",color="CYAN")
self.reset_hercules()
self.dasdinit('sysgen')
self.set_configs('sysgen')
#self.wait_for_string("0:0151 CKD")
self.send_herc("ipl 150")
self.wait_for_string("HHC00010A Enter input for console 0:001F")
self.send_oper('r 0,clpa')
self.wait_for_string("00 $HASP426 SPECIFY OPTIONS - HASP-II, VERSION JES2 4.0")
self.send_oper('r 0,noreq')
self.wait_for_string('$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE')
self.send_oper('$pi2-3')
self.wait_for_string('IS PURGED')
#self.print('System Online, mounting DASD')
self.send_herc('attach 149 3350 MVSCE/DASD/mvsres.3350')
self.send_herc('attach 14a 3350 MVSCE/DASD/mvs000.3350')
self.send_herc('attach 14b 3350 MVSCE/DASD/spool1.3350')
self.send_herc('attach 14c 3350 MVSCE/DASD/page00.3350')
self.wait_for_string('HHC00414I 0:014C CKD file')
self.print("Initializing target DASD volumes and preparing for System Generation")
self.send_herc("devinit 12 jcl/sysgen00.jcl")
self.wait_for_string("ICK003D REPLY U TO ALTER VOLUME 149 CONTENTS")
self.send_reply('u')
self.wait_for_string("ICK003D REPLY U TO ALTER VOLUME 14A CONTENTS")
self.send_reply('u')
self.wait_for_string("ICK003D REPLY U TO ALTER VOLUME 14B CONTENTS")
self.send_reply('u')
self.wait_for_string("ICK003D REPLY U TO ALTER VOLUME 14C CONTENTS")
self.send_reply('u')
self.wait_for_string("IEF166D REPLY Y/N TO EXECUTE/SUPPRESS COMMAND")
self.send_reply('y')
self.wait_for_string("IEF166D REPLY Y/N TO EXECUTE/SUPPRESS COMMAND")
self.send_reply('y')
self.wait_for_string("IEF166D REPLY Y/N TO EXECUTE/SUPPRESS COMMAND")
self.send_reply('y')
self.wait_for_string("IEF166D REPLY Y/N TO EXECUTE/SUPPRESS COMMAND")
self.send_reply('y')
self.wait_for_string("IEF166D REPLY Y/N TO EXECUTE/SUPPRESS COMMAND")
self.send_reply('y')
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
self.check_maxcc(jobname='MOUNT')
self.check_maxcc(jobname='SYSGEN00', steps_cc={"IEHPROGM":"0008"})
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("11_SYSGEN00")
def sysgen01(self):
self.set_step("step_04_system_generation","sysgen01")
self.restore_dasd("11_SYSGEN00")
if self.skip_steps:
self.print("Step 4. Performing a System Generation - Building MVS 3.8j",color="CYAN")
self.sysgenjobs_ipl("Building the hardware configuration for MVS 3.8j")
self.send_herc("devinit 12 jcl/sysgen01.jcl")
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
self.check_maxcc(jobname='SYSGEN01', steps_cc={"CLEANUP":"0008"})
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("12_SYSGEN01")
self.hetget_sysgen01()
self.sysgen01_extract()
def sysgen01a(self):
self.set_step("step_04_system_generation","sysgen01a")
if self.skip_steps:
self.restore_dasd("12_SYSGEN01")
self.print("Step 4. Performing a System Generation - Building MVS 3.8j",color="CYAN")
self.sysgenjobs_ipl("Building SYSGEN01A")
self.send_herc("devinit 12 temp/sysgen01a.jcl")
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
steps={
"SG19": "0004",
"SG28": "0004",
"SG29": "0004",
"SG31": "0004",
"SG32": "0004",
"SG37": "0004",
}
self.check_maxcc(jobname='SYSGEN1',steps_cc=steps)
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("13_SYSGEN01A")
def sysgen01b(self):
self.set_step("step_04_system_generation","sysgen01b")
self.restore_dasd("13_SYSGEN01A")
if self.skip_steps:
self.print("Step 4. Performing a System Generation - Building MVS 3.8j",color="CYAN")
self.sysgenjobs_ipl("Building SYSGEN01B")
self.send_herc("devinit 12 temp/sysgen01b.jcl")
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
steps={
"SG8": "0004",
"SG13": "0004",
"SG33": "0004"
}
self.check_maxcc(jobname='SYSGEN2',steps_cc=steps)
self.shutdown_mvs()
self.quit_hercules(msg=False)
self.backup_dasd("14_SYSGEN01B")
def sysgen01c(self):
self.set_step("step_04_system_generation","sysgen01c")
self.restore_dasd("14_SYSGEN01B")
if self.skip_steps:
self.print("Step 4. Performing a System Generation - Building MVS 3.8j",color="CYAN")
self.sysgenjobs_ipl("Building SYSGEN01C")
self.send_herc("devinit 12 temp/sysgen01c.jcl")
self.wait_for_string("$HASP099 ALL AVAILABLE FUNCTIONS COMPLETE")
self.check_maxcc(jobname='SYSGEN3')
self.shutdown_mvs()
self.quit_hercules(msg=False)