1
0
mirror of https://github.com/moshix/mvs.git synced 2026-02-05 15:35:02 +00:00
Files
moshix.mvs/PC370_orig/Diskette/source/COGS16B.MLC

238 lines
10 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
PRINT NOGEN
****************************************************************
* FILENAME: COGS16B.MLC *
* AUTHOR : Bill Qualls *
* SYSTEM : Compaq 286LTE, PC/370 R4.2 *
* REMARKS : Produce report for COGSWORTH INDUSTRIES *
* California's contribution to sales. *
* This is a modification of COGS13B.MLC and *
* illustrates binary division. *
****************************************************************
START 0
REGS
BEGIN BEGIN
WTO 'COGS16B ... Begin execution'
BAL R10,SETUP
MAIN EQU *
CLI EOFSW,C'Y'
BE EOJ
BAL R10,PROCESS
B MAIN
EOJ EQU *
BAL R10,WRAPUP
WTO 'COGS16B ... 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 is EBCDIC, no CR/LF
OI REPORT+10,X'08' PC/370 ONLY - Convert all
* output from EBCDIC to ASCII
OPEN REPORT
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
PUT REPORT,HD6
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
****************************************************************
* FORMAT - Format a single detail line. *
****************************************************************
FORMAT EQU *
ST R10,SVFORM
MVC OREC,BLANKS
MVC ODESC,IDESC
LH R3,ICALIF Determine total units
AH R3,IILL sold for this product
AH R3,IUTAH
AH R3,IWISC R3 = Nationwide
LR R2,R3
A R2,TTOTAL Add nationwide so far
ST R2,TTOTAL and save it back.
CVD R3,DBLWORD Convert to packed
ZAP PK2,DBLWORD for printing.
MVC OTOTAL,=X'40202120'
ED OTOTAL,PK2
LH R5,ICALIF R5 = California only
LR R2,R5
A R2,TCALIF Add California so far
ST R2,TCALIF and save it back.
CVD R5,DBLWORD Convert to packed
ZAP PK2,DBLWORD for printing.
MVC OCALIF,=X'40202120'
ED OCALIF,PK2
M R4,=F'1000' Dividend will be in (R4,R5)
DR R4,R3 Divisor (nationwide) in R3
CVD R5,DBLWORD Quotient is in R5
SRP DBLWORD,64-1,5
ZAP PK2,DBLWORD
MVC OPCT,=X'40202120'
ED OPCT,PK2
MVI OPCT+L'OPCT,PERCENT
MVC OCRLF,WCRLF PC/370 only.
L R10,SVFORM
BR R10
****************************************************************
* READ - Read a record. *
****************************************************************
READ EQU *
ST R10,SVREAD
GET INVENTRY,IREC Read a single product record
B READX
ATEND EQU *
MVI EOFSW,C'Y'
READX EQU *
L R10,SVREAD
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
PUT REPORT,HD6
MVC OREC,BLANKS
MVC ODESC(6),=C'TOTALS'
L R3,TTOTAL R3 = Nationwide total
CVD R3,DBLWORD Convert to packed
ZAP PK2,DBLWORD for printing.
MVC OTOTAL,=X'40202120'
ED OTOTAL,PK2
L R5,TCALIF R5 = California only
CVD R5,DBLWORD Convert to packed
ZAP PK2,DBLWORD for printing.
MVC OCALIF,=X'40202120'
ED OCALIF,PK2
M R4,=F'1000' Dividend will be in (R4,R5)
DR R4,R3 Divisor (nationwide) in R3
CVD R5,DBLWORD Quotient is in R5
SRP DBLWORD,64-1,5
ZAP PK2,DBLWORD
MVC OPCT,=X'40202120'
ED OPCT,PK2
MVI OPCT+L'OPCT,PERCENT
MVC OCRLF,WCRLF PC/370 only.
BAL R10,WRITE
CLOSE INVENTRY
CLOSE REPORT
WTO 'COGS16B ... Sales report on REPORT.TXT'
L R10,SVWRAP
BR R10
****************************************************************
* Literals, if any, will go here *
****************************************************************
LTORG
****************************************************************
* File definitions *
****************************************************************
INVENTRY DCB LRECL=28,RECFM=F,MACRF=G,EODAD=ATEND,
DDNAME='COGS.BIN'
REPORT DCB LRECL=62,RECFM=F,MACRF=P,
DDNAME='REPORT.TXT'
****************************************************************
* 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 *
****************************************************************
WCRLF DC X'0D25' PC/370 ONLY - EBCDIC CR/LF
EOFSW DC CL1'N' End of file? (Y/N)
BLANKS DC CL62' '
TCALIF DC F'0' Grand total for Calif
TTOTAL DC F'0' Grand total nationwide
DBLWORD DC D'0'
PK2 DC PL2'0'
PERCENT EQU C'%'
****************************************************************
* Input record definition *
****************************************************************
DS 0H Force halfword alignment
IREC DS 0CL28 1-28 Inventory record
IDESC DS CL10 1-10 Product description
ICALIF DS H 11-12 Units sold in Calif
IILL DS H 13-14 Units sold in Illinois
IUTAH DS H 15-16 Units sold in Utah
IWISC DS H 17-18 Units sold in Wisconsin
IBEGIN DS H 19-20 Beginning inventory
IPURCH DS H 21-22 Purchases throughout year
IQOH DS H 23-24 Actual quantity on hand
ICOST DS H 25-26 Cost (each) 99V99
ISELL DS H 27-28 Sell for (each) 99V99
****************************************************************
* Output (line) definition *
****************************************************************
OREC DS 0CL62 1-62
ODESC DS CL10 1-10 Product description
DS CL7 11-17
OTOTAL DS CL4 18-21 Units sold Nationwide
DS CL9 22-30
OCALIF DS CL4 31-34 Units sold in Calif
DS CL8 35-42
OPCT DS CL4 43-46 Percent sales from Calif
DS CL14 47-60
OCRLF DS CL2 61-62 PC/370 only - CR/LF
****************************************************************
* Headings definitions *
****************************************************************
HD1 DS 0CL62
DC CL60' COGSWORTH INDUSTRIES '
DC XL2'0D25'
HD2 DS 0CL62
DC CL60' California''s Contribution to Sales'
DC XL2'0D25'
HD3 DS 0CL62
DC CL60' '
DC XL2'0D25'
HD4 DS 0CL62
DC CL40' Nationwide California '
DC CL20'Percent of'
DC XL2'0D25'
HD5 DS 0CL62
DC CL40' Product Sales Sales '
DC CL20' National '
DC XL2'0D25'
HD6 DS 0CL62
DC CL40'---------- ---------- ---------- '
DC CL20'----------'
DC XL2'0D25'
END BEGIN