Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

C++ and SYS$QIO

Go to solution
Lai King Leung
Occasional Advisor

C++ and SYS$QIO

Why do I keep getting %SYSTEM-F-BADPARAM, bad parameter value ????????

Here's a niipet of the QIO I am issuing in a C++ object:

** Active open connection by client:
** Setup extended characteristics buffer
** Issue $QIO to open connection

ecb[0].paraID = 2; /* internet address */
ecb[0].val = htonl( inet_network (serverIPAddress) );

ecb[1].paraID = 3; /* port number */
ecb[1].val = port;

ecb_dsc.dsc$w_length = sizeof(ecb);
ecb_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
ecb_dsc.dsc$b_class = DSC$K_CLASS_S;
ecb_dsc.dsc$a_pointer = (char *)&ecb;

memset ( &connect_iosb, 0, sizeof(IOSB_T) );

status = sys$qio( 0,
&processConnectAST, 0,

It all compiles OK but when the AST fires and I check the connect_iosb status value - it is 20 which means Bad Param Value ???

Please can anyone help ??
Ian Miller.
Honored Contributor

Re: C++ and SYS$QIO

A couple of things to check. Is the status from SYS$QIO ok? Is the ecb and its descriptor and the iosb still valid when the ast fires (e.g. not on the stack of a routine which has returned)?
Purely Personal Opinion
Hein van den Heuvel
Honored Contributor

Re: C++ and SYS$QIO

Yeah, make sure that this ecb and stuff it points to is not local to the routine setting up for the ast, but availble when the as executes? make static and see if that helps?

What Driver is this? I check the VMS TCP programmign manual (http://h71000.www7.hp.com/doc/73final/6529/6529pro_index.html) and find no reference about IO_CTRL | M_STARTUP nor 'ecb's.
Specifically I wanted to verify you really needed a descriptor, and not an itemlist.

Descriptors in QIOs are not too common, and and ecb does not look like a 'fixed length character string' to me.

Honored Contributor

Re: C++ and SYS$QIO

Hi Lai,
If I understand what you will make, processConnectAST is a your function; if is it you could write:

status = sys$qio( 0, // param #1: efn
ChannelNo, // param #2: I/O channel
val, // param #3: function code
&connect_iosb, // param #4: I/O status block
0, // param #5: AST mask, here may be a value
0, // param #6: no param supplyed
&processConnectAST, // p. #7: your fun addr
&ecb_dsc, // p. #8: param 4 your function

Notice compiler don't warning you because size of parameters are coherents.

Antonio Maria Vigliotti
Honored Contributor

Re: C++ and SYS$QIO

.. also you can see http://h71000.www7.hp.com/doc/731FINAL/6136/6136pro_contents.html
Antonio Maria Vigliotti
Willem Grooters
Honored Contributor

Re: C++ and SYS$QIO

$QIO for TCPIP is specified in the IO-manuals for TCPIP, look at http://h71000.www7.hp.com/doc/73final/6529/6529pro_015.html, starting at chapter 5, it discusses usage of QIO system services.
You'll find there that:
- the IO fucntion will be unknown.
- the parameter set that you use is not correct for IO$_SETMODE.
Willem Grooters
OpenVMS Developer & System Manager

Re: C++ and SYS$QIO

As you used the IO$M_CTRL modifier in your $QIO I assume you noticed it in a Telnet device driver include file header. If your intention is to create a TNA device that you map to a DECserver port for example, you might have to drop an eye at:

If your intention is to write $QIO based TCP/IP communications, please have a look at:

If none of these needs apply to yours, please reply telling us what you intend to do.
Lai King Leung
Occasional Advisor

Re: C++ and SYS$QIO

Thanks for all the replies - the problem resolved itself when I put /nomember_alignment in the compilation switch.

I found some of the links very useful so once again a big thank-you