1828412 Members
4003 Online
109977 Solutions
New Discussion

LIB$WAIT & COBOL/VMS

 
Alex Bartonek
New Member

LIB$WAIT & COBOL/VMS

May or may not be the proper forum but its worth a shot..

Currently in my COBOL program I am using the lib$wait routine. Its being called in block of code that is being run via a perform loop.

For testing purposes I set the initial wait time to 10 seconds. The first time the perform loop runs through and hits the LIB$WAIT call it waits for 10 seconds. If there is no work to do it calls lib$wait but completely skips the 10 second count from then on as if it had met the 10 second wait criteria.

Here is my call:
CALL "LIB$WAIT" USING BY REFERENCE duration, libnowake, float-type

duration is set to 10
libnowake is set to 0 or 1, but I've also substituted 'OMITTED' in place of libnowake..none of these values fixed the problem.

Current versions of software pertinent to this problem:
OVMS = 7.3-2, roll-up patch 4
COBOL 2.8
RDB 7.1-411

I thank you'all in advance!

-Alex
7 REPLIES 7
Hein van den Heuvel
Honored Contributor

Re: LIB$WAIT & COBOL/VMS


Hmmm,

I would have suspected the Control flags arguments: "The flags argument is the address of a longword integer that contains the control flags. The following flag is defined: Bit 0, LIB$K_NOWAKE LIB$WAIT will not wake in the case of an interrupt.

This is an optional argument. If omitted, the default is 0, and LIB$WAIT
will wake in the case of an interrupt. "

As discussed in:
https://forums2.itrc.hp.com/service/forums/questionanswer.do?threadId=948325

But it sounds like you already tried passing the integer value 1 as argument there.

I would triple-check and print out all arguments to lib$wait just before it being called.

Hein.


Garry Fruth
Trusted Contributor

Re: LIB$WAIT & COBOL/VMS

I'd add to Hein's suggestion, add the GIVING clause and see that the return status is normal (1).
Ian Miller.
Honored Contributor

Re: LIB$WAIT & COBOL/VMS

See also
http://www.openvms.org/phorum/read.php?f=1&i=2760&t=2760
____________________
Purely Personal Opinion
Ian McKerracher_1
Trusted Contributor

Re: LIB$WAIT & COBOL/VMS

Hello Alex,

It may be worth checking the variable which you use as the 'seconds' argument. LIB$WAIT requires a F-FLOATING value but your variable may not be declared as a COMP-1. If the variable is declared correctly is the compiler using an unexpected floating point type.


Regards,

Ian

Arch_Muthiah
Honored Contributor

Re: LIB$WAIT & COBOL/VMS

Alex,

could you please try this once...

01 duration comp-1.
....
move 10.0 to duration.
CALL "LIB$WAIT" using by reference duration.

-----------------------------
The other way....

and other doubt I have is when I read the VMS help about lib$wait, in which they mentioned about the thrid argument float type....

float-type
"This is an optional argument. If omitted, the default is F_floating. F_floating is
the "--required--" float-type when LIB$WAIT is called from a module written in a language that "--prototypes--" functions"

Looks like we should use this third argument (LIB$K_VAX_F -- Alpha, LIB$K_IEEE_S --- IA64).

So try float-type = LIB$K_VAX_F alternatively with LIB$K_NOWAKE and LIB$K_NOWAIT control flags. Just trial only...

If it doesn't work, could please past your PERFORM loop code?

Archunan
Regards
Archie
Alex Bartonek
New Member

Re: LIB$WAIT & COBOL/VMS

Ok.. the problem was in the declaration of the libnowait variable..

I was using comp-1, it should have been pic 9(5) comp value 1.

-Alex
Alex Bartonek
New Member

Re: LIB$WAIT & COBOL/VMS

solution was to declare the variable as:

pic 9(5) comp value 1.