1、文件操作,文件种类 1. 顺序文件 2. 索引文件,顺序文件,环境部(FILE-CONTROL) SELECT OPTIONAL file-name ASSIGN TO FILE_VMS ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS file-status,顺序文件,数据部(FILE SECTION) FD file-name LABEL RECORDS ARE STANDARD/OMITTED. 01 record-name. -record name 05 PROD-CODE PIC 9(04). 0
2、5 PROD-QUANTITY PIC 9(05). 05 PROD-PRICE PIC 9(06). 05 MANU-DATE. 10 DATE-CCYYPIC 9(04). 10 DATE-MM PIC 9(02). 10 DATE-DD PIC 9(02).,顺序文件(程序部),OPEN 1.INPUT 只读 2.OUTPUT 只写 3.I-O 读写 4.EXTEND 写(文件末尾追加),顺序文件(程序部),OPEN 1.INPUT 只读 2.OUTPUT 只写 3.I-O 读写 4.EXTEND 写(文件末尾追加),顺序文件(程序部),读文件 READ file-name AT END
3、 statements NOT AT END statements END-READ,顺序文件(程序部),写文件 WRITE record-name from ident-name. 关闭文件 CLOSE file-name,索引文件,环境部(FILE-CONTROL) SELECT OPTIONAL file-name ASSIGN TO FILE_VMS ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS file-prikey FILE STATUS IS file-status.,索引文件,数据部(FILE SECT
4、ION) FD file-name LABEL RECORDS ARE STANDARD/OMITTED. 01 record-name. -record name 05 PROD-CODE PIC 9(04). 05 PROD-QUANTITY PIC 9(05). 05 PROD-PRICE PIC 9(06). 05 file-prikey. 10 DATE-CCYYPIC 9(04). 10 DATE-MM PIC 9(02). 10 DATE-DD PIC 9(02).,索引文件(程序部),OPEN 1.INPUT 只读 2.OUTPUT 只写 3.I-O 读写,索引文件(程序部),读文件 READ file-name INVALID KEY statements NOT INVALID KEY statements END-READ,索引文件(程序部),写文件 WRITE record-name INVALID KEY statements NOT INVALID KEY statements END-WRITE关闭文件,