COBOL-COMPILATION ERROR在If语句中:作用域分隔符没有匹配的动词并被丢弃

时间:2017-10-19 14:34:52

标签: if-statement cobol

我有下面的代码,我有3个if语句,我正在使用END-If关闭所有这些,但仍然显示我的错误,

ERROr Message: 
17032 END-IF
* 564-S******                                                          (   0)**
**    A scope-delimiter did not have a matching verb and was discarded.
 17074      END-IF
* 564-S***********                                                     ( 294)**
**    A scope-delimiter did not have a matching verb and was discarded.
 17075      END-IF.
* 564-S***********                                                     ( 295)**
**    A scope-delimiter did not have a matching verb and was discarded.




 I-00.

  D    DISPLAY 'IN I-MTS-ACCOUNT-CHK'

   IF NO-INDICATOR      IN PR03-ALLOW-CLOSE-BAN-IND
   THEN

   EXIT SECTION.

   END-IF

        IF  MTS  IN MIGRATION-IND
                 IN PR02-BAN-INFO
        THEN

        IF MTS-MAPPING-ID IN PR02-BAN-INFO = ZERO
        THEN

        CALL "dcs_gt_subs_count"  USING DL-CONTEXT
                                              IN AR01-CONTEXT
                                        BAN   IN PR02-BAN-INFO
                                        AR11-SUB-STATUS-RAS-LIST
                                        AR12-SUB-TOT-COUNT
                                GIVING  AR04-STATUS.

           IF NOT SUCCESS           IN AR04-STATUS
              AND
              NOT DL-KEY-NOTFOUND-S IN AR04-STATUS
           THEN

           SET CTB-MSG-ROUTINE-ERROR     TO TRUE

           MOVE "I-MTS-ACCOUNT-CHK"      TO CTB-SECTION-NAME

           MOVE "DCS_GT_SUBS_COUNT"      TO CTB-ROUTINE-NAME

           MOVE AR04-STATUS              TO CTB-ROUTINE-STATUS

           PERFORM X-HANDLE-ERROR

           PERFORM Z-FINISH
           END-IF

           IF AR12-SUB-TOT-COUNT <> 0
             THEN

              SET NO-INDICATOR  IN PR03-ALLOW-CLOSE-BAN-IND
              TO TRUE
              SET NOT-ALL-SUB-CANCEL IN PR04-EXCEPTION-REASON
              TO TRUE
           END-IF
        END-IF
        END-IF.
    I-EXIT.
     EXIT.

1 个答案:

答案 0 :(得分:4)

一个明显的错误是行

        GIVING  AR04-STATUS.

.结束前一个if。

Cobol Style建议

  1. 为每个段落/部分编码.,并在.之前将I-EXIT单独放在一行上。在大型机上你可以做x全部; x p&#39; @ $&#39;所有(我认为已经很长时间了)会在行尾找到.

           END-IF
        END-IF
        .
    
     I-EXIT.
    
  2. 您不需要then - 删除

  3. 正确缩进代码

    IF  NOT SUCCESS           IN AR04-STATUS
    AND NOT DL-KEY-NOTFOUND-S IN AR04-STATUS
        SET CTB-MSG-ROUTINE-ERROR     TO TRUE
    
        MOVE "I-MTS-ACCOUNT-CHK"      TO CTB-SECTION-NAME
    
        MOVE "DCS_GT_SUBS_COUNT"      TO CTB-ROUTINE-NAME
    
        MOVE AR04-STATUS              TO CTB-ROUTINE-STATUS
    
        PERFORM X-HANDLE-ERROR
    
        PERFORM Z-FINISH
    END-IF
    
  4. 使阅读更容易