请帮我摆脱这个错误

时间:2014-09-17 13:21:04

标签: cobol

请帮助我,我一直收到此错误“字段超出屏幕边界错误检测到偏移我尝试了一切使其正确但错误一直出现。请帮助我,这是我的代码:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. LALABS.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER. IBM-PC.
       OBJECT-COMPUTER. IBM-PC.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT OUTFILE ASSIGN TO 'NATS'.
       DATA DIVISION.
       FILE SECTION.
       FD  OUTFILE
           LABEL RECORD IS OMITTED
           DATA RECORD IS OUTREC.
       01  OUTREC.
           02 FILLER PIC X(80).
       WORKING-STORAGE SECTION.
       01  BC  PIC 9 VALUE 0.
       01  TCF   PIC 99 VALUE 0.
       01  RFC  PIC 9(5) VALUE 0.
       01  PTF PIC 9(5) VALUE 0.
       01  ES  PIC 9(5) VALUE 0.
       01  RS  PIC 9(5) VALUE 0.
       01  EOFSW PIC 9 VALUE 0.
       01  IR PIC  9(5) VALUE 0.
       01  INPUTZ PIC X VALUE SPACES.
       01  LALAGYANZZ.
           02 LALAGYAN1 PIC 9(5) VALUE 0.
           02 LALAGYAN2 PIC 9(5) VALUE 0.
           02 LALAGYAN3 PIC 9(5) VALUE 0.
       01  CTR-STUDENTS.
           02 MAIN-S PIC 9(5) VALUE 0.
           02 COMMON-S PIC 9(5) VALUE 0.
           02 SJ-S PIC 9(5) VALUE 0.
           02 TAG-S PIC 9(5) VALUE 0.
       SCREEN SECTION.
       01  SCRE.
           02 BLANK SCREEN.
       PROCEDURE DIVISION.
       MAIN-RTN.
           PERFORM INIT-RTN THRU INIT-RTN-END.
           PERFORM PROCESS-RTN UNTIL INPUTZ = 'N' OR 'n'.
           STOP RUN.
       INIT-RTN.
           GO TO INIT-RTN-END.
       INIT-RTN-END.
       PROCESS-RTN.
           DISPLAY SCRE.
           DISPLAY(5, 20) 'POLYTECHNIC UNIVERSITY OF THE PHILIPPINES'.
           DISPLAY(6, 30) 'STA. MESA, MANILA'.
           DISPLAY(9, 30) 'METRO BRANCH CAMPUS'.
           DISPLAY(10, 30) 'POPULATION REPORT'.
           DISPLAY(11, 30) 'FIRST SEMESTER'.
           DISPLAY(12, 30) '2014-2015'.
           PERFORM A.
       A.  DISPLAY(14, 15) 'LOCATION BRANCH CODE:(1/2/3/4)'.
           ACCEPT(14, 55) BC.
           IF BC > 4 OR BC < 1 PERFORM A.
           DISPLAY(15, 15) 'LOCATION NAME:'.
           IF BC = 1 PERFORM MEYN-RTN.
           IF BC = 2 PERFORM COMMON-RTN.
           IF BC = 3 PERFORM SJ-RTN.
           IF BC = 4 PERFORM TAG-RTN.
           DISPLAY(16, 15) 'TOTAL NO. OF COURSE OFFERED:'.
           ACCEPT(16, 55) TCF.
           DISPLAY(17, 15) 'TOTAL NO. OF REGULAR FACULTY:'.
           ACCEPT(17, 55) RFC.
           DISPLAY(18, 15) 'TOTAL NO. OF PART-TIME FACULTY:'.
           ACCEPT(18, 55) PTF .
           DISPLAY(19, 15) 'TOTAL NO. OF ENROLLED STUDENTS:'.
           ACCEPT(19, 55) ES.
           DISPLAY(20, 15) 'TOTAL NO, OF REGULAR STUDENTS:'.
           ACCEPT(20, 55) RS.
           PERFORM IR-RTN.
           DISPLAY(21, 15) 'TOTAL NO: OF IRREGULAR STUDENTS:'.
           DISPLAY(21, 55) IR .
           PERFORM J.
       J.  DISPLAY(22, 15) 'INPUT ANOTHER RECORD(Y/N)?:'.
           ACCEPT(22, 55) INPUTZ.
           IF INPUTZ = 'Y' OR 'N' NEXT SENTENCE ELSE PERFORM J.
           IF INPUTZ = 'Y' PERFORM PROCESS-RTN ELSE PERFORM TOTZ-RTN.
       IR-RTN.
           COMPUTE IR = ES - RS.
       TOTZ-RTN.
           DISPLAY(23, 15) 'LARGEST NO. :'.
           DISPLAY(23, 30) LALAGYAN3.
           DISPLAY(26, 15) 'BRANCH NAME:'.
       MEYN-RTN.
           DISPLAY(15, 50) 'STA. MESA, MAIN'.
           ADD ES TO MAIN-S.
       COMMON-RTN.
           DISPLAY(15, 50) 'COMMONWEALTH'.
           ADD ES TO COMMON-S.
       SJ-RTN.
           DISPLAY(15, 50) 'SAN JUAN'.
           ADD ES TO SJ-S.
       TAG-RTN.
           DISPLAY(15, 50) 'TAGUIG'.
           ADD ES TO TAG-S.




 

2 个答案:

答案 0 :(得分:1)

DISPLAY(23, 15) 'LARGEST NO. :'.
DISPLAY(23, 30) LALAGYAN3.
DISPLAY(26, 15) 'BRANCH NAME:'.

除非您有26行屏幕(如果它基于零,则为27),最后display可能会导致问题。如果您限制在25行,那几乎可以肯定,您应该更改坐标,以便将其正确放置在屏幕边界内。

答案 1 :(得分:0)

   SCREEN SECTION.
    01  SCRE.
        02 BLANK SCREEN. 

您的屏幕部分都是组项目-No picture子句,请编译器编译该长度,其长度将为0或不确定,具体取决于编译器。顺便说一句-您正在使用什么平台/ Cobol编译器?