[comp.os.vms] Using System service in VAXC

NIELAND@FALCON.BERKELEY.EDU (Ted Nieland - SRL) (11/17/87)

How does one indicate in VAXC that a parameter is going to be supplied for a 
system service routine.  For example, the following routine works great:

	SUBROUTINE READ_KEY_VAX(KEY)
	IMPLICIT NONE
	BYTE KEY(*)
	INTEGER*2 CHANNEL,STATUS
	INCLUDE '($IODEF)'
	INTEGER SYS$QIOW,SYS$ASSIGN


	STATUS = SYS$ASSIGN('SYS$INPUT',CHANNEL,,)
	STATUS = SYS$QIOW(,%VAL(CHANNEL),%VAL(IO$_READVBLK + IO$M_NOECHO 
	1	+ IO$M_CVTLOW),,,,%REF(KEY),256,,,,)
	RETURN
	END


But the VAXC equivalent:

read_key_vax(key)
char *key;
{
  short int channel,status;
#include <iodef.h>
  int sysqiow(),sys$assign();

	status = sys$assign("sys$input",channel,,);
	status = sys$qiow(,channel,IO$_READVBLK + IO$M_NOECHO + IO$M_CVTLOW
                 ,,,,*key,256,,,,);
}

Doesn't compile because it doesn't like the extra commas in the qiow statment.

Any ideas out there.

--------------------------------------------------------------------------------
|                M. Edward (Ted) Nieland - Systems Analyst                     |
|------------------------------------------------------------------------------|
| US Snail:                            | Arpa Internet:                        |
| Systems Research Laboratories, Inc.  | TNIELAND@WPAFB-AAMRL.ARPA             |
| 2800 Indian Ripple Road   WP 196     | NIELAND%FALCON.DECNET@WPAFB-AAMRL.ARPA|
| Dayton, OH  45440                    |                                       |
|------------------------------------------------------------------------------|
| A T & T:  (513) 255-5156                                                     |
--------------------------------------------------------------------------------

barsh@stsci.UUCP (11/23/87)

in article <8711230601.AA23969@ucbvax.Berkeley.EDU>, NIELAND@FALCON.BERKELEY.EDU (Ted Nieland - SRL) says:
> But the VAXC equivalent:
> 
> read_key_vax(key)
> char *key;
>   short int channel,status;
> #include <iodef.h>
>   int sysqiow(),sys$assign();
> 
> 	status = sys$assign("sys$input",channel,,);
> 	status = sys$qiow(,channel,IO$_READVBLK + IO$M_NOECHO + IO$M_CVTLOW
>                  ,,,,*key,256,,,,);
> }
> 
> Doesn't compile because it doesn't like the extra commas in the qiow statment.
> 
> Any ideas out there


1.  You can put zero's in for parameter's you don't use.
2.  you must use a string descriptor to pass string's to VMS

	i.e.  your "sys$input" will not work since it is a "C" string

	#include <descrip>

	$DESCRIPTOR(sinp, "sys$input");
	status = sys$assign(&simp, &channel, 0, 0);
	etc...

3.  You must pass string descriptors by address, hence, the above 
    ampersand in passing simp.

4.  channel number in sys$assign must be passed by address if I remember
    correctly.

5. When specifying things like your lists in qio, you should OR in the
   values (i.e. IO$_READVBLK | IO$...) instead of adding them.

6. The system service manual specifies exactly how to pass parms to
   each ss, if you don't follow them exactly...

If this doesn't help, I can come up with a working sample of this
in a few minutes, just let me know...


					jrbii
					~~~~~
 
-- 
	        John Barshinger	
		Space Telescope Science Institute
		Baltimore, MD 21218
		plink:jrbii | bix:jrbii | barsh@stsci.edu

levy@ttrdc.UUCP (11/25/87)

In article <8711230601.AA23969@ucbvax.Berkeley.EDU>, NIELAND@FALCON.BERKELEY.EDU (Ted Nieland - SRL) writes:
#> 	status = sys$assign("sys$input",channel,,);
#> 	status = sys$qiow(,channel,IO$_READVBLK + IO$M_NOECHO + IO$M_CVTLOW
#>                  ,,,,*key,256,,,,);
#> Doesn't compile because it doesn't like the extra commas in the qiow statment.

For that matter, VAXC won't like the extra commas in the sys$assign() call.
Solution: use explicit 0's in the unused parameter positions, e.g.:

 	status = sys$assign("sys$input",channel,0,0);
 	status = sys$qiow(,channel,IO$_READVBLK + IO$M_NOECHO + IO$M_CVTLOW,
                  0,0,0,*key,256,0,0,0,0);
-- 
|------------Dan Levy------------|  Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
|         an Engihacker @        |  	<most AT&T machines>}!ttrdc!ttrda!levy
| AT&T Computer Systems Division |  Disclaimer?  Huh?  What disclaimer???
|--------Skokie, Illinois--------|