Cobol输出文件无法正常显示

时间:2016-11-09 06:47:27

标签: cobol

我试图在我的cobol程序中输出2个不同的行,但它并没有按照我想要的方式输出。它不是写每行中的一行而是写第二行中的两行。

我的代码是:

DATA DIVISION.
   FILE SECTION.
   FD INVENT-FILE-IN.
       01 INVENTORY-RECORD-IN.
              05 PART-NUMBER      PIC 9(5).
              05 PART-NAME        PIC X(20).
              05 QUANTITY-ON-HAND PIC 9(3).
              05 UNIT-PRICE       PIC 9V99(6).
              05 RE-ORDER-POINT   PIC 9(3).
              05 SUPPLIER-ID      PIC X(2).
   FD INVENT-REPORT-OUT.
       01 INVENTORY-RECORD-OUT.
              05 FILLER           PIC X(1) VALUE SPACES.
              05 PART-NUMBER      PIC 9(5). 
              05 FILLER           PIC X(3) VALUE SPACES.
              05 PART-NAME        PIC X(20).
              05 FILLER           PIC X(1) VALUE SPACES.
              05 QUANTITY-ON-HAND PIC 9(4).
              05 FILLER           PIC X(1) VALUE SPACES.
              05 UNIT-PRICE       PIC 9V99(6).
              05 FILLER           PIC X(2).
              05 INVENTORY-VALUE  PIC 9V99(10).
       01 INVENTORY-RECORD-HDR-LN1.
              05 FILLER           PIC X(9)  VALUE SPACES.
              05 FILLER           PIC X(20) VALUE "INVENTORY REPORT FOR".
              05 FILLER           PIC X(3)  VALUE SPACES.
              05 CURRENT-MONTH    PIC 9(2).
              05 FILLER           PIC X(18) VALUE SPACES.
       01 INVENTORY-RECORD-HDR-LN2.
              05 FILLER           PIC X(1)  VALUE SPACES.
              05 FILLER           PIC X(7)  VALUE "PART NO".
              05 FILLER           PIC X(1)  VALUE SPACES.
              05 FILLER           PIC X(9)  VALUE "PART NAME".
              05 FILLER           PIC X(13) VALUE SPACES.
              05 FILLER           PIC X(2)  VALUE "OH".
              05 FILLER           PIC X(2)  VALUE SPACES.
              05 FILLER           PIC X(5)  VALUE "PRICE".
              05 FILLER           PIC X(6)  VALUE SPACES.
              05 FILLER           PIC X(5)  VALUE "VALUE".
              05 FILLER           PIC X(2)  VALUE SPACES.
       01 INVENTORY-RECORD-END.
              05 TOTAL-VALUE      PIC 9(7)V99.
              05 NUM-RECORDS-IN   PIC 9(3).
              05 NUM-RECORDS-OUT  PIC 9(3).
   FD RE-ORDER-FILE.
       01 REORDER-RECORD-OUT.
              05 PART-NUMBER      PIC 9(5).
              05 PART-NAME        PIC X(20).
              05 QUANTITY-ON-HAND PIC 9(3).
              05 SUPPLIER-ID      PIC X(2).

   PROCEDURE DIVISION.
   OPEN-RTN.
   OPEN INPUT  INVENT-FILE-IN.
   OPEN OUTPUT INVENT-REPORT-OUT.
   OPEN OUTPUT RE-ORDER-FILE.
   PERFORM HEADER1-RTN.

   HEADER1-RTN.
   MOVE FUNCTION CURRENT-DATE(5:2) TO CURRENT-MONTH.
   WRITE INVENTORY-RECORD-HDR-LN1.
   PERFORM HEADER2-RTN.

   HEADER2-RTN.
   WRITE INVENTORY-RECORD-HDR-LN2
   END-WRITE.
   PERFORM CLOSE-RTN.

   CLOSE-RTN.
   CLOSE INVENT-FILE-IN.
   CLOSE INVENT-REPORT-OUT.
   CLOSE RE-ORDER-FILE.
   STOP RUN.

输出文件如下:

 PART NO PART NAME             O11 PRICE      VALUE
 PART NO PART NAME             O11 PRICE      VALUE

但我希望结果如下:

         INVENTORY REPORT FOR   11
 PART NO PART NAME             OH PRICE      VALUE

这些只是其余数据的标题,我无法弄清楚如何让它们正确显示。任何帮助表示赞赏。

0 个答案:

没有答案