-
Notifications
You must be signed in to change notification settings - Fork 0
/
BCOUTBC25.py
executable file
·109 lines (98 loc) · 2.29 KB
/
BCOUTBC25.py
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
import datetime
import subprocess,sys
from x3270if import *
HOST = 'mainframe' # 'hercules' or 'mainframe'
PORT = '5000'
FILE='/home/hercules/mfoutlist/BCOUTBC25'
# FILE='/home/miftah/mfoutlist/BCOUTBC25'
JCL="IMSVS.PROD.BMP(BCOUTBC2)"
TSO_USER = "TSO MPMCS99"
end = datetime.datetime.now()
if end.strftime("%w") == '1':
begin = datetime.datetime.now() + datetime.timedelta(days=-3)
else:
begin = datetime.datetime.now() + datetime.timedelta(days=-1)
PARAM_INTERVAL = "%s %s" % (begin.strftime("%y%m%d"),end.strftime("%y%m%d"))
def handle():
cek_konek(PORT)
string(PORT,TSO_USER)
enter(PORT)
enter(PORT)
enter(PORT)
enter(PORT)
cek_logon(PORT)
string(PORT,"P.2")
enter(PORT)
tab(PORT)
string(PORT,JCL)
enter(PORT)
string(PORT,"RES")
enter(PORT)
movecursor(PORT,5,10)
string(PORT,"MPMCS99I")
movecursor(PORT,7,26)
if HOST == 'hercules':
string(PORT,"MPMCS99 ")
elif HOST == 'mainframe':
string(PORT,"MPMCS99")
movecursor(PORT,21,8)
string(PORT,PARAM_INTERVAL)
movecursor(PORT,3,14)
string(PORT,"SUB")
enter(PORT)
job = job_info(PORT)
print(job)
while True:
enter(PORT)
result = job_result(PORT,job)
print(result)
if result[0]:
break
subprocess.Popen("sleep 2",shell=True).wait()
rc_code = result[0].find("MAXCC=0")
if rc_code > 1:
print(result[0])
else:
sys.exit(result[0])
enter(PORT)
enter(PORT)
pf(PORT,3)
pf(PORT,3)
pf(PORT,3)
string(PORT,"SD.H")
enter(PORT)
rows = sd_h_row(PORT,job)
row = int(rows[0])-1
movecursor(PORT,row,1)
string(PORT,"XDC")
enter(PORT)
enter(PORT)
movecursor(PORT,23,20)
string(PORT,"/\$P JQ,JM=MPMCS99*")
enter(PORT)
enter(PORT)
enter(PORT)
pf(PORT,3)
pf(PORT,3)
string(PORT,"P.2")
enter(PORT)
tab(PORT)
string(PORT,"mpmcs99.transfer")
enter(PORT)
string(PORT,"RES")
enter(PORT)
string(PORT,"c x'00' ' ' all")
enter(PORT)
pf(PORT,3)
pf(PORT,3)
string(PORT,"6")
enter(PORT)
transfer(PORT,FILE)
pf(PORT,3)
pf(PORT,3)
pf(PORT,3)
string(PORT,"2")
enter(PORT)
string(PORT,"logoff")
enter(PORT)
return 'ALHAMDULILLAH'