-
Notifications
You must be signed in to change notification settings - Fork 9
/
cogs9a.mlc
213 lines (212 loc) · 8.67 KB
/
cogs9a.mlc
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
PRINT NOGEN
****************************************************************
* FILENAME: COGS9A.MLC *
* AUTHOR : Bill Qualls/z390 adaption by Anthony Delosa *
* SYSTEM : z390 v1703 *
* REMARKS : Produce report for COGSWORTH INDUSTRIES *
* showing sales by state. *
* Modify COGS7A.MLC to use ED instruction. *
****************************************************************
START 0
EQUREGS
BEGIN SUBENTRY
WTO 'COGS9A ... Begin execution'
BAL R10,SETUP
MAIN EQU *
CLI EOFSW,C'Y'
BE EOJ
BAL R10,PROCESS
B MAIN
EOJ EQU *
BAL R10,WRAPUP
WTO 'COGS9A ... Normal end of program'
RETURN
****************************************************************
* SETUP - Those things which happen one time only, *
* before any records are processed. *
****************************************************************
SETUP EQU *
ST R10,SVSETUP
OPEN (INVENTRY,INPUT)
OPEN (REPORT,OUTPUT)
BAL R10,HDGS
BAL R10,READ
L R10,SVSETUP
BR R10
****************************************************************
* HDGS - Print headings. *
****************************************************************
HDGS EQU *
ST R10,SVHDGS
PUT REPORT,HD1
PUT REPORT,HD2
PUT REPORT,HD3
PUT REPORT,HD4
PUT REPORT,HD5
L R10,SVHDGS
BR R10
****************************************************************
* PROCESS - Those things which happen once per record. *
****************************************************************
PROCESS EQU *
ST R10,SVPROC
BAL R10,FORMAT
BAL R10,WRITE
BAL R10,READ
L R10,SVPROC
BR R10
****************************************************************
* READ - Read a record. *
****************************************************************
READ EQU *
ST R10,SVREAD
GET INVENTRY,IREC Read a single product record
AP #IN,=P'1' Increment record count
B READX
ATEND EQU *
MVI EOFSW,C'Y'
READX EQU *
L R10,SVREAD
BR R10
****************************************************************
* FORMAT - Format a single detail line. *
****************************************************************
FORMAT EQU *
ST R10,SVFORM
MVC OREC,BLANKS
MVC ODESC,IDESC
* MVC OCALIF,ICALIF
* MVC OILL,IILL
* MVC OUTAH,IUTAH
* MVC OWISC,IWISC
PACK WCALIF,ICALIF Each product's sales must
PACK WILL,IILL be packed so they can be
PACK WUTAH,IUTAH added to total for this
PACK WWISC,IWISC product...
MVC OCALIF,WMASK Move edit mask
ED OCALIF,WCALIF .. and edit
MVC OILL,WMASK Move edit mask
ED OILL,WILL .. and edit
MVC OUTAH,WMASK Move edit mask
ED OUTAH,WUTAH .. and edit
MVC OWISC,WMASK Move edit mask
ED OWISC,WWISC .. and edit
ZAP WTOTAL,=P'0' Initialize the total to zero
AP WTOTAL,WCALIF and start adding...
AP WTOTAL,WILL
AP WTOTAL,WUTAH
AP WTOTAL,WWISC
MVC OTOTAL,WMASK Move edit mask
ED OTOTAL,WTOTAL .. and edit
* UNPK OTOTAL,WTOTAL Move total to output,
* MVZ OTOTAL+2(1),=X'F0' and remove the sign.
L R10,SVFORM
BR R10
****************************************************************
* WRITE - Write a single detail line. *
****************************************************************
WRITE EQU *
ST R10,SVWRITE
PUT REPORT,OREC Write report line
L R10,SVWRITE
BR R10
****************************************************************
* WRAPUP - Those things which happen one time only, *
* after all records have been processed. *
****************************************************************
WRAPUP EQU *
ST R10,SVWRAP
MVC OREC,BLANKS
BAL R10,WRITE Skip a line.
MVC OREC(23),=CL23'BZZ9 records processed.'
MVC OREC(4),WMASK Move edit mask
ED OREC(4),#IN .. and edit
* UNPK OREC(3),#IN Count
* MVZ OREC+2(1),=X'F0' Remove sign
BAL R10,WRITE
CLOSE INVENTRY
CLOSE REPORT
WTO 'COGS9A ... Sales recap on REPORT.TXT'
L R10,SVWRAP
BR R10
****************************************************************
* Literals, if any, will go here *
****************************************************************
LTORG
****************************************************************
* File definitions *
****************************************************************
INVENTRY DCB LRECL=39,RECFM=FT,MACRF=R,EODAD=ATEND, X
DDNAME=INVENTRY,RECORD=IREC
REPORT DCB LRECL=60,RECFM=FT,MACRF=W, X
DDNAME=REPORT
****************************************************************
* RETURN ADDRESSES *
****************************************************************
SVSETUP DC F'0' SETUP
SVHDGS DC F'0' HDGS
SVPROC DC F'0' PROCESS
SVREAD DC F'0' READ
SVFORM DC F'0' FORMAT
SVWRITE DC F'0' WRITE
SVWRAP DC F'0' WRAPUP
****************************************************************
* Miscellaneous field definitions *
****************************************************************
EOFSW DC CL1'N' End of file? (Y/N)
BLANKS DC CL60' '
WCALIF DC PL2'0' Units sold in Calif
WILL DC PL2'0' Units sold in Illinois
WUTAH DC PL2'0' Units sold in Utah
WWISC DC PL2'0' Units sold in Wisconsin
WTOTAL DC PL2'0' Units sold in all states
#IN DC PL2'0' Input record count
WMASK DC X'40202120' BZZ9
****************************************************************
* Input record definition *
****************************************************************
IREC DS 0CL39 1-39 Inventory record
IDESC DS CL10 1-10 Product description
ICALIF DS CL3 11-13 Units sold in Calif
IILL DS CL3 14-16 Units sold in Illinois
IUTAH DS CL3 17-19 Units sold in Utah
IWISC DS CL3 20-22 Units sold in Wisconsin
IBEGIN DS CL3 23-25 Beginning inventory
IPURCH DS CL3 26-28 Purchases throughout year
IQOH DS CL3 29-31 Actual quantity on hand
ICOST DS CL4 32-35 Cost (each) 99V99
ISELL DS CL4 36-39 Sell for (each) 99V99
****************************************************************
* Output (line) definition *
****************************************************************
OREC DS 0CL60 1-60
ODESC DS CL10 1-10 Product description
DS CL4 11-14
OCALIF DS CL4 15-18 Units sold in Calif
DS CL5 19-23
OILL DS CL4 24-27 Units sold in Illinois
DS CL5 28-32
OUTAH DS CL4 33-36 Units sold in Utah
DS CL5 37-41
OWISC DS CL4 42-45 Units sold in Wisconsin
DS CL5 46-50
OTOTAL DS CL4 51-54 Units sold in all states
DS CL6 55-60
****************************************************************
* Headings definitions *
****************************************************************
HD1 DS 0CL60
DC CL40' COGSWORTH INDUSTRIES '
DC CL20' '
HD2 DS 0CL60
DC CL40' Sales Recap '
DC CL20' '
HD3 DS 0CL60
DC CL60' '
HD4 DS 0CL62
DC CL40'Product Calif Ill Utah '
DC CL20' Wisc TOTAL'
HD5 DS 0CL60
DC CL40'---------- ----- ----- ----- '
DC CL20' ----- -----'
END BEGIN