-
Notifications
You must be signed in to change notification settings - Fork 0
/
ts20.dmc
153 lines (128 loc) · 4.55 KB
/
ts20.dmc
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
! System 1022 Usage Report
!
! This program is used to report the amount of connect and cpu time for
! each user. It assumes that the ACSUM and SCHEDULE datasets both reside in
! the accounting area along with this report program.
!
!
! The output from the program is put in ACSUM.RPT. These reports
! along with the output from ACSUM.SUM must be returned to Software House.
! 1022 must be run at least once per day.
open schedule acsum.
join acsum to schedule via uname.
init 1 acsum.rpt.
set fmsg off.
define date rpt_begin_date rpt_end_date cmon
text 40 cname
text 1 ccom asum csched lds
integer x y xx yy cproj cprog
tsec tcpu ![PD]
oldsysiftype oldsyscase.
let oldsysiftype = sysiftype !Save current sysiftype and syscase
sysiftype = 1
oldsyscase = syscase
syscase = 1.
pl1022 start.
dbset acsum.
find all. !get all accounting records.
sort schedule $year start_date $month start_date user_name $day start_date.
!store the begin and end dates for the heading
evaluate rpt_begin_date = min start_date.
evaluate rpt_end_date = max end_date.
call rpt1. !produce the report
close.
close.
let sysiftype = oldsysiftype. !restore initial values and exit
let syscase = oldsyscase.
set fmsg on.
release.
pl1022 stop.
rpt1: !report generator sub-routine
report start.
section initial.
heading print sysdate 'System 1022 Usage Report' 'Page' syspage
'For:' rpt_begin_date 'to' rpt_end_date
' Schedule Month User Name Date Connect CPU '
' -------- ----- ----------------------------- ------ --------- ---------'
fmt 2t d2 26t a 67t a x i /
22t a 2x d2 x a x d2 / /
2t a / 2t a end.
section getrec.
section heading.
on change schedule evaluate csched = schedule.
on change $month start_date evaluate cmon = start_date.
on change user_name evaluate cname = user_name.
section print.
section totals.
on change $day (start_date) GOTO new_day.
GOTO old_day.
new_day: eval tsec =TOT(connect_seconds)
tcpu =TOT(cpu_time) / 1000.
IF tr LT 512 THEN LET lds ' '.
ELSE LET lds '*'.
ENDI.
old_day: on change $day (start_date)
print csched cmon cname $day (start_date) start_date
x = tsec / 3600 ':'
y = (tsec - x*3600) / 60 ':'
tsec - (y*60 + x*3600)
lds
xx = tcpu / 3600 ':'
yy = (tcpu - (xx*3600)) / 60 ':'
tcpu - (yy*60 + xx*3600)
fmt 7t a 11t d2p999xxx9(5) 21t a 50t i2 '-' d5p999x(6)
58t i4 a p99 a p99 X,A1 70t i4 a p99 a p99 end.
on change $day (start_date) evaluate cmon = "",cname = "", csched = "".
on change user_name
eval tsec =TOT(connect_seconds)
tcpu =TOT(cpu_time) / 1000.
on change user_name
print x = tsec / 3600 ':'
y = (tsec - x*3600) / 60 ':'
tsec - (y*60 + x*3600)
xx = tcpu / 3600 ':'
yy = (tcpu - xx*3600) / 60 ':'
tcpu - (yy*60 + xx*3600)
fmt 35t 'Total' 58t i4 a p99 a p99 70t i4 a p99 a p99 / end.
on change $month (start_date)
eval tsec =TOT(connect_seconds)
tcpu =TOT(cpu_time) / 1000.
on change $month (start_date)
print start_date ' Total'
x = tsec / 3600 ':'
y = (tsec - x*3600) / 60 ':'
tsec - (y*60 + x*3600)
xx = tcpu / 3600 ':'
yy = (tcpu - xx*3600) / 60 ':'
tcpu - (yy*60 + xx*3600)
fmt 58t '---------- ----------' /
26t d2p999xxx9(5) a 58t i4 a p99 a p99 70t i4 a p99 a p99 / end.
on change schedule
eval tsec =TOT(connect_seconds)
tcpu =TOT(cpu_time) / 1000.
on change schedule
print 'Total for Schedule' schedule
x = tsec / 3600 ':'
y = (tsec - x*3600) / 60 ':'
tsec - (y*60 + x*3600)
xx = tcpu / 3600 ':'
yy = (tcpu - xx*3600) / 60 ':'
tcpu - (yy*60 + xx*3600)
fmt 58t '========== ==========' /
26t a x a 58t i4 a p99 a p99 70t i4 a p99 a p99 / end.
on end eval
tsec=TOT(connect_seconds)
tcpu=TOT(cpu_time)/1000.
on end print 'Total time'
x = tsec / 3600 ':'
y = (tsec - (x*3600)) / 60 ':'
tsec - (y*60 + x*3600)
xx = tcpu / 3600 ':'
yy = (tcpu - (xx*3600)) / 60 ':'
tcpu - (yy*60 + xx*3600)
fmt / 26t a 56t i6 a p99 a p99 68t i6 a p99 a p99 end.
section final.
report end.
return. !end of report generator sub-routine
pl1022 end.