大机学习进行到第二周,只有我,tdy还有lw三个人还在继续学习大机了。李博博突然人间蒸发,julyforce那边杨博和lyf都没有来了。
我不喜欢喊口号,因为喊口号虚张声势居多,对于说的话,立的言,敢不敢较真呢?
学到第二周,每天的联系逐步加难,但模式都是一样的,一个数据集输入进来,他的布局是怎样的,读入以后进行一定的处理,然后打印到新的数据集里面去。
我们继续上大机课的几个人中,lw是最勤勉的,每天都去听课,我是第一周基本都去了全天,这一周上午都没去,下午直接上机,tdy则相反,上周几乎没去,这周一两次全天。不过到下午上机,基本上学的也就搞清楚了。下面贴一个这几天作业中的一个:
000001 ***********************
000002 IDENTIFICATION DIVISION.
000003 PROGRAM-ID. MONEY
000004 AUTHOR. LIGHTNING
000005 ***********************
000006 ENVIRONMENT DIVISION.
000007 INPUT-OUTPUT SECTION.
000008 FILE-CONTROL.
000009 SELECT IN-FILE ASSIGN TO SYSIN.
000010 SELECT PRINT-FILE ASSIGN TO SYSOUT.
000011 ***********************
000012 DATA DIVISION.
000013 FILE SECTION.
000014 FD IN-FILE
000015 RECORDING MODE IS F
000016 LABEL RECORDS ARE STANDARD
000017 BLOCK CONTAINS 0 RECORDS
000018 RECORD CONTAINS 80 CHARACTERS.
000019 01 SALE-RECORD.
000020 05 SALES-NUMBER PIC X(5).
000021 05 FILLER PIC X(3).
000022 05 CUSTOMER-NAME PIC X(15).
000023 05 SALE-AMOUNT PIC 9999V99.
000024 05 PAYMENT-AMOUNT PIC 9999V99.
000025 05 STATE-TAX-RATE PIC 99.
000026 05 ORDER-TYPE PIC X(3).
000027 05 FILLER PIC X(40).
000028 FD PRINT-FILE
000029 RECORDING MODE IS F
000030 LABEL RECORDS ARE OMITTED
000031 RECORD CONTAINS 132 CHARACTERS.
000032 01 PRINT-LINE PIC X(132).
000033 WORKING-STORAGE SECTION.
000034 01 EOF-FLAG PIC X(1) VALUE 'N'.
000035 01 LINE-COUNT PIC 999 VALUE 0.
000036 01 CURRENT-DATE.
000037 05 CURRENT-YEAR PIC 99 VALUE 0.
000038 05 CURRENT-MONTH PIC 99 VALUE 0.
000039 05 CURRENT-DAY PIC 99 VALUE 0.
000040 01 CAPTION-LINE1.
000041 05 THEDATE.
000042 10 MYYEAR PIC 99.
000043 10 FILLER PIC X VALUE '/'.
000044 10 MYMONTH PIC 99.
000045 10 FILLER PIC X VALUE '/'.
000046 10 MYDAY PIC 99.
000047 05 FILLER PIC X(18) VALUE SPACES.
000048 05 FILLER PIC X(15)
000049 VALUE 'MEGA-MUSIC,INC.'.
000050 05 FILLER PIC X(40) VALUE SPACES.
000051 01 CAPTION-LINE2.
000052 05 FILLER PIC X(23) VALUE SPACES.
000053 05 FILLER PIC X(18)
000054 VALUE 'DAILY SALES REPORT'.
000055 05 FILLER PIC X(39) VALUE SPACES.
000056 01 HEADER-LINE1.
000057 05 FILLER PIC X(8)
000058 VALUE 'SALE '.
000059 05 FILLER PIC X(17)
000060 VALUE 'CUSTOMER '.
000061 05 FILLER PIC X(6)
000062 VALUE 'SALE '.
000063 05 FILLER PIC X(6)
000064 VALUE 'TAX '.
000065 05 FILLER PIC X(10)
000066 VALUE 'SALES '.
000067 05 FILLER PIC X(10)
000068 VALUE 'TAX '.
000069 05 FILLER PIC X(7)
000070 VALUE 'DISC. '.
000071 05 FILLER PIC X(10)
000072 VALUE 'TOTAL '.
000073 05 FILLER PIC X(11)
000074 VALUE 'PAYMENT '.
000075 05 FILLER PIC X(7)
000076 VALUE 'BALANCE'.
000077 05 FILLER PIC X(3) VALUE SPACES.
000078 01 HEADER-LINE2.
000079 05 FILLER PIC X(8)
000080 VALUE 'NUMBER '.
000081 05 FILLER PIC X(17)
000082 VALUE 'NAME '.
000083 05 FILLER PIC X(6)
000084 VALUE 'TYPE '.
000085 05 FILLER PIC X(6)
000086 VALUE 'RATE '.
000087 05 FILLER PIC X(10)
000088 VALUE 'AMOUNT '.
000089 05 FILLER PIC X(10)
000090 VALUE 'AMOUNT '.
000091 05 FILLER PIC X(7)
000092 VALUE ' '.
000093 05 FILLER PIC X(10)
000094 VALUE 'AMOUNT '.
000095 05 FILLER PIC X(11)
000096 VALUE ' '.
000097 05 FILLER PIC X(7)
000098 VALUE ' '.
000099 05 FILLER PIC X(3) VALUE SPACES.
000100 01 HEADER-LINE3.
000101 05 FILLER PIC X(8)
000102 VALUE ' '.
000103 05 FILLER PIC X(17)
000104 VALUE ' '.
000105 05 FILLER PIC X(6)
000106 VALUE ' '.
000107 05 FILLER PIC X(6)
000108 VALUE ' '.
000109 05 FILLER PIC X(10)
000110 VALUE ' '.
000111 05 FILLER PIC X(10)
000112 VALUE ' '.
000113 05 FILLER PIC X(7)
000114 VALUE ' '.
000115 05 FILLER PIC X(10)
000116 VALUE 'DUE '.
000117 05 FILLER PIC X(11)
000118 VALUE ' '.
000119 05 FILLER PIC X(7)
000120 VALUE ' '.
000121 05 FILLER PIC X(3) VALUE SPACES.
000122 01 TATEMP PIC 9999V99.
000123 01 DISCTEMP PIC 99.
000124 01 TADTEMP PIC 9999V99.
000125 01 DETAIL-LINE.
000126 05 SALE-NO PIC X(8).
000127 05 CUS-NAME PIC X(17).
000128 05 SALE-TYPE PIC X(6).
000129 05 TAX-RATE PIC 99.
000130 05 FILLER PIC X(4) VALUE SPACES.
000131 05 SALES-AMOUNT PIC $$$$$.99.
000132 05 FILLER PIC X(2) VALUE SPACES.
000133 05 TAX-AMOUNT PIC $$$$9.99.
000134 05 FILLER PIC XX VALUE SPACES.
000135 05 DISC PIC $$9.99.
000136 05 FILLER PIC X VALUE SPACES.
000137 05 TOTAL-AMOUNT PIC $$$$$.99.
000138 05 FILLER PIC XX VALUE SPACES.
000139 05 PAYMENT PIC $$$$$.99.
000140 05 FILLER PIC XX VALUE SPACES.
000141 05 BALANCE PIC $$$$9.99.
000142 05 FILLER PIC X(2) VALUE SPACES.
000143 01 ALL-PRINT1.
000144 05 FILLER PIC X(25)
000145 VALUE 'TOTAL SALES AMOUNT: '.
000146 05 ALL-AMOUNTP PIC $$$,$$$.99.
000147 01 ALL-AMOUNT PIC 99999V99 VALUE 0.
000148 01 ALL-PRINT2.
000149 05 FILLER PIC X(25)
000150 VALUE 'AVERAGE SALES AMOUNT: '.
000151 05 ALL-DUE-AMOUNTP PIC $$$,$$$.99.
000152 01 ALL-DUE-AMOUNT PIC 99999V99 VALUE 0.
000153 01 INSTORE-COUNT PIC 9999 VALUE 0.
000154 01 CATA-COUNT PIC 9999 VALUE 0.
000155 01 INTER-COUNT PIC 9999 VALUE 0.
000156 01 ALL-PRINT3.
000157 05 FILLER PIC X(30)
000158 VALUE '% OF SALES IN STORES: '.
000159 05 PERINSTORE PIC 99.
000160 05 FILLER PIC X VALUE '%'.
000161 01 ALL-PRINT4.
000162 05 FILLER PIC X(30)
000163 VALUE '% OF SALES THROUGH CATALOG: '.
000164 05 PERCATA PIC 99.
000165 05 FILLER PIC X VALUE '%'.
000166 01 ALL-PRINT5.
000167 05 FILLER PIC X(30)
000168 VALUE '% OF SALES OVER THE INTERNET: '.
000169 05 PERINTER PIC 99.
000170 05 FILLER PIC X VALUE '%'.
000171 ******************************
000172 PROCEDURE DIVISION.
000173 OPEN INPUT IN-FILE
000174 OUTPUT PRINT-FILE
000175 ACCEPT CURRENT-DATE FROM DATE.
000176 MOVE CURRENT-DAY TO MYDAY
000177 MOVE CURRENT-MONTH TO MYMONTH
000178 MOVE CURRENT-YEAR TO MYYEAR
000179 WRITE PRINT-LINE FROM CAPTION-LINE1
000180 WRITE PRINT-LINE FROM CAPTION-LINE2
000181 WRITE PRINT-LINE FROM HEADER-LINE1
000182 WRITE PRINT-LINE FROM HEADER-LINE2
000183 WRITE PRINT-LINE FROM HEADER-LINE3
000184 READ IN-FILE
000185 AT END MOVE 'Y' TO EOF-FLAG
000186 END-READ.
000187 PERFORM 100-PRO1 UNTIL EOF-FLAG = 'Y'
000188 MOVE ALL-AMOUNT TO ALL-AMOUNTP
000189 COMPUTE ALL-DUE-AMOUNT = ALL-DUE-AMOUNT / LINE-COUNT
000190 MOVE ALL-DUE-AMOUNT TO ALL-DUE-AMOUNTP
000191 COMPUTE PERINSTORE = (INSTORE-COUNT * 100) / LINE-COUNT.
000192 COMPUTE PERCATA = (CATA-COUNT * 100) / LINE-COUNT.
000193 COMPUTE PERINTER = (INTER-COUNT * 100) / LINE-COUNT.
000194 WRITE PRINT-LINE FROM ALL-PRINT1
000195 WRITE PRINT-LINE FROM ALL-PRINT2
000196 WRITE PRINT-LINE FROM ALL-PRINT3
000197 WRITE PRINT-LINE FROM ALL-PRINT4
000198 WRITE PRINT-LINE FROM ALL-PRINT5
000199 CLOSE IN-FILE
000200 PRINT-FILE
000201 STOP RUN.
000202 100-PRO1.
000203 COMPUTE LINE-COUNT = LINE-COUNT + 1.
000204 MOVE SALES-NUMBER TO SALE-NO
000205 MOVE CUSTOMER-NAME TO CUS-NAME
000206 MOVE SALE-AMOUNT TO SALES-AMOUNT
000207 MOVE PAYMENT-AMOUNT TO PAYMENT
000208 MOVE STATE-TAX-RATE TO TAX-RATE
000209 MOVE ORDER-TYPE TO SALE-TYPE
000210 EVALUATE ORDER-TYPE
000211 WHEN 'STO'
000212 ADD 1 TO INSTORE-COUNT
000213 WHEN 'NET'
000214 ADD 1 TO INTER-COUNT
000215 WHEN 'CAT'
000216 ADD 1 TO CATA-COUNT
000217 COMPUTE TATEMP = (SALE-AMOUNT * (TAX-RATE / 100)).
000218 COMPUTE ALL-AMOUNT = ALL-AMOUNT + SALE-AMOUNT.
000219 MOVE TATEMP TO TAX-AMOUNT.
000220 IF (SALE-AMOUNT > 100)
000221 MOVE 20 TO DISCTEMP
000222 ELSE
000223 MOVE 0 TO DISCTEMP.
000224 MOVE DISCTEMP TO DISC.
000225 COMPUTE TADTEMP = SALE-AMOUNT + TATEMP -
000226 DISCTEMP.
000227 MOVE TADTEMP TO TOTAL-AMOUNT
000228 COMPUTE ALL-DUE-AMOUNT = ALL-DUE-AMOUNT + TADTEMP.
000229 COMPUTE BALANCE = TADTEMP - PAYMENT-AMOUNT.
000230 WRITE PRINT-LINE FROM DETAIL-LINE
000231 READ IN-FILE
000232 AT END MOVE 'Y' TO EOF-FLAG
000233 END-READ.
06/08/02 MEGA-MUSIC,INC.
DAILY SALES REPORT
SALE CUSTOMER SALE TAX SALES TAX DISC. TOTAL PAYMEN
NUMBER NAME TYPE RATE AMOUNT AMOUNT AMOUNT
DUE
43521 JESSE JAMES STO 06 $23.00 $0.00 $0.00 $23.00 $20.
43522 MARY MCGUIRE NET 00 $130.00 $0.00 $20.00 $110.00 $130.
43523 GEORGE JONES STO 05 $82.93 $0.00 $0.00 $82.93 $87.
43524 MARTHA STEWART CAT 07 $211.27 $14.78 $20.00 $206.05 $206.
43525 LORI LUNDY NET 04 $49.53 $14.78 $0.00 $64.31 $50.
43526 JOHN CANDY CAT 07 $427.65 $29.93 $20.00 $437.58 $427.
43527 RICHARD GREEN STO 05 $13.25 $29.93 $0.00 $43.18 $20.
43528 BEV CRUSHER NET 00 $1589.99 $29.93 $20.00 $1599.92 $1569.
43529 G.G. LIDDY STO 07 $39.95 $29.93 $0.00 $69.88 $42.
43530 HENRY FONDA STO 08 $59.45 $29.93 $0.00 $89.38 $55.
43531 BRENDA WALLS NET 00 $94.99 $29.93 $0.00 $124.92 $110.
43532 GENIE BOYD CAT 07 $9.95 $0.69 $0.00 $10.64 $10.
43533 BON SCOTT STO 06 $14.95 $0.69 $0.00 $15.64 $15.
TOTAL SALES AMOUNT: $2,746.91
AVERAGE SALES AMOUNT: $221.34
% OF SALES IN STORES: 46%
% OF SALES THROUGH CATALOG: 23%
% OF SALES OVER THE INTERNET: 30%
因为太宽,没有列全。
不得不提的是有次我提交了个死循环,害得大家甚至彭老师堵了半天不能提交作业,我费了好大劲才把这个死循环给p掉。
那程序基本上参考lw的,不同的是他打到log躲过一劫,我直接打到文件了。。。。。。
用多了大机终端会产生一个毛病,喜欢按F7,F8来翻屏幕,喜欢按f3来退出。。。比如刚才我就是如此。。。