-
Notifications
You must be signed in to change notification settings - Fork 0
/
GOODS.cbl
65 lines (60 loc) · 2.04 KB
/
GOODS.cbl
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
******************************************************************
* Author:
* Date:
* Purpose:
* Tectonics: cobc
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID.GOODS.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT GOODS-FILE
ASSIGN TO "D:\db\goods"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS ID-GOODS OF REC-GOODS
FILE STATUS IS FILE-STA-GOODS.
DATA DIVISION.
FILE SECTION.
COPY SALEFILES.
WORKING-STORAGE SECTION.
*> 01 READ-PARAM.
*> 02 ID-GOODS PIC 9(6).
*> 02 NAME-GOODS PIC X(20).
*> 02 PRICE-GOODS PIC S9(4)V99.
*> 02 LEFT-GOODS PIC 9(5).
*> 02 FIRM-GOODS PIC X(20).
COPY SALEPARAM.
LINKAGE SECTION.
01 LS-RETURN-GOODS PIC 9.
PROCEDURE DIVISION USING LS-RETURN-GOODS.
MAIN-PROCEDURE SECTION.
DISPLAY "==============GOODS".
OPEN I-O GOODS-FILE.
DISPLAY "ENTER ID OF GOODS:"
ACCEPT ID-GOODS OF REC-GOODS
DISPLAY "ENTER NAME OF GOODS:"
ACCEPT NAME-GOODS OF REC-GOODS
DISPLAY "ENTER PRICE OF GOODS:"
ACCEPT PRICE-GOODS OF REC-GOODS
DISPLAY "ENTER FIRM OF GOODS:"
ACCEPT FIRM-GOODS OF REC-GOODS
IF NOT (FILE-STA-GOODS = 00) THEN
DISPLAY "FILE NOT FIND!"
ELSE
*> WRITE REC-GOODS
READ GOODS-FILE
KEY IS ID-GOODS OF REC-GOODS
INVALID KEY
WRITE REC-GOODS
CONTINUE
NOT INVALID KEY
DISPLAY "GOODS ALREADY EXIST."
END-READ
END-IF.
DISPLAY REC-GOODS.
* DISPLAY FILE-STA-GOODS.
CLOSE GOODS-FILE.
.
EXIT PROGRAM.