Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you sleep on TSO Rexx? 2

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
0
0
US
Hi,
I'm using TSO Rexx on z/OS. What is the proper (most efficient) way to sleep for x seconds? I could write a loop that keeps checking the time, but that would take up a hell of a lot of resources.
 
Never make an interactive process wait. If you find yourself doing that, it should prompt you to redesign the task.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
I'm not really sure what you mean?

I'm writing some QA tests in Rexx, and some tests need other jobs to run before the test to setup the environment properly. When I submit a job in Rexx, it immediately runs the next line instead of waiting for the job to end. So I wanted to sleep for a while to give the job time to end. (I know that's not the best way to do it, but for QA purposes, it's good enough)
 
That's the first time I've heard someone in QA say "..that's good enough." ;-)

Do you have some requirement that says job#2 must run immediately after job#1? If so, then the last step of job#1 should submit job#2.

Interactive processes should never 'sleep'. It's unfair to others who share the system's resources. What do you think would happen to response time if everyone did this?

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
rexxhead said:
Interactive processes should never 'sleep'. It's unfair to others who share the system's resources. What do you think would happen to response time if everyone did this?
I'm not sure how z/OS sleeps (or if it even can), but on a good OS like UNIX or Windows when a program calls the OS's sleep API, that thread is just suspended for the amount of time specified and control is given to other programs. Why would z/OS be any different?
 
It's enough that it is different: each TSO user is a separate JOB and follows the rules for jobs. You occupy an initiator and share CPU time. Dispatching algorithms typically give a higher initial priority for tasks that seem to be 'busy'. When you go into a non-IO loop, you are very busy and the OS feeds you time until you cross the threshhold that says "uh-oh, this thing's on fire...". It is possible that you could, with the right kind of sleep loop, shut out every other user on the system... until you '322'.

Do it often enough and you'll find that your dispatching priority is inexplicably lower than everyone else's...


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
That's why I was asking if there was a way to sleep other than using a loop. Such as telling z/OS to give the CPU to someone else and continue processing my program in x seconds.
 

STIMER WAIT, but this is not implemented for any language except Assembler. Sorry.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Crap... :-(

If I get someone to write me a SLEEP() TSO command that uses the STIMER WAIT instruction, will Rexx wait until the SLEEP command is finished waiting, or will it immediately go to the next line...?
 
Wow, thanks.
I tried downloading, but it says the file isn't found.

I'd rather not have to hit any buttons while it's running the tests, since I'd have to do it quite a few times. I'd like to run my Rexx script in a JCL job and let it run while I'm at lunch or over night, then analyze the results when it's done.

Does your download also include the source code for the program? I'm sure the developers would want to take a quick look at it before I run it, since I'm basically running as God (SPECIAL, OPERATIONS on RACF, and the equivalent on ACF2 & TSS).
 
The ZIP file is there now. Sorry about that. The file is the source code.

Hope it helps.
 
Hmmm....tell you what...email me at

bowstore....@......hotmail.com (remove the dots)

and I will send you the file that way.
 
I don't know what the problem was, but I was able to download it from work today.
I'll try it out as soon as the developers look it over and compile it for me.
Thanks! :)
 
Hi,
Just to let everyone know (and others who are also wondering how to sleep in Rexx), one of the developers here showed me a much easier way to sleep in Rexx. Here's a Rexx SLEEP script I made:
Code:
/* REXX */
/* Sleeps for the specified number of seconds.                        */
/********1*********2*********3*********4*********5*********6*********7*/

SIGNAL ON ERROR

PARSE ARG seconds

IF seconds = "" THEN
   CALL BadSyntax

IF DATATYPE( seconds, 'W' ) == 0 THEN
   DO
      SAY "ERROR!  seconds parameter must be a whole number!"
      CALL BadSyntax
   END

CALL SYSCALLS 'ON'
ADDRESS SYSCALL

"sleep" seconds

CALL SYSCALLS 'OFF'
EXIT 0


/** BadSyntax()
 *  Prints the correct syntax...
 */
BadSyntax:  PROCEDURE
   SAY "Syntax error!"
   SAY ""
   SAY "Syntax:  SLEEP( seconds )"
   CALL SYSCALLS 'OFF'
EXIT 1


/** ERROR
 *  Called when an ERROR signal occurs.
 */
ERROR:
   SAY "ERROR!  Killing Rexx script."
   CALL SYSCALLS 'OFF'
   EXIT 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top