Calling dos program from OS2 REXX 
Author Message
 Calling dos program from OS2 REXX

Mike's idea is also good for synchronizing a DOS program with an OS/2 Rexx
driver.
-Peter
______________________________ Reply Separator _________________________________
Subject: Re: Calling dos program from OS2 REXX

Date:    4/13/95 4:45 AM


Quote:
>HI -- my gateway ate your name, but....

>in the rexx, this will kick off an asynchronous thread, and the rexx will go
on
>about its business without waiting for the "dir" to complete.  Probably not
what
>you want.

This is a little off the original question, but...I found a really neat trick
for
executing commands (DOS or OS/2) in an asynchronous thread where the caller
is able to determine when the command has completed.  Pipe the output to
a file, such as <command>.OUT.  Wait a few seconds (depending upon the
command or program you are executing), then start trying to open the output
file periodically.  When the file can be opened, the command has completed.
The STDOUT output is now in the file (you can also redirect STDERR here).
This is especially useful for checking for completion codes in user-written
programs.  I used it to automate scheduling of a Microfocus COBOL jobstream
on an OS/2 server - from CA7 on the mainframe!

Here's an example:

/* REXX */

..<housekeeping junk>...

ADDRESS CMD "MYPROG >MYPROG.OUT"
Call SysSleep 5
Do Until STREAM("MYPROG.OUT","C","OPEN")="READY:"
 Call SysSleep 5
End;

Do While Lines("MYPROG.OUT")=1
 CheckLine=LINEIN("MYPROG.OUT")
 Select;
 When... conditional checking of output messages
 Otherwise...
 End;
End;

/-----------------------------------------------------------
/ Mike O'Brien
/ Senior Consultant
/ Legent Corporation



Mon, 29 Sep 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Calling dos program from OS2 REXX

2. OS2 REXX CPU usage function call?

3. Calling Batch from Rexx/OS2

4. Calling Batch from Rexx/OS2

5. How to execute OS2 edit macro from a REXX program

6. REXX sample TELNET program in OS2

7. NT REXX assistance for OS2/VM REXX man

8. Call a REXX Exec and have it Address the calling program

9. Windows program call DOS program

10. rexx program calling cobol program

11. Calling a REXX program from a C program.

12. Calling REXX programs from within an assembler program

 

 
Powered by phpBB® Forum Software