COBOL example

In my comment on the post Logical flow of an Interactive program the structure of the COBOL source code got lost, here is how it’s supposed to look:

       MainParagraph.
           perform InitProgram
           perform ProcessScreen
             until EndOfProgram
           perform ExitProgram

           goback
           .

       InitProgram.
           set ContinueProgram             to true
           .

       ExitProgram.
           continue
           .

       ProcessScreen.
           perform ShowScreen

           evaluate true
             when EnterKey
               perform CheckInput

             when CF03
               set EndOfProgram            to true
               set linkF03Used             to true

             when CF08
               perform CheckInput

               if NoErrors
                  perform WriteData
               end-if

               if NoErrors
                  set EndOfProgram         to true
               end-if

             when CF12
                set EndOfProgram           to true
                set linkF12Used            to true
           end-evaluate
           .

Published on 31 december 2007.

Leave a response

This is where you can leave your response. All fields are required but the e-mail address will not be published.