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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timout when calling a C routine

Status
Not open for further replies.

ChrisPhillips

Programmer
Aug 1, 2000
11
NL
Does anybody know of a mechanism where I can call a C routine in a Micro-Focus COBOL (running under Unix), but if that C routine takes too long then force the COBOL program to continue.

Ta.
 
I don't know a lot about Micro-Focus COBOL (I do mainframe programing in a MVS environment). So I don't know what utilities might be available.

The only think I can think of is to use some sort of ACCEPT statment (whatever it is in C) at the beginning of the C program, where you get the current time. Then start computing the elapsed time at certain points within the C program. If the elapsed time goes beyond your time limit, code the C program to immediatly return to the COBOL program. Have it pass some sort of return code so that your COBOL program knows that the time limit has passed (in case you want to issue an error or warning message).

I don't know if this helps, but good luck. Nina Too
 
I don't have access to the latest Micro-focus stuff, but you might look to see if it supports threads. If so, you can launch the C program on one thread and a timed wait on the main thread. If the timed wait ends and the C program is not done, you can kill the C thread and continue.

Good luck.

Glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top