cobolgnucobol

Command Wait in COBOL?


Is there a kind of "Wait" function in COBOL? I wrote a calculator, and to make it more 50s, i Print " Computing." "Computing.." ecc For example:

                   DISPLAY "SECONDO NUMERO"
                   ACCEPT B
                   COMPUTE C= A * B
                          DISPLAY "Computing"
                          DISPLAY "Computing."
                          DISPLAY "Computing.."
                          DISPLAY "Computing..."
                          DISPLAY "Computing...."
                          DISPLAY "Computing....."
                          DISPLAY "Computing......"
                          DISPLAY A "x" B " FA..."
                          DISPLAY C

Now, is there a way to make a little delay (half a second) on COBOL where I put the "Computing" piece? I created a github repo (https://github.com/aIDserse/Super-utility-Submachine-COBOL-CALCULATOR) to this project, look at it (refer to version 1.3) for the complete code (and maybye spread it hahah). Thx!!!


Solution

  • There's no wait statement in any ISO Standard COBOL.

    However, if you got built in system routines available either C$SLEEP (for seconds) or CBL_GC_NANOSLEEP (for nanoseconds) should do the trick.

    Example (sleeps for half a second):

    call "CBL_GC_NANOSLEEP" using "500000000" end-call
    

    For IBM's Enterprise COBOL (LE enabled) the CEE3DLY routine is most suitable (there are also other legacy routines available).