Skip to main content

Problem:

Sometimes in COBOL applications there is a requirement for pausing execution of an application before continuing.  Most techniques for doing this involve tying up the processor (e.g. performing a large 'perform varying'), to the detriment of other users.

Resolution:

One method worth trying is to use  call "SYSTEM" and call a UNIX script containing a sleep statement.  e.g.

working-storage section.

01 w-call-sleep.

    03  filler pic x(7) value "sleep 5".

    03  filler  pic x value x"00".

procedure division.

   ..........

    ...........

    call "SYSTEM" using w-call-sleep

    ............

   .............

The parameter for sleep is in whole seconds, and there may be OS discrepancies of up to one second either way.  The sleep command takes almost no system resources.

Old KB# 7202