Trailing-Edge
-
PDP-10 Archives
-
BB-M836A-BM
-
tools/usag20/usag20.cbl
There are 17 other files named usag20.cbl in the archive. Click here to see a list.
IDENTIFICATION DIVISION.
PROGRAM-ID. USAG20. V3(4).
AUTHOR. BAHUIZENGA
DATE-WRITTEN. JULY, 1977.
REMARKS.
EDIT HISTORY:
EDIT 4 - 1-DEC-77/BAH ROUNDING WAS NOT BEING DONE WHEN NEEDED.
TCO #1886
EDIT 3 - 7-NOV-77/BAH DISK USAGE REPORT WAS NOT COMPLETE DUE TO
AN EDITING ERROR. TCO #1884
EDIT 2 - 31-OCT-77 /BAH DISK USAGE REPORT IS CONFUSING. ADD ANOTHER
COLUMN GIVING THE AVERAGE NUMBER OF FILES ACCOUNTED FOR.
AVERAGE NO. OF FILES = SUM OF FILES / NO. OF RECORDS READ
TCO #1882
COPYRIGHT (C) 1978, 1979 BY
DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
TRANSFERRED.
THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.
DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
INPUT: USAGE.OUT (DEFAULT)
OUTPUT: USAGE.RPT (DEFAULT)
ASSEMBLY: USES LIBRARY FILE USAG20.LIB.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
'NAME' IS NAME-DETAIL;
'ACCOUNT' IS ACCOUNT-DETAIL
'DNAME' IS DISK-NAME-DETAIL
'DACCOUNT' IS DISK-ACCOUNT-DETAIL.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IN-FILE
ASSIGN TO DSK
RECORDING MODE IS ASCII.
SELECT OUT-FILE
ASSIGN TO DSK
RECORDING MODE IS ASCII.
SELECT SORT-USAGE
ASSIGN TO DSK, DSK, DSK.
SELECT CHARGE-FILE
ASSIGN TO DSK
RECORDING MODE IS ASCII.
DATA DIVISION.
FILE SECTION.
FD IN-FILE VALUE OF ID IS IN-FILE-NAME-EXT
DATA RECORDS ARE IN-RECORD, ENTRY-HEADER-RECORD, TOPS20-USER-ID-RECORD,
RESTART-RECORD, SESSION-RECORD-1, DATE-TIME-CHANGE-RECORD,
USAGE-FILE-HEADER-RECORD, INPUT-SPOOLER-RECORD, OUTPUT-SPOOLER-RECORD,
DISK-DIRECTORY-RECORD, DISK-ACCOUNT-RECORD.
01 IN-RECORD COPY USAG20.
FD OUT-FILE VALUE OF ID IS OUT-FILE-NAME-EXT
REPORTS ARE NAMES, ACCOUNTS, DNAMES, DACCOUNTS.
01 OUT-RECORD DISPLAY-7 PIC X(137).
FD CHARGE-FILE VALUE OF ID IS 'USAG20CHG'.
01 CHARGE-RECORD PIC X(80).
SD SORT-USAGE
DATA RECORDS ARE SYSTEM-SORT-RECORD, DISK-SORT-RECORD.
01 SYSTEM-SORT-RECORD.
02 NAME-SORT PIC X(39).
02 REMARK-SORT PIC X(39).
02 ACCOUNT-SORT PIC X(39).
02 CONNECT-SORT PIC 9(6)V99.
02 RUNTIME-SORT PIC 9(7)V9.
02 SPOOLER-INPUT-SORT PIC 9(7).
02 SPOOLER-OUTPUT-SORT PIC 9(7).
02 CHARGE-SORT PIC 9(9)V99.
01 DISK-SORT-RECORD.
02 DIRECTORY-SORT PIC X(39).
02 STRUCTURE-SORT PIC X(39).
02 FILLER PIC X(39).
02 DISK-PAGE-SORT PIC 9(8).
02 FILE-SORT PIC 9(5).
02 FILLER PIC X(28).
WORKING-STORAGE SECTION.
01 LETTER-MONTH-RECORD USAGE IS DISPLAY-7
VALUE 'JanFebMarAprMayJunJulAugSepOctNovDec'.
02 LETTER-MONTH PIC X(3) OCCURS 12 TIMES.
01 IN-FILE-NAME-EXT.
02 IN-FILE-NAME PIC X(6).
02 IN-FILE-EXT PIC X(3).
01 OUT-FILE-NAME-EXT.
02 OUT-FILE-NAME PIC X(6).
02 OUT-FILE-EXT PIC X(3).
01 THIS-DATE.
02 TD-YEAR PIC 99.
02 TD-MONTH PIC 99.
02 TD-DAY PIC 99.
02 TD-HOUR PIC 99.
02 TD-MIN PIC 99.
02 FILLER PIC 99.
77 TD-MMM USAGE IS DISPLAY-7 PIC X(3).
01 WS-END-DATE-TIME.
02 WS-END-YY1 PIC 99.
02 WS-EDT.
03 WS-END-YY PIC 99.
03 WS-END-MON PIC 99.
03 WS-END-DD PIC 99.
03 WS-END-HH PIC 99.
03 WS-END-MIN PIC 99.
03 FILLER PIC XX.
77 WS-END-MMM USAGE IS DISPLAY-7 PIC X(3).
01 WS-START-DATE-TIME.
02 WS-START-YY1 PIC XX.
02 WS-SDT.
03 WS-START-YY PIC 99.
03 WS-START-MON PIC 99.
03 WS-START-DD PIC 99.
03 WS-START-HH PIC 99.
03 WS-START-MIN PIC 99.
03 FILLER PIC XX.
77 WS-START-MMM USAGE IS DISPLAY-7 PIC X(3).
01 DEFINED-ENTRIES PIC 9(4).
88 KNOWN-ENTRIES VALUES ARE 0001 THRU 0004, 0007 THRU 0009.
01 WS-CHARGE-1.
02 WS-C1-DOLLAR PIC 999.
02 WS-C1-CENTS PIC 99.
01 X REDEFINES WS-CHARGE-1.
02 WS-CHARGE PIC 999V99.
77 WS-COMMAND PIC X(15).
77 WS-REPORT PIC X(8).
77 WS-SYSTEM-NAME PIC X(39).
77 WS-SORT PIC X.
77 WS-CHARGE-CODE PIC X(6).
77 WS-DOLLAR PIC XXX.
77 WS-CENTS PIC XX.
77 WS-COMMENT PIC X(66).
77 WS-AVGPAGE PIC 9(7)V9.
77 WS-RECORDS-READ PIC 9(3).
77 WS-PAGE-NUMBER PIC 9(9).
77 WS-STRUCTURE PIC X(39).
77 WS-DIRECTORY PIC X(39).
77 WS-ACCOUNT PIC X(39).
01 WS-ALL-CHARGES.
02 WS-SESSION-CONNECT PIC 9(3)V99.
02 WS-SESSION-RUNTIME PIC 9(3)V99.
02 WS-CARDS PIC 9(3)V99.
02 WS-CARD-RUNTIME PIC 9(3)V99.
02 WS-PAGES PIC 9(3)V99.
02 WS-PAGE-RUNTIME PIC 9(3)V99.
02 WS-DISK-PAGES PIC 9(3)V99.
REPORT SECTION.
RD NAMES
CODE NAME-DETAIL
CONTROLS ARE FINAL, NAME-SORT, ACCOUNT-SORT, REMARK-SORT
PAGE LIMIT IS 120,
LAST DETAIL 58.
01 TYPE PH; LINE 1, NEXT GROUP PLUS 1 USAGE IS DISPLAY-7.
02 COLUMN 1 PIC X(9) VALUE 'Run Date:'.
02 COLUMN 12 PIC Z9 SOURCE TD-DAY.
02 COLUMN 14 PIC X VALUE '-'.
02 COLUMN 15 PIC X(3) SOURCE TD-MMM.
02 COLUMN 18 PIC X VALUE '-'.
02 COLUMN 19 PIC 99 SOURCE TD-YEAR.
02 COLUMN 22 PIC 99 SOURCE TD-HOUR.
02 COLUMN 24 PIC X VALUE ':'.
02 COLUMN 25 PIC 99 SOURCE TD-MIN.
02 COLUMN 47 PIC X(39) SOURCE WS-SYSTEM-NAME.
02 LINE PLUS 1
COLUMN 1 PIC X(4) VALUE 'User'.
02 COLUMN 6 PIC X(39) SOURCE NAME-SORT.
02 COLUMN 53 PIC X(27) VALUE 'TOPS-20 System USAGE Report'.
02 LINE PLUS 1
COLUMN 39 PIC X(19) VALUE 'USAGE Entries From:'.
02 COLUMN 59 PIC 99 SOURCE WS-START-DD.
02 COLUMN 61 PIC X VALUE '-'.
02 COLUMN 62 PIC X(3) SOURCE WS-START-MMM.
02 COLUMN 65 PIC X VALUE '-'.
02 COLUMN 66 PIC 99 SOURCE WS-START-YY.
02 COLUMN 69 PIC 99 SOURCE WS-START-HH.
02 COLUMN 71 PIC X VALUE ':'.
02 COLUMN 72 PIC 99 SOURCE WS-START-MIN.
02 COLUMN 75 PIC X(3) VALUE 'to:'.
02 COLUMN 79 PIC 99 SOURCE WS-END-DD.
02 COLUMN 81 PIC X VALUE '-'.
02 COLUMN 82 PIC X(3) SOURCE WS-END-MMM.
02 COLUMN 85 PIC X VALUE'-'.
02 COLUMN 86 PIC 99 SOURCE WS-END-YY.
02 COLUMN 89 PIC 99 SOURCE WS-END-HH.
02 COLUMN 91 PIC X VALUE ':'.
02 COLUMN 92 PIC 99 SOURCE WS-END-MIN.
02 LINE PLUS 2
COLUMN 53 PIC X(7) VALUE 'Connect'.
02 COLUMN 73 PIC X(5) VALUE 'Input'.
02 COLUMN 81 PIC X(6) VALUE 'Output'.
02 LINE PLUS 1
COLUMN 43 PIC X(5) VALUE 'Total'.
02 COLUMN 54 PIC X(4) VALUE 'Time'.
02 COLUMN 63 PIC X(7) VALUE 'Runtime'.
02 COLUMN 72 PIC X(7) VALUE 'Spooler'.
02 COLUMN 80 PIC X(7) VALUE 'Spooler'.
02 LINE PLUS 1
COLUMN 15 PIC X(7) VALUE 'Account'.
02 COLUMN 42 PIC X(6) VALUE 'Charge'.
02 COLUMN 53 PIC X(7) VALUE '(Hours)'.
02 COLUMN 64 PIC X(6) VALUE '(Sec.)'.
02 COLUMN 73 PIC X(5) VALUE 'Cards'.
02 COLUMN 81 PIC X(5) VALUE 'Pages'.
02 COLUMN 88 PIC X(6) VALUE 'Remark'.
02 LINE PLUS 1
COLUMN 15 PIC X(7) VALUE '-------'.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(7) VALUE '-------'.
02 COLUMN 80 PIC X(7) VALUE '-------'.
02 COLUMN 88 PIC X(6) VALUE '------'.
01 TYPE DETAIL.
02 PIC Z(7)9.99 SOURCE CHARGE-SORT.
02 PIC Z(6).ZZ SOURCE CONNECT-SORT BLANK WHEN ZERO.
02 PIC Z(7).Z SOURCE RUNTIME-SORT BLANK WHEN ZERO.
02 PIC Z(10) SOURCE SPOOLER-INPUT-SORT.
02 PIC Z(7) SOURCE SPOOLER-OUTPUT-SORT.
01 TYPE CF REMARK-SORT; LINE PLUS 1; USAGE IS DISPLAY-7.
02 COLUMN 1 PIC X(39) SOURCE ACCOUNT-SORT.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(6).ZZ SUM CONNECT-SORT BLANK WHEN ZERO.
02 COLUMN 62 PIC Z(7).Z SUM RUNTIME-SORT BLANK WHEN ZERO.
02 COLUMN 72 PIC Z(7) SUM SPOOLER-INPUT-SORT.
02 COLUMN 80 PIC Z(7) SUM SPOOLER-OUTPUT-SORT.
02 COLUMN 88 PIC X(39) SOURCE REMARK-SORT.
01 TYPE CF ACCOUNT-SORT; LINE PLUS 1; NEXT GROUP IS PLUS 2; USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(7) VALUE '-------'.
02 COLUMN 80 PIC X(7) VALUE '-------'.
02 LINE PLUS 1
COLUMN 1 PIC X(28) VALUE
'* * * Account Subtotal * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(6).ZZ SUM CONNECT-SORT BLANK WHEN ZERO.
02 COLUMN 62 PIC Z(7).Z SUM RUNTIME-SORT BLANK WHEN ZERO.
02 COLUMN 72 PIC Z(7) SUM SPOOLER-INPUT-SORT.
02 COLUMN 80 PIC Z(7) SUM SPOOLER-OUTPUT-SORT.
01 TYPE CF NAME-SORT LINE PLUS 1; NEXT GROUP NEXT PAGE USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '==========='.
02 COLUMN 52 PIC X(9) VALUE '========='.
02 COLUMN 62 PIC X(9) VALUE '========='.
02 COLUMN 72 PIC X(7) VALUE '======='.
02 COLUMN 80 PIC X(7) VALUE'======='.
02 LINE PLUS 1
COLUMN 1 PIC X(18) VALUE '* * * Totals * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(6).ZZ SUM CONNECT-SORT BLANK WHEN ZERO.
02 COLUMN 62 PIC Z(7).Z SUM RUNTIME-SORT BLANK WHEN ZERO.
02 COLUMN 72 PIC Z(7) SUM SPOOLER-INPUT-SORT.
02 COLUMN 80 PIC Z(7) SUM SPOOLER-OUTPUT-SORT.
02 LINE PLUS 2
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(24) VALUE '* End of Report for User'.
02 COLUMN 26 PIC X(39) SOURCE NAME-SORT.
02 LINE PLUS 1
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(6) VALUE 'Rates:'.
02 LINE PLUS 1
COLUMN 5 PIC X(22) VALUE 'Session Connect Time ='.
02 COLUMN 28 PIC $ZZZ.99 SOURCE WS-SESSION-CONNECT.
02 COLUMN 35 PIC X(6) VALUE '/Hour,'.
02 COLUMN 43 PIC X(24) VALUE 'Session Runtime ='.
02 COLUMN 68 PIC $ZZZ.99 SOURCE WS-SESSION-RUNTIME.
02 COLUMN 75 PIC X(7) VALUE '/Second'.
02 LINE PLUS 1
COLUMN 5 PIC X(22) VALUE 'Input Spooler Unit ='.
02 COLUMN 28 PIC $ZZZ.99 SOURCE WS-CARDS.
02 COLUMN 35 PIC X(6) VALUE '/Card,'.
02 COLUMN 43 PIC X(24) VALUE 'Input Spooler Runtime ='.
02 COLUMN 68 PIC $ZZZ.99 SOURCE WS-CARD-RUNTIME.
02 COLUMN 75 PIC X(7) VALUE '/Second'.
02 LINE PLUS 1
COLUMN 5 PIC X(22) VALUE 'Output Spooler Unit ='.
02 COLUMN 28 PIC $ZZZ.99 SOURCE WS-PAGES.
02 COLUMN 35 PIC X(6) VALUE '/Page,'.
02 COLUMN 43 PIC X(24) VALUE 'Output Spooler Runtime ='.
02 COLUMN 68 PIC $ZZZ.99 SOURCE WS-PAGE-RUNTIME.
02 COLUMN 75 PIC X(7) VALUE '/Second'.
RD ACCOUNTS
CODE ACCOUNT-DETAIL
CONTROLS ARE FINAL, ACCOUNT-SORT, NAME-SORT, REMARK-SORT
PAGE LIMIT IS 120,
LAST DETAIL 58.
01 TYPE PH; LINE 1, NEXT GROUP PLUS 1 USAGE IS DISPLAY-7.
02 COLUMN 1 PIC X(9) VALUE 'Run Date:'.
02 COLUMN 12 PIC Z9 SOURCE TD-DAY.
02 COLUMN 14 PIC X VALUE '-'.
02 COLUMN 15 PIC X(3) SOURCE TD-MMM.
02 COLUMN 18 PIC X VALUE '-'.
02 COLUMN 19 PIC 99 SOURCE TD-YEAR.
02 COLUMN 22 PIC 99 SOURCE TD-HOUR.
02 COLUMN 24 PIC X VALUE ':'.
02 COLUMN 25 PIC 99 SOURCE TD-MIN.
02 COLUMN 47 PIC X(39) SOURCE WS-SYSTEM-NAME.
02 LINE PLUS 1
COLUMN 1 PIC X(7) VALUE 'Account'.
02 COLUMN 9 PIC X(39) SOURCE ACCOUNT-SORT.
02 COLUMN 56 PIC X(20) VALUE 'TOPS-20 USAGE Report'.
02 LINE PLUS 1
COLUMN 39 PIC X(19) VALUE 'USAGE Entries From:'.
02 COLUMN 59 PIC 99 SOURCE WS-START-DD.
02 COLUMN 61 PIC X VALUE '-'.
02 COLUMN 62 PIC X(3) SOURCE WS-START-MMM.
02 COLUMN 65 PIC X VALUE '-'.
02 COLUMN 66 PIC 99 SOURCE WS-START-YY.
02 COLUMN 69 PIC 99 SOURCE WS-START-HH.
02 COLUMN 71 PIC X VALUE ':'.
02 COLUMN 72 PIC 99 SOURCE WS-START-MIN.
02 COLUMN 75 PIC X(3) VALUE 'to:'.
02 COLUMN 79 PIC 99 SOURCE WS-END-DD.
02 COLUMN 81 PIC X VALUE '-'.
02 COLUMN 82 PIC X(3) SOURCE WS-END-MMM.
02 COLUMN 85 PIC X VALUE'-'.
02 COLUMN 86 PIC 99 SOURCE WS-END-YY.
02 COLUMN 89 PIC 99 SOURCE WS-END-HH.
02 COLUMN 91 PIC X VALUE ':'.
02 COLUMN 92 PIC 99 SOURCE WS-END-MIN.
02 LINE PLUS 2
COLUMN 53 PIC X(7) VALUE 'Connect'.
02 COLUMN 73 PIC X(5) VALUE 'Input'.
02 COLUMN 81 PIC X(6) VALUE 'Output'.
02 LINE PLUS 1
COLUMN 43 PIC X(5) VALUE 'Total'.
02 COLUMN 54 PIC X(4) VALUE 'Time'.
02 COLUMN 63 PIC X(7) VALUE 'Runtime'.
02 COLUMN 72 PIC X(7) VALUE 'Spooler'.
02 COLUMN 80 PIC X(7) VALUE 'Spooler'.
02 LINE PLUS 1
COLUMN 17 PIC X(4) VALUE 'Name'.
02 COLUMN 42 PIC X(6) VALUE 'Charge'.
02 COLUMN 53 PIC X(7) VALUE '(Hours)'.
02 COLUMN 64 PIC X(6) VALUE '(Sec.)'.
02 COLUMN 73 PIC X(5) VALUE 'Units'.
02 COLUMN 81 PIC X(5) VALUE 'Units'.
02 COLUMN 88 PIC X(6) VALUE 'Remark'.
02 LINE PLUS 1
COLUMN 17 PIC X(4) VALUE '----'.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(7) VALUE '-------'.
02 COLUMN 80 PIC X(7) VALUE '-------'.
02 COLUMN 88 PIC X(6) VALUE '------'.
01 TYPE DETAIL.
02 PIC Z(7)9.99 SOURCE CHARGE-SORT.
02 PIC Z(6).ZZ SOURCE CONNECT-SORT BLANK WHEN ZERO.
02 PIC Z(7).Z SOURCE RUNTIME-SORT BLANK WHEN ZERO.
02 PIC Z(10) SOURCE SPOOLER-INPUT-SORT.
02 PIC Z(7) SOURCE SPOOLER-OUTPUT-SORT.
01 TYPE CF REMARK-SORT; LINE PLUS 1.
02 COLUMN 1 PIC X(39) SOURCE NAME-SORT.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(6).ZZ SUM CONNECT-SORT BLANK WHEN ZERO.
02 COLUMN 62 PIC Z(7).Z SUM RUNTIME-SORT BLANK WHEN ZERO.
02 COLUMN 72 PIC Z(7) SUM SPOOLER-INPUT-SORT.
02 COLUMN 80 PIC Z(7) SUM SPOOLER-OUTPUT-SORT.
02 COLUMN 88 PIC X(39) SOURCE REMARK-SORT.
01 TYPE CF NAME-SORT; LINE PLUS 1; NEXT GROUP IS PLUS 2; USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(7) VALUE '-------'.
02 COLUMN 80 PIC X(7) VALUE '-------'.
02 LINE PLUS 1
COLUMN 1 PIC X(25) VALUE
'* * * User Subtotal * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(6).ZZ SUM CONNECT-SORT BLANK WHEN ZERO.
02 COLUMN 62 PIC Z(7).Z SUM RUNTIME-SORT BLANK WHEN ZERO.
02 COLUMN 72 PIC Z(7) SUM SPOOLER-INPUT-SORT.
02 COLUMN 80 PIC Z(7) SUM SPOOLER-OUTPUT-SORT.
01 TYPE CF ACCOUNT-SORT LINE PLUS 1; NEXT GROUP NEXT PAGE USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '==========='.
02 COLUMN 52 PIC X(9) VALUE '========='.
02 COLUMN 62 PIC X(9) VALUE '========='.
02 COLUMN 72 PIC X(7) VALUE '======='.
02 COLUMN 80 PIC X(7) VALUE'======='.
02 LINE PLUS 1
COLUMN 1 PIC X(18) VALUE '* * * Totals * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(6).ZZ SUM CONNECT-SORT BLANK WHEN ZERO.
02 COLUMN 62 PIC Z(7).Z SUM RUNTIME-SORT BLANK WHEN ZERO.
02 COLUMN 72 PIC Z(7) SUM SPOOLER-INPUT-SORT.
02 COLUMN 80 PIC Z(7) SUM SPOOLER-OUTPUT-SORT.
02 LINE PLUS 2
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(27) VALUE '* End of Report for Account'.
02 COLUMN 29 PIC X(39) SOURCE ACCOUNT-SORT.
02 LINE PLUS 1
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(6) VALUE 'Rates:'.
02 LINE PLUS 1
COLUMN 5 PIC X(22) VALUE 'Session Connect Time ='.
02 COLUMN 28 PIC $ZZZ.99 SOURCE WS-SESSION-CONNECT.
02 COLUMN 35 PIC X(6) VALUE '/Hour,'.
02 COLUMN 43 PIC X(24) VALUE 'Session Runtime ='.
02 COLUMN 68 PIC $ZZZ.99 SOURCE WS-SESSION-RUNTIME.
02 COLUMN 75 PIC X(7) VALUE '/Second'.
02 LINE PLUS 1
COLUMN 5 PIC X(22) VALUE 'Input Spooler Unit ='.
02 COLUMN 28 PIC $ZZZ.99 SOURCE WS-CARDS.
02 COLUMN 35 PIC X(6) VALUE '/Card,'.
02 COLUMN 43 PIC X(24) VALUE 'Input Spooler Runtime ='.
02 COLUMN 68 PIC $ZZZ.99 SOURCE WS-CARD-RUNTIME.
02 COLUMN 75 PIC X(7) VALUE '/Second'.
02 LINE PLUS 1
COLUMN 5 PIC X(22) VALUE 'Output Spooler Unit ='.
02 COLUMN 28 PIC $ZZZ.99 SOURCE WS-PAGES.
02 COLUMN 35 PIC X(6) VALUE '/Page,'.
02 COLUMN 43 PIC X(24) VALUE 'Output Spooler Runtime ='.
02 COLUMN 68 PIC $ZZZ.99 SOURCE WS-PAGE-RUNTIME.
02 COLUMN 75 PIC X(7) VALUE '/Second'.
RD DNAMES
CODE DISK-NAME-DETAIL
CONTROLS ARE FINAL, DIRECTORY-SORT, ACCOUNT-SORT, STRUCTURE-SORT
PAGE LIMIT IS 120,
LAST DETAIL 58.
01 TYPE PH; LINE 1, NEXT GROUP PLUS 1 USAGE IS DISPLAY-7.
02 COLUMN 1 PIC X(9) VALUE 'Run Date:'.
02 COLUMN 12 PIC Z9 SOURCE TD-DAY.
02 COLUMN 14 PIC X VALUE '-'.
02 COLUMN 15 PIC X(3) SOURCE TD-MMM.
02 COLUMN 18 PIC X VALUE '-'.
02 COLUMN 19 PIC 99 SOURCE TD-YEAR.
02 COLUMN 22 PIC 99 SOURCE TD-HOUR.
02 COLUMN 24 PIC X VALUE ':'.
02 COLUMN 25 PIC 99 SOURCE TD-MIN.
02 COLUMN 47 PIC X(39) SOURCE WS-SYSTEM-NAME.
02 LINE PLUS 1
COLUMN 1 PIC X(9) VALUE 'Directory'.
02 COLUMN 11 PIC X(39) SOURCE DIRECTORY-SORT.
02 COLUMN 54 PIC X(30) VALUE 'TOPS-20 Directory USAGE Report'.
02 LINE PLUS 1
COLUMN 48 PIC X(16) VALUE 'USAGE Entries on'.
02 COLUMN 66 PIC 99 SOURCE WS-START-DD.
02 COLUMN 68 PIC X VALUE '-'.
02 COLUMN 69 PIC X(3) SOURCE WS-START-MMM.
02 COLUMN 72 PIC X VALUE '-'.
02 COLUMN 73 PIC 99 SOURCE WS-START-YY.
02 COLUMN 76 PIC 99 SOURCE WS-START-HH.
02 COLUMN 78 PIC X VALUE ':'.
02 COLUMN 79 PIC 99 SOURCE WS-START-MIN.
02 LINE PLUS 2
COLUMN 43 PIC X(5) VALUE 'Total'.
02 COLUMN 54 PIC X(4) VALUE 'Disk'.
02 COLUMN 63 PIC X(6) VALUE 'Number'.
02 COLUMN 72 PIC X(8) VALUE 'Avg. No.'.
02 COLUMN 82 PIC X(9) VALUE 'Structure'.
02 LINE PLUS 1
COLUMN 15 PIC X(7) VALUE 'Account'.
02 COLUMN 42 PIC X(6) VALUE 'Charge'.
02 COLUMN 54 PIC X(5) VALUE 'Pages'.
02 COLUMN 62 PIC X(8) VALUE 'of Files'.
02 COLUMN 72 PIC X(8) VALUE 'of Pages'.
02 COLUMN 84 PIC X(4) VALUE 'Name'.
02 LINE PLUS 1
COLUMN 15 PIC X(7) VALUE '-------'.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(9) VALUE '---------'.
02 COLUMN 82 PIC X(9) VALUE '---------'.
01 TYPE DETAIL.
02 PIC $Z(7)9.99 SOURCE CHARGE-SORT.
02 PIC Z(9) SOURCE DISK-PAGE-SORT.
02 PIC Z(9) SOURCE FILE-SORT.
01 TYPE CF STRUCTURE-SORT; LINE PLUS 1.
02 COLUMN 1 PIC X(39) SOURCE ACCOUNT-SORT.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(9) SUM DISK-PAGE-SORT.
02 COLUMN 62 PIC Z(9) SUM FILE-SORT.
02 COLUMN 72 PIC Z(7).Z SOURCE WS-AVGPAGE BLANK WHEN ZERO.
02 COLUMN 82 PIC X(7) SOURCE STRUCTURE-SORT.
01 TYPE CF ACCOUNT-SORT; LINE PLUS 1; NEXT GROUP IS PLUS 2; USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(9) VALUE '---------'.
02 LINE PLUS 1
COLUMN 1 PIC X(28) VALUE
'* * * Account Subtotal * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(9) SUM DISK-PAGE-SORT.
02 COLUMN 62 PIC Z(9) SUM FILE-SORT.
02 COLUMN 72 PIC Z(7).Z SUM WS-AVGPAGE BLANK WHEN ZERO.
01 TYPE CF DIRECTORY-SORT LINE PLUS 1; NEXT GROUP NEXT PAGE USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '==========='.
02 COLUMN 52 PIC X(9) VALUE '========='.
02 COLUMN 62 PIC X(9) VALUE '========='.
02 COLUMN 72 PIC X(9) VALUE '========='.
02 LINE PLUS 1
COLUMN 1 PIC X(18) VALUE '* * * Totals * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(9) SUM DISK-PAGE-SORT.
02 COLUMN 62 PIC Z(9) SUM FILE-SORT.
02 COLUMN 72 PIC Z(7).Z SUM WS-AVGPAGE BLANK WHEN ZERO.
02 LINE PLUS 2
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(29) VALUE '* End of Report for Directory'.
02 COLUMN 31 PIC X(39) SOURCE DIRECTORY-SORT.
02 LINE PLUS 1
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(6) VALUE 'Rates:'.
02 LINE PLUS 1
COLUMN 5 PIC X(12) VALUE 'Disk Usage ='.
02 COLUMN 18 PIC $$$.99 SOURCE WS-DISK-PAGES.
02 COLUMN 24 PIC X(5) VALUE '/Page'.
RD DACCOUNTS
CODE DISK-ACCOUNT-DETAIL
CONTROLS ARE FINAL, ACCOUNT-SORT, DIRECTORY-SORT, STRUCTURE-SORT
PAGE LIMIT IS 120,
LAST DETAIL 58.
01 TYPE PH; LINE 1, NEXT GROUP PLUS 1 USAGE IS DISPLAY-7.
02 COLUMN 1 PIC X(9) VALUE 'Run Date:'.
02 COLUMN 12 PIC Z9 SOURCE TD-DAY.
02 COLUMN 14 PIC X VALUE '-'.
02 COLUMN 15 PIC X(3) SOURCE TD-MMM.
02 COLUMN 18 PIC X VALUE '-'.
02 COLUMN 19 PIC 99 SOURCE TD-YEAR.
02 COLUMN 22 PIC 99 SOURCE TD-HOUR.
02 COLUMN 24 PIC X VALUE ':'.
02 COLUMN 25 PIC 99 SOURCE TD-MIN.
02 COLUMN 47 PIC X(39) SOURCE WS-SYSTEM-NAME.
02 LINE PLUS 1
COLUMN 1 PIC X(7) VALUE 'Account'.
02 COLUMN 9 PIC X(39) SOURCE ACCOUNT-SORT.
02 COLUMN 54 PIC X(30) VALUE 'TOPS-20 Directory USAGE Report'.
02 LINE PLUS 1
COLUMN 48 PIC X(16) VALUE 'USAGE Entries on'.
02 COLUMN 66 PIC 99 SOURCE WS-START-DD.
02 COLUMN 68 PIC X VALUE '-'.
02 COLUMN 69 PIC X(3) SOURCE WS-START-MMM.
02 COLUMN 72 PIC X VALUE '-'.
02 COLUMN 73 PIC 99 SOURCE WS-START-YY.
02 COLUMN 76 PIC 99 SOURCE WS-START-HH.
02 COLUMN 78 PIC X VALUE ':'.
02 COLUMN 79 PIC 99 SOURCE WS-START-MIN.
02 LINE PLUS 2
COLUMN 43 PIC X(5) VALUE 'Total'.
02 COLUMN 54 PIC X(4) VALUE 'Disk'.
02 COLUMN 63 PIC X(6) VALUE 'Number'.
02 COLUMN 72 PIC X(8) VALUE 'Avg. No.'.
02 COLUMN 82 PIC X(9) VALUE 'Structure'.
02 LINE PLUS 1
COLUMN 12 PIC X(9) VALUE 'Directory'.
02 COLUMN 42 PIC X(6) VALUE 'Charge'.
02 COLUMN 54 PIC X(5) VALUE 'Pages'.
02 COLUMN 62 PIC X(8) VALUE 'of Files'.
02 COLUMN 72 PIC X(8) VALUE 'of Pages'.
02 COLUMN 84 PIC X(4) VALUE 'Name'.
02 LINE PLUS 1
COLUMN 12 PIC X(9) VALUE '---------'.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(9) VALUE '---------'.
02 COLUMN 82 PIC X(9) VALUE '---------'.
01 TYPE DETAIL.
02 PIC $Z(7)9.99 SOURCE CHARGE-SORT.
02 PIC Z(9) SOURCE DISK-PAGE-SORT.
02 PIC Z(9) SOURCE FILE-SORT.
01 TYPE CF STRUCTURE-SORT; LINE PLUS 1.
02 COLUMN 1 PIC X(39) SOURCE DIRECTORY-SORT.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(9) SUM DISK-PAGE-SORT.
02 COLUMN 62 PIC Z(9) SUM FILE-SORT.
02 column 72 pic z(7).z source ws-avgPAGE blank when zero.
02 COLUMN 82 PIC X(7) SOURCE STRUCTURE-SORT.
01 TYPE CF DIRECTORY-SORT; LINE PLUS 1; NEXT GROUP IS PLUS 2; USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '-----------'.
02 COLUMN 52 PIC X(9) VALUE '---------'.
02 COLUMN 62 PIC X(9) VALUE '---------'.
02 COLUMN 72 PIC X(9) VALUE '---------'.
02 LINE PLUS 1
COLUMN 1 PIC X(30) VALUE
'* * * Directory Subtotal * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(9) SUM DISK-PAGE-SORT.
02 COLUMN 62 PIC Z(9) SUM FILE-SORT.
02 column 72 pic z(7).z sum ws-avgPAGE blank when zero.
01 TYPE CF ACCOUNT-SORT LINE PLUS 1; NEXT GROUP NEXT PAGE USAGE IS DISPLAY-7.
02 COLUMN 40 PIC X(11) VALUE '==========='.
02 COLUMN 52 PIC X(9) VALUE '========='.
02 COLUMN 62 PIC X(9) VALUE '========='.
02 COLUMN 72 PIC X(9) VALUE '========='.
02 LINE PLUS 1
COLUMN 1 PIC X(18) VALUE '* * * Totals * * *'.
02 COLUMN 39 PIC $Z(7)9.99 SUM CHARGE-SORT.
02 COLUMN 52 PIC Z(9) SUM DISK-PAGE-SORT.
02 COLUMN 62 PIC Z(9) SUM FILE-SORT.
02 column 72 pic z(7).z sum ws-avgPAGE blank when zero.
02 LINE PLUS 2
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(27) VALUE '* End of Report for Account'.
02 COLUMN 31 PIC X(39) SOURCE ACCOUNT-SORT.
02 LINE PLUS 1
COLUMN 1 PIC X(30) VALUE '******************************'.
02 LINE PLUS 1
COLUMN 1 PIC X(6) VALUE 'Rates:'.
02 LINE PLUS 1
COLUMN 5 PIC X(12) VALUE 'Disk Usage ='.
02 COLUMN 18 PIC $$$.99 SOURCE WS-DISK-PAGES.
02 COLUMN 24 PIC X(5) VALUE '/Page'.
PROCEDURE DIVISION.
DISPLAY 'TOPS20 ACCOUNTING SYSTEM'.
PERFORM GET-CHARGES THRU GET-CHARGES-EXIT.
MAIN-LOOP.
MOVE 19 TO WS-END-YY1, WS-START-YY1.
MOVE TODAY TO THIS-DATE, WS-SDT.
MOVE ZEROES TO WS-EDT.
MOVE LETTER-MONTH (TD-MONTH) TO TD-MMM.
PERFORM ASK-FOR-INPUT-FILE.
PERFORM ASK-FOR-REPORT.
PERFORM ASK-FOR-SORT.
PERFORM ASK-FOR-OUTPUT-FILE.
PERFORM PROCESS-REPORT.
GO TO MAIN-LOOP.
************
GET-CHARGES.
OPEN INPUT CHARGE-FILE.
MOVE ZEROES TO WS-ALL-CHARGES.
GET-CHARGES-1.
READ CHARGE-FILE AT END CLOSE CHARGE-FILE
GO TO GET-CHARGES-EXIT.
UNSTRING CHARGE-RECORD DELIMITED BY SPACE OR '.' OR '/' OR ALL SPACES
INTO WS-CHARGE-CODE, WS-DOLLAR, WS-CENTS, WS-COMMENT.
MOVE WS-DOLLAR TO WS-C1-DOLLAR.
MOVE WS-CENTS TO WS-C1-CENTS.
IF WS-CHARGE-CODE = 'SESCON'
MOVE WS-CHARGE TO WS-SESSION-CONNECT
ELSE IF WS-CHARGE-CODE = 'SESRUN'
MOVE WS-CHARGE TO WS-SESSION-RUNTIME
ELSE IF WS-CHARGE-CODE = 'PAGRUN'
MOVE WS-CHARGE TO WS-PAGE-RUNTIME
ELSE IF WS-CHARGE-CODE = 'PAGPAG'
MOVE WS-CHARGE TO WS-PAGES
ELSE IF WS-CHARGE-CODE = 'CRDCRD'
MOVE WS-CHARGE TO WS-CARDS
ELSE IF WS-CHARGE-CODE = 'CRDRUN'
MOVE WS-CHARGE TO WS-CARD-RUNTIME
ELSE IF WS-CHARGE-CODE = 'DSKPAG'
MOVE WS-CHARGE TO WS-DISK-PAGES.
GO TO GET-CHARGES-1.
GET-CHARGES-EXIT.
EXIT.
ASK-FOR-INPUT-FILE.
DISPLAY 'Read USAGE file: ' WITH NO ADVANCING.
ACCEPT WS-COMMAND.
IF WS-COMMAND = '?' PERFORM DISPLAY-HELP-INPUT
GO TO ASK-FOR-INPUT-FILE
ELSE IF WS-COMMAND = 'EXIT' STOP RUN
ELSE IF WS-COMMAND = SPACES MOVE 'USAGE OUT' TO IN-FILE-NAME-EXT
ELSE UNSTRING WS-COMMAND DELIMITED BY '.' OR ALL ' ' INTO IN-FILE-NAME,
IN-FILE-EXT ON OVERFLOW DISPLAY ' Input file error: ', WS-COMMAND
GO TO ASK-FOR-INPUT-FILE.
DISPLAY ' Input file name: ' IN-FILE-NAME, '.', IN-FILE-EXT.
ASK-FOR-REPORT.
DISPLAY 'Report by [System usage (S) or Disk usage (D)]: ' WITH NO ADVANCING.
ACCEPT WS-COMMAND.
IF WS-COMMAND = '?' PERFORM DISPLAY-HELP-REPORT
GO TO ASK-FOR-REPORT
ELSE IF WS-COMMAND = SPACES MOVE 'S' TO WS-REPORT
ELSE IF WS-COMMAND = 'EXIT' STOP RUN
ELSE MOVE WS-COMMAND TO WS-REPORT.
ASK-FOR-SORT.
DISPLAY 'Sort by [Name (N) or Account (A)]: ' WITH NO ADVANCING.
ACCEPT WS-COMMAND.
IF WS-COMMAND = '?' PERFORM DISPLAY-HELP-SORT
GO TO ASK-FOR-SORT
ELSE IF WS-COMMAND = SPACES MOVE 'N' TO WS-SORT
ELSE IF WS-COMMAND = 'EXIT' STOP RUN
ELSE MOVE WS-COMMAND TO WS-SORT.
ASK-FOR-OUTPUT-FILE.
DISPLAY 'Write to file: ' WITH NO ADVANCING.
ACCEPT WS-COMMAND.
IF WS-COMMAND = '?' PERFORM DISPLAY-HELP-OUTPUT
GO TO ASK-FOR-OUTPUT-FILE
ELSE IF WS-COMMAND = SPACES MOVE 'USAGE RPT' TO OUT-FILE-NAME-EXT
ELSE IF WS-COMMAND = 'EXIT' STOP RUN
ELSE UNSTRING WS-COMMAND DELIMITED BY '.' OR ALL ' ' INTO OUT-FILE-NAME,
OUT-FILE-EXT ON OVERFLOW DISPLAY 'Output file error: ', WS-COMMAND
GO TO ASK-FOR-OUTPUT-FILE.
DISPLAY ' Output file name: ', OUT-FILE-NAME, '.', OUT-FILE-EXT.
PROCESS-REPORT.
IF WS-REPORT = 'S' AND WS-SORT = 'N' PERFORM REPORT-BY-SYSTEM-USAGE-NAME
ELSE IF WS-REPORT = 'S' AND WS-SORT = 'A'
PERFORM REPORT-BY-SYSTEM-USAGE-ACCOUNT
ELSE IF WS-REPORT = 'D' AND WS-SORT = 'N'
PERFORM REPORT-BY-DISK-NAME
ELSE IF WS-REPORT = 'D' AND WS-SORT = 'A'
PERFORM REPORT-BY-DISK-ACCOUNT.
**********************************************************************
* REPORT BY SYSTEM USAGE SORTED ON NAME SUBROUTINE SECTION
**********************************************************************
REPORT-BY-SYSTEM-USAGE-NAME.
SORT SORT-USAGE
ASCENDING KEY NAME-SORT, ACCOUNT-SORT, REMARK-SORT
INPUT PROCEDURE IS REPORT-BY-SYSTEM-NAME-IN THRU REPORT-BY-SYSTEM-NAME-IN-EXIT
OUTPUT PROCEDURE IS REPORT-BY-SYSTEM-NAME-OUT THRU REPORT-BY-SYSTEM-NAME-OUT-EXIT.
***********
REPORT-BY-SYSTEM-NAME-IN.
OPEN INPUT IN-FILE.
RBNI-1.
READ IN-FILE AT END CLOSE IN-FILE GO TO REPORT-BY-SYSTEM-NAME-IN-EXIT.
MOVE ENTRY-TYPE TO DEFINED-ENTRIES.
IF KNOWN-ENTRIES
PERFORM MAKE-SYSTEM-SORT-RECORD.
GO TO RBNI-1.
REPORT-BY-SYSTEM-NAME-IN-EXIT.
EXIT.
**********
REPORT-BY-SYSTEM-NAME-OUT.
OPEN OUTPUT OUT-FILE.
INITIATE NAMES.
MOVE LETTER-MONTH (WS-START-MON) TO WS-START-MMM.
MOVE LETTER-MONTH (WS-END-MON) TO WS-END-MMM.
RBNO-1.
RETURN SORT-USAGE AT END TERMINATE NAMES
CLOSE OUT-FILE
GO TO REPORT-BY-SYSTEM-NAME-OUT-EXIT.
GENERATE NAMES.
GO TO RBNO-1.
REPORT-BY-SYSTEM-NAME-OUT-EXIT.
EXIT.
**********************************************************************
* END OF REPORT BY SYSTEM USAGE SORTED ON NAME SUBROUTINE SECTION
**********************************************************************
**********************************************************************
* REPORT BY SYSTEM USAGE SORTED ON ACCOUNT SUBROUTINE SECTION
**********************************************************************
REPORT-BY-SYSTEM-USAGE-ACCOUNT.
SORT SORT-USAGE
ASCENDING KEY ACCOUNT-SORT, NAME-SORT, REMARK-SORT
INPUT PROCEDURE IS REPORT-BY-SACCOUNT-IN THRU
REPORT-BY-SACCOUNT-IN-EXIT
OUTPUT PROCEDURE IS REPORT-BY-SACCOUNT-OUT THRU
REPORT-BY-SACCOUNT-OUT-EXIT.
***********
REPORT-BY-SACCOUNT-IN.
OPEN INPUT IN-FILE.
RBAI-1.
READ IN-FILE AT END CLOSE IN-FILE GO TO REPORT-BY-SACCOUNT-IN-EXIT.
MOVE ENTRY-TYPE TO DEFINED-ENTRIES.
IF KNOWN-ENTRIES PERFORM MAKE-SYSTEM-SORT-RECORD.
GO TO RBAI-1.
REPORT-BY-SACCOUNT-IN-EXIT.
EXIT.
************
REPORT-BY-SACCOUNT-OUT.
OPEN OUTPUT OUT-FILE.
INITIATE ACCOUNTS.
MOVE LETTER-MONTH (WS-START-MON) TO WS-START-MMM.
MOVE LETTER-MONTH (WS-END-MON) TO WS-END-MMM.
RBAO-1.
RETURN SORT-USAGE AT END TERMINATE ACCOUNTS
CLOSE OUT-FILE
GO TO REPORT-BY-SACCOUNT-OUT-EXIT.
GENERATE ACCOUNTS.
GO TO RBAO-1.
REPORT-BY-SACCOUNT-OUT-EXIT.
EXIT.
**********************************************************************
* END OF REPORT BY SYSTEM USAGE SORTED ON ACCOUNT SUBROUTINE SECTION
**********************************************************************
**********************************************************************
* COMMON SUBROUTINES USED BY REPORTS OF SYSTEM USAGE
**********************************************************************
MAKE-SYSTEM-SORT-RECORD.
MOVE SPACES TO SYSTEM-SORT-RECORD.
IF ENTRY-TYPE = '0002' OR '0003' PERFORM PROCESS-SESSION-ENTRY
THRU PROCESS-SESSION-ENTRY-EXIT
ELSE IF ENTRY-TYPE = '0008' PERFORM PROCESS-OUTPUT-SPOOLER
THRU PROCESS-OUTPUT-SPOOLER-EXIT
ELSE IF ENTRY-TYPE = '0007' PERFORM PROCESS-INPUT-SPOOLER
THRU PROCESS-INPUT-SPOOLER-EXIT
ELSE IF ENTRY-TYPE = '0004' OR '0001' PERFORM PROCESS-HEADER-ENTRY
THRU PROCESS-HEADER-ENTRY-EXIT.
************
PROCESS-SESSION-ENTRY.
IF REC-SEQUENCE-NUMBER = '1' AND ENTRY-TYPE = '0002' OR '0003'
PERFORM CHECK-RANGE-DATE-TIME
READ IN-FILE
AT END CLOSE IN-FILE GO TO PROCESS-SESSION-ENTRY-EXIT.
IF REC-SEQUENCE-NUMBER = '2' AND ENTRY-TYPE = '0002' OR '0003'
MOVE SR1-ACCOUNT-STRING TO ACCOUNT-SORT
MOVE SR1-SESSION-REMARK TO REMARK-SORT
COMPUTE RUNTIME-SORT ROUNDED = SR1-RUNTIME / 1000
COMPUTE CONNECT-SORT ROUNDED = SR1-CONSOLE-CONNECT-TIME /3600
PERFORM COMPUTE-SESSION-CHARGES
READ IN-FILE AT END CLOSE IN-FILE GO TO PROCESS-SESSION-ENTRY-EXIT.
IF REC-SEQUENCE-NUMBER = '3' AND ENTRY-TYPE = '0002' OR '0003'
MOVE T20-USER-NAME TO NAME-SORT
ELSE DISPLAY 'Incomplete Session entry'.
IF ACCOUNT-SORT = SPACES
MOVE ' Unspecified Account' TO ACCOUNT-SORT.
RELEASE SYSTEM-SORT-RECORD.
PROCESS-SESSION-ENTRY-EXIT.
EXIT.
CHECK-RANGE-DATE-TIME.
IF WS-END-DATE-TIME < EHR-DATE-TIME
MOVE EHR-DATE-TIME TO WS-END-DATE-TIME.
IF WS-START-DATE-TIME > EHR-DATE-TIME
MOVE EHR-DATE-TIME TO WS-START-DATE-TIME.
COMPUTE-SESSION-CHARGES.
COMPUTE CHARGE-SORT ROUNDED = CHARGE-SORT + RUNTIME-SORT * WS-SESSION-RUNTIME.
COMPUTE CHARGE-SORT ROUNDED = CHARGE-SORT + CONNECT-SORT * WS-SESSION-CONNECT.
***********
***********
PROCESS-HEADER-ENTRY.
IF REC-SEQUENCE-NUMBER = '1' AND ENTRY-TYPE = '0004' OR '0001'
PERFORM CHECK-RANGE-DATE-TIME
READ IN-FILE AT END
CLOSE IN-FILE GO TO PROCESS-HEADER-ENTRY-EXIT.
IF REC-SEQUENCE-NUMBER = '2' AND ENTRY-TYPE = '0004' OR '0001'
MOVE RR-SYSTEM-NAME TO WS-SYSTEM-NAME.
PROCESS-HEADER-ENTRY-EXIT.
EXIT.
************
PROCESS-OUTPUT-SPOOLER.
IF REC-SEQUENCE-NUMBER = '1' AND ENTRY-TYPE = '0008'
PERFORM CHECK-RANGE-DATE-TIME
READ IN-FILE
AT END CLOSE IN-FILE GO TO PROCESS-OUTPUT-SPOOLER-EXIT.
IF REC-SEQUENCE-NUMBER = '2' AND ENTRY-TYPE = '0008'
MOVE OSR-ACCOUNT-STRING TO ACCOUNT-SORT
COMPUTE RUNTIME-SORT ROUNDED = OSR-RUNTIME / 1000
MOVE OSR-OUTPUT-UNITS TO SPOOLER-OUTPUT-SORT
PERFORM COMPUTE-OUTPUT-SPOOLER-CHARGES
MOVE 'Output Spooler Charges' TO REMARK-SORT
READ IN-FILE AT END CLOSE IN-FILE GO TO PROCESS-OUTPUT-SPOOLER-EXIT.
IF REC-SEQUENCE-NUMBER = '3' AND ENTRY-TYPE = '0008'
MOVE T20-USER-NAME TO NAME-SORT
ELSE DISPLAY 'Incomplete output spooler entry'.
IF ACCOUNT-SORT = SPACES
MOVE ' Unspecified Account' TO ACCOUNT-SORT.
RELEASE SYSTEM-SORT-RECORD.
PROCESS-OUTPUT-SPOOLER-EXIT.
EXIT.
COMPUTE-OUTPUT-SPOOLER-CHARGES.
COMPUTE CHARGE-SORT = CHARGE-SORT + SPOOLER-OUTPUT-SORT * WS-PAGES.
COMPUTE CHARGE-SORT ROUNDED = CHARGE-SORT + RUNTIME-SORT * WS-PAGE-RUNTIME.
************
************
PROCESS-INPUT-SPOOLER.
IF REC-SEQUENCE-NUMBER = '1' AND ENTRY-TYPE = '0007'
PERFORM CHECK-RANGE-DATE-TIME
READ IN-FILE
AT END CLOSE IN-FILE GO TO PROCESS-INPUT-SPOOLER-EXIT.
IF REC-SEQUENCE-NUMBER = '2' AND ENTRY-TYPE = '0007'
MOVE ISR-ACCOUNT-STRING TO ACCOUNT-SORT
COMPUTE RUNTIME-SORT ROUNDED = ISR-RUNTIME / 1000
MOVE ISR-CARDS-READ TO SPOOLER-INPUT-SORT
MOVE 'Input Spooler Charges' TO REMARK-SORT
PERFORM COMPUTE-INPUT-SPOOLER-CHARGES
READ IN-FILE AT END CLOSE IN-FILE GO TO PROCESS-INPUT-SPOOLER-EXIT.
IF REC-SEQUENCE-NUMBER = '3' AND ENTRY-TYPE = '0007'
MOVE T20-USER-NAME TO NAME-SORT
ELSE DISPLAY 'Incomplete input spooler entry'.
IF ACCOUNT-SORT = SPACES
MOVE ' Unspecified Account' TO ACCOUNT-SORT.
RELEASE SYSTEM-SORT-RECORD.
PROCESS-INPUT-SPOOLER-EXIT.
EXIT.
COMPUTE-INPUT-SPOOLER-CHARGES.
COMPUTE CHARGE-SORT = CHARGE-SORT + SPOOLER-INPUT-SORT * WS-CARDS.
COMPUTE CHARGE-SORT ROUNDED = CHARGE-SORT + RUNTIME-SORT * WS-CARD-RUNTIME.
**********************************************************************
* END OF COMMON SUBROUTINES USED BY REPORTS OF SYSTEM USAGE
**********************************************************************
**********************************************************************
* REPORT BY DISK USAGE SORTED ON DIRECTORY SUBROUTINE SECTION
**********************************************************************
REPORT-BY-DISK-NAME.
SORT SORT-USAGE
ASCENDING KEY DIRECTORY-SORT, ACCOUNT-SORT, STRUCTURE-SORT
INPUT PROCEDURE IS REPORT-BY-DISK-NAME-IN THRU
REPORT-BY-DISK-NAME-IN-EXIT
OUTPUT PROCEDURE IS REPORT-BY-DISK-NAME-OUT THRU
REPORT-BY-DISK-NAME-OUT-EXIT.
*************
REPORT-BY-DISK-NAME-IN.
OPEN INPUT IN-FILE.
RBDNI-1.
READ IN-FILE AT END CLOSE IN-FILE
GO TO REPORT-BY-DISK-NAME-IN-EXIT.
IF ENTRY-TYPE = '0009'
PERFORM MAKE-DISK-SORT-RECORD
ELSE IF ENTRY-TYPE = '0001' OR '0004'
PERFORM PROCESS-HEADER-ENTRY THRU PROCESS-HEADER-ENTRY-EXIT.
GO TO RBDNI-1.
REPORT-BY-DISK-NAME-IN-EXIT.
EXIT.
************
REPORT-BY-DISK-NAME-OUT.
OPEN OUTPUT OUT-FILE.
INITIATE DNAMES.
MOVE LETTER-MONTH (WS-START-MON) TO WS-START-MMM.
MOVE SPACES TO WS-STRUCTURE, WS-DIRECTORY, WS-ACCOUNT.
MOVE ZEROES TO WS-AVGPAGE, WS-PAGE-NUMBER, WS-RECORDS-READ.
RBDNO-1.
RETURN SORT-USAGE AT END TERMINATE DNAMES
CLOSE OUT-FILE
GO TO REPORT-BY-DISK-NAME-OUT-EXIT.
PERFORM GET-FILE-AVERAGE.
GENERATE DNAMES.
GO TO RBDNO-1.
REPORT-BY-DISK-NAME-OUT-EXIT.
EXIT.
**********************************************************************
* END OF REPORT BY DISK USAGE SORTED ON NAME SUBROUTINE SECTION
**********************************************************************
********************************************************************
* REPORT BY DISK USAGE SORTED ON ACCOUNT SUBROUTINE SECTION
**********************************************************************
REPORT-BY-DISK-ACCOUNT.
SORT SORT-USAGE
ASCENDING KEY ACCOUNT-SORT, DIRECTORY-SORT, STRUCTURE-SORT
INPUT PROCEDURE IS REPORT-BY-DACCOUNT-IN THRU
REPORT-BY-DACCOUNT-IN-EXIT
OUTPUT PROCEDURE IS REPORT-BY-DACCOUNT-OUT THRU
REPORT-BY-DACCOUNT-OUT-EXIT.
*************
REPORT-BY-DACCOUNT-IN.
OPEN INPUT IN-FILE.
RBDAI-1.
READ IN-FILE AT END CLOSE IN-FILE
GO TO REPORT-BY-DACCOUNT-IN-EXIT.
IF ENTRY-TYPE = '0009'
PERFORM MAKE-DISK-SORT-RECORD
ELSE IF ENTRY-TYPE = '0001' OR '0004'
PERFORM PROCESS-HEADER-ENTRY THRU PROCESS-HEADER-ENTRY-EXIT.
GO TO RBDAI-1.
REPORT-BY-DACCOUNT-IN-EXIT.
EXIT.
************
REPORT-BY-DACCOUNT-OUT.
OPEN OUTPUT OUT-FILE.
INITIATE DACCOUNTS.
MOVE LETTER-MONTH (WS-START-MON) TO WS-START-MMM.
MOVE SPACES TO WS-STRUCTURE, WS-DIRECTORY, WS-ACCOUNT.
MOVE ZEROES TO WS-AVGPAGE, WS-PAGE-NUMBER, WS-RECORDS-READ.
RBDAO-1.
RETURN SORT-USAGE AT END TERMINATE DACCOUNTS
CLOSE OUT-FILE
GO TO REPORT-BY-DACCOUNT-OUT-EXIT.
PERFORM GET-FILE-AVERAGE.
GENERATE DACCOUNTS.
GO TO RBDAO-1.
REPORT-BY-DACCOUNT-OUT-EXIT.
EXIT.
**********************************************************************
* END OF REPORT BY DISK USAGE SORTED ON ACCOUNT SUBROUTINE SECTION
**********************************************************************
**********************************************************************
* COMMON SUBROUTINES USED BY REPORTS OF DISK USAGE
**********************************************************************
MAKE-DISK-SORT-RECORD.
MOVE SPACES TO DISK-SORT-RECORD.
IF REC-SEQUENCE-NUMBER = '1' AND ENTRY-TYPE = '0009'
PERFORM CHECK-DISK-DATE-TIME
READ IN-FILE AT END CLOSE IN-FILE
ELSE IF REC-SEQUENCE-NUMBER = '2' AND ENTRY-TYPE = '0009'
READ IN-FILE AT END CLOSE IN-FILE
ELSE IF REC-SEQUENCE-NUMBER = '3' AND ENTRY-TYPE = '0009'
MOVE DAR-ACCOUNT-STRING TO ACCOUNT-SORT
MOVE DAR-PPN-DIRECTORY TO DIRECTORY-SORT
MOVE DAR-ACTUAL-DISK TO DISK-PAGE-SORT
MOVE DAR-FILE-NUMBER TO FILE-SORT
MOVE DAR-STRUCTURE-NAME TO STRUCTURE-SORT
PERFORM COMPUTE-DISK-CHARGES
PERFORM CHECK-FOR-SPACES
RELEASE DISK-SORT-RECORD.
************
CHECK-FOR-SPACES.
IF ACCOUNT-SORT = SPACES
MOVE ' UNSPECIFIED ACCOUNT' TO ACCOUNT-SORT.
CHECK-DISK-DATE-TIME.
IF WS-START-DATE-TIME > EHR-DATE-TIME
MOVE EHR-DATE-TIME TO WS-START-DATE-TIME.
COMPUTE-DISK-CHARGES.
COMPUTE CHARGE-SORT = CHARGE-SORT + DISK-PAGE-SORT * WS-DISK-PAGES.
GET-FILE-AVERAGE.
IF WS-STRUCTURE NOT = STRUCTURE-SORT
OR WS-DIRECTORY NOT = DIRECTORY-SORT
OR WS-ACCOUNT NOT = ACCOUNT-SORT
MOVE STRUCTURE-SORT TO WS-STRUCTURE
MOVE DIRECTORY-SORT TO WS-DIRECTORY
MOVE ACCOUNT-SORT TO WS-ACCOUNT
COMPUTE WS-AVGPAGE ROUNDED = WS-PAGE-NUMBER / WS-RECORDS-READ
MOVE 1 TO WS-RECORDS-READ
MOVE DISK-PAGE-SORT TO WS-PAGE-NUMBER
ELSE ADD 1 TO WS-RECORDS-READ
ADD DISK-PAGE-SORT TO WS-PAGE-NUMBER.
**********************************************************************
* END OF COMMON SUBROUTINES USED BY REPORTS OF DISK USAGE
**********************************************************************
************************************************************************
* HELP SUBROUTINES
************************************************************************
DISPLAY-HELP-INPUT.
DISPLAY 'Type file name of input file containing USAGE entries.'.
DISPLAY 'Default is USAGE.OUT.'.
PERFORM DISPLAY-EXIT-HELP.
DISPLAY-HELP-OUTPUT.
DISPLAY 'Type file name of new output file. Default is USAGE.RPT.'.
PERFORM DISPLAY-EXIT-HELP.
DISPLAY-HELP-REPORT.
DISPLAY 'Type S for system usage report. Type D for disk usage'.
DISPLAY 'report. Default is S.'.
PERFORM DISPLAY-EXIT-HELP.
DISPLAY-HELP-SORT.
DISPLAY 'Type N if reports are broken down by name. Type A if'.
DISPLAY 'reports are broken down by account. Default is N.'.
PERFORM DISPLAY-EXIT-HELP.
DISPLAY-EXIT-HELP.
DISPLAY 'Type EXIT to return to monitor mode. Type ? to get this'.
DISPLAY 'help message.'.