Tip of the week takes a break. The next tip will be published on the 26th of october 2009.
Ugens tip holder pause. Nęste tip udkommer den 26. oktober 2009.
How do you code a nap in your program? It depends a lot on the programming language and also on the environment in which the program is executed. If your program is executed by CICS you must use a:
no matter which programming language you are using. X must be a four bytes binary field. If X equals 5 your CICS program will take a break for five seconds before it resumes execution.
If your program is running in batch or TSO you have to use the possibilities supplied by the programming language. In PL/I it is very easy using the statement DELAY(Y), where Y is a FIXED BIN(31). If Y=5000 your PL/I program will take a nap for five second, because Y is specified in milliseconds.
It may come as a surprise for you, but in COBOL and REXX there are no statements or functions with which you can take a break. Many installations have implemented their own pause modules which can be invoked in many different ways. Actually there is a Language Environment module called ILBOWAT0 you can use. In REXX you can use it like this:
If the above does not work at your installation I will like to hear from you. It may be because your installation does not use Language Environment although it is highly unlikely. X is specified in seconds and again the above REXX code will pause the execution for five seconds.
In COBOL it is a bit more complicated. The reason is that ILBOWAT0 for some odd reason expects the parameter to be below the 16Mb limit. The LINKPGM does the trick for you in REXX. In order to use ILBOWAT0 painless from other COBOL programs you can build a COBOL shell program around ILBOWAT0. Then you can call this shell program as any other COBOL program without worrying about whether the parameter is above or below the 16Mb limit. The shell program may look like this:
Compilation of the above program must result in a stand alone LOAD module with the name CBLWAIT. This LOAD module must be placed in a LOAD library on the STEPLIB concatenation in batch and on a tasklib concatenation in TSO (typically ISPLLIB or STEPLIBX). Maybe you can persuade a systems programmer to put CBLWAIT into a LINKLIST LOAD library in order to avoid thinking about a STEPLIB for CBLWAIT. Now you are ready to call CBLWAIT from any other COBOL program and let it wait for let us say five seconds again. Let X be declared as a PIC S9(9) BINARY and cblwait be declared as a pic x(8) value 'CBLWAIT') and do like this:
If you write CALL 'CBLWAIT' USING X instead you might risk som strange problems with the 16Mb limit, so please do not do that. And now it is time for a break.