Re: How to let a COBOL program sleep 5 seconds

From: wahlers (ahlers_wim_at_hotmail.com)
Date: 09/07/04


Date: Tue, 07 Sep 2004 07:57:23 -0400

To add to Frederico Fonseca's answer:

COBOL does not include a "sleep" function up to and including COBOL-85.

There might(!) be a COBOL intrinsic standard function that performs this
function (I don't know...check yourself).

There might(!) be a COBOL standard "sleep" function in the COBOL-2002
standard (or beyond). I don't know!

Assuming there is no standard "sleep" function then do the following:

1. Write a COBOL function (within OOCOBOL: a COBOL static function),
calling a system dependent(!) "sleep" routine.
2. Let your program call this (static) COBOL function when required.

This 2-phase call structure will accomplish the following:

It will prevent a massive recompile of many COBOL programmes in case you
have to change the environment or "sleep" routine.

Thus:

COBOL programs (many) -- calls -> COBOL "sleep" routine (independent) --
calls -> "sleep" routine (system dependent)

Notice that in the worst case scenario the system dependent "sleep"
routine must be replaced and maybe the COBOL "sleep" routine must be
modified (calling a different system dependent "sleep" routine name and/or
parameters).

There is, and will be, only one COBOL "sleep" routine.

The call structure relationship is thus as follows:
many COBOL programs calling 1 COBOL "sleep" routine calling 1 system
dependent "sleep" routine.

Using a construction as described as above makes your system more robust
and more adaptable for change.

I hope I was clear enough...regards, Wim Ahlers.

P.S. I don't care what the system dependent sleep routine looks like
(assembler, C++, LE routines (C), or whatever...).



Relevant Pages

  • Re: Why COBOL is losing the POWER struggle
    ... If I only wrote COBOL, I would have accepted that "That's how it ... Just go to sleep. ... COBOL is a Turing Machine. ... COBOL and the FORTRAN people write a subroutine. ...
    (comp.lang.cobol)
  • Re: Why COBOL is losing the POWER struggle
    ... If I only wrote COBOL, I would have accepted that "That's how it ... Just go to sleep. ... The problem is that this "once in a lifetime" code segment, subprogram, ... about in COBOL and the FORTRAN people write a subroutine. ...
    (comp.lang.cobol)
  • Re: How to let a COBOL program sleep 5 seconds
    ... >Anybody can tell me how to let a COBOL program sleep 5 seconds? ... Sleep is not a *standard* Cobol function; is it a standard C function. ... If true, change sleep-sec to ...
    (comp.lang.cobol)
  • Re: Road Sign
    ... SLEEP. ... Coo. ... Can you do that in Cobol? ... Yeah. ...
    (uk.rec.sheds)
  • Re: Microfocus Cobol "SLEEP" routine
    ... CALL 'sleep' USING BY VALUE 300. ... Is there a way in MF Cobol to pause program execution for, ... I need a routine in Cobol itself so I may vary the time to pause in some ...
    (comp.lang.cobol)