Skip to main content

The environment is Visual COBOL 2017 and the objective is to put a program into sleep mode for one minute. Looking in the COBOL manual there is a System Routine of CBL GC NANOSLEEP that will do the job but the call to this routine fails (not found). Searching my C drive does not find the routine. So my questions are;

1. Is this routine the way to go or are there other alternatives? 

2.  If this is the alternative, how do I acquire this System Routine?

The environment is Visual COBOL 2017 and the objective is to put a program into sleep mode for one minute. Looking in the COBOL manual there is a System Routine of CBL GC NANOSLEEP that will do the job but the call to this routine fails (not found). Searching my C drive does not find the routine. So my questions are;

1. Is this routine the way to go or are there other alternatives? 

2.  If this is the alternative, how do I acquire this System Routine?

How about a straight win api call for native COBOL -you didn't mention if you're doing COBOL.NET or native.

special-names.
call-convention 74 IS Winapi.


01 sleep-milliseconds pic x(4) comp-5.

move 60000 to sleep-milliseconds.
call WinApi 'Sleep' using by value sleep-milliseconds.

Neil

The environment is Visual COBOL 2017 and the objective is to put a program into sleep mode for one minute. Looking in the COBOL manual there is a System Routine of CBL GC NANOSLEEP that will do the job but the call to this routine fails (not found). Searching my C drive does not find the routine. So my questions are;

1. Is this routine the way to go or are there other alternatives? 

2.  If this is the alternative, how do I acquire this System Routine?

I believe that you are looking in the manual for the GnuCOBOL product and not for Micro Focus Visual COBOL.

There is a routine in Visual COBOL called CBL_THREAD_SLEEP that can be used.

It is documented here:

Example:

 

       01 any-key  pic x.
       01 sleep-time  pic x(4) comp-5 value 60000.
       procedure division.
           display "this is a test of sleep for one minute"
           call "CBL_THREAD_SLEEP" using sleep-time
           display "after sleep"
           accept any-key
           goback.

The environment is Visual COBOL 2017 and the objective is to put a program into sleep mode for one minute. Looking in the COBOL manual there is a System Routine of CBL GC NANOSLEEP that will do the job but the call to this routine fails (not found). Searching my C drive does not find the routine. So my questions are;

1. Is this routine the way to go or are there other alternatives? 

2.  If this is the alternative, how do I acquire this System Routine?

Thanks, worked like a champ. And thanks for note about proper COBOL Manual