Return 到 Main,但格式自由

Return to Main, but with free format

我正在写一个虚拟时间机器 我想在评估一年时回到开头,但是使用自由格式我不能只说 "GO TO MAIN" 我基本上想让程序说:你想评估其他年份吗?” 如果是,请转到 "MAIN"(没有,因为为了编写长文本,我使用自由格式) 如果没有停止 运行.

ACCEPT INPUT1
           IF INPUT1 = 1900
                  DISPLAY"London reaches 4,300,000 inhabitants"
                  DISPLAY"Paris reaches 2,000,000 inhabitants"
                  DISPLAY"From 14 May to 28 October, the 2nd Olympics will take place in Paris."
                  DISPLAY"In Great Britain, on 28 February, the Labour representation committee was founded, under the leadership of Ramsay McDonald (1866-1937), which united, within the new party, associations and unions of socialist orientation."
                  DISPLAY"Bernhard von Bülow succeeded the Prince of Hohenlohe, Chlodwig, as the new Chancellor of the German Reich (1900 - 1909)."
                  DISPLAY"The American Schools of Oriental Research is founded."
               END-IF
               DISPLAY "Do you want to analyze the events of other years??"
               ACCEPT Q
               IF Q = "Y" OR "YES" OR "y" OR "yes" OR "Yes" GO TO 
                   ELSE DISPLAY "OK, GOOD JOB :)"
                       DISPLAY "I EXIT IN 3 SECONDS..."
                       CALL "CBL_OC_NANOSLEEP" USING "1000000000"
                   END-CALL
                   DISPLAY "I EXIT IN 2 SECONDS.."
                   CALL "CBL_OC_NANOSLEEP" USING "1000000000"
                   END-CALL
                   DISPLAY "I EXIT IN 1 SECOND."
                   CALL "CBL_OC_NANOSLEEP" USING "300000000"
                   END-CALL
               STOP RUN.

你有什么想法吗?非常感谢:)

自由格式参考格式不会删除段落或 GO TO,因此您只需添加这些就可以了。 但我建议有一个主要逻辑,包括循环作为循环并稍微构造代码,在这种情况下:

  MAIN SECTION.
     PERFORM TIME-MACHINE UNTIL NOT (Q = "Y" OR "YES")
     PERFORM ENDING-CINEMA
     GOBACK.
  *>
  TIME-MACHINE SECTION.
     ACCEPT INPUT1
     IF INPUT1 = 1900
        DISPLAY"London reaches 4,300,000 inhabitants"
        DISPLAY"Paris reaches 2,000,000 inhabitants"
        DISPLAY"From 14 May to 28 October, the 2nd Olympics will take place in Paris."
        DISPLAY"In Great Britain, on 28 February, the Labour representation committee was founded, under the leadership of Ramsay McDonald (1866-1937), which united, within the new party, associations and unions of socialist orientation."
        DISPLAY"Bernhard von Bülow succeeded the Prince of Hohenlohe, Chlodwig, as the new Chancellor of the German Reich (1900 - 1909)."
        DISPLAY"The American Schools of Oriental Research is founded."
     END-IF
     DISPLAY "Do you want to analyze the events of other years??"
     ACCEPT Q
     INSPECT Q (1:3) CONVERTING "yes" to "YES"
     CONTINUE.
  *>
  ENDING-CINEMA SECTION.
     DISPLAY "OK, GOOD JOB :)"
     DISPLAY "I EXIT IN 3 SECONDS..."
     CONTINUE AFTER 1 SECOND  *> for "old" GnuCOBOL use a call to "C$SLEEP" USING "1"
     DISPLAY "I EXIT IN 2 SECONDS.."
     CONTINUE AFTER 1 SECOND
     DISPLAY "I EXIT IN 1 SECOND."
     CONTINUE AFTER 1 SECOND
     CONTINUE.