前记: 直接用WRITE的话,File中原来数据就被清空了. 呵呵,是我OPEN模式有问题
ILE COBOL Source 1
FMT CB ......-A+++B++++++++++++++++++++++++++++++++++++++++++++
*************** Beginning of data **********************
0001.00 IDENTIFICATION DIVISION.
0002.00 PROGRAM-ID. CBL11.
0003.00 ENVIRONMENT DIVISION.
0004.00 CONFIGURATION SECTION.
0005.00 SOURCE-COMPUTER. IBM-ISERIES.
0006.00 OBJECT-COMPUTER. IBM-ISERIES.
0007.00 INPUT-OUTPUT SECTION.
0008.00 FILE-CONTROL.
0009.00 SELECT OUTPUT01 ASSIGN TO DATABASE-CUSTOMER
0010.00 ORGANIZATION IS SEQUENTIAL
0011.00 ACCESS IS SEQUENTIAL
0012.00 FILE STATUS IS OUTPUT01-FILE-STATUS.
0013.00 DATA DIVISION.
0014.00 FILE SECTION.
0015.00 FD OUTPUT01.
0016.00 01 OUTPUT01-REC.
0017.00 COPY DDS-ALL-FORMATS OF CUSTOMER.
0018.00 WORKING-STORAGE SECTION.
0019.00 77 OUTPUT01-FILE-STATUS PIC X(2).
0020.00 PROCEDURE DIVISION.
0021.00 MAINLINE.
0022.00 OPEN OUTPUT OUTPUT01.
0023.00 MOVE 88025 TO CUSNO.
0024.00 MOVE "CBLLE11" TO CUSNM.
0025.00 MOVE "NNNNNNN" TO CUSAD.
0026.00 MOVE 1234567890 TO CUSPH.
0027.00 WRITE OUTPUT01-REC END-WRITE.
0028.00 IF OUTPUT01-FILE-STATUS="00" THEN
0029.00 DISPLAY "WRITE SUCCESSFULLY."
0030.00 ELSE DISPLAY OUTPUT01-FILE-STATUS END-IF.
0031.00 CLOSE OUTPUT01.
0032.00 STOP RUN.
****************** End of data ************************
ILE COBOL Source 2
FMT CB ......-A+++B++++++++++++++++++++++++++++++++++++++++++++
*************** Beginning of data **********************
0001.00 IDENTIFICATION DIVISION.
0002.00 PROGRAM-ID. CBL11.
0003.00 ENVIRONMENT DIVISION.
0004.00 CONFIGURATION SECTION.
0005.00 SOURCE-COMPUTER. IBM-ISERIES.
0006.00 OBJECT-COMPUTER. IBM-ISERIES.
0007.00 INPUT-OUTPUT SECTION.
0008.00 FILE-CONTROL.
0009.00 SELECT OUTPUT01 ASSIGN TO DATABASE-CUSTOMER
0010.00 ORGANIZATION IS SEQUENTIAL
0011.00 ACCESS IS SEQUENTIAL
0012.00 FILE STATUS IS OUTPUT01-FILE-STATUS.
0013.00 DATA DIVISION.
0014.00 FILE SECTION.
0015.00 FD OUTPUT01.
0016.00 01 OUTPUT01-REC.
0017.00 COPY DDS-ALL-FORMATS OF CUSTOMER.
0018.00 WORKING-STORAGE SECTION.
0019.00 77 OUTPUT01-FILE-STATUS PIC X(2).
0020.00 PROCEDURE DIVISION.
0021.00 MAINLINE.
0022.00 OPEN EXTEND OUTPUT01.
0023.00 MOVE 88025 TO CUSNO.
0024.00 MOVE "CBLLE11" TO CUSNM.
0025.00 MOVE "NNNNNNN" TO CUSAD.
0026.00 MOVE 1234567890 TO CUSPH.
0027.00 WRITE OUTPUT01-REC END-WRITE.
0028.00 IF OUTPUT01-FILE-STATUS="00" THEN
0029.00 DISPLAY "WRITE SUCCESSFULLY."
0030.00 ELSE DISPLAY OUTPUT01-FILE-STATUS END-IF.
0031.00 CLOSE OUTPUT01.
0032.00 STOP RUN.
****************** End of data ************************
注意比较这两个程序运行结果的不同...前提是PF中需要事先有数据,要不没什么不同.
话说回来,看到OUTPUT,有看到EXTEND,再不明白真就有点白痴了...
PF DDS参看之前的列子
阅读(2305) | 评论(0) | 转发(0) |