Debian Codegraph @

libsrc/os/vms/osfvms.c

raw
1 /* @(#)osfvms.c 19.1 (ES0-DMD) 02/25/03 13:56:12 */
2 /*===========================================================================
3 Copyright (C) 1995 European Southern Observatory (ESO)
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the Free
17 Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
18 MA 02139, USA.
19
20 Corresponding concerning ESO-MIDAS should be addressed as follows:
21 Internet e-mail: [email protected]
22 Postal address: European Southern Observatory
23 Data Management Division
24 Karl-Schwarzschild-Strasse 2
25 D 85748 Garching bei Muenchen
26 GERMANY
27 ===========================================================================*/
28
29 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30 .TYPE Module
31 .NAME osfvms.c
32 .LANGUAGE C
33 .AUTHOR Francois Ochsenbein [IPG-ESO]
34 .CATEGORY VMS-Specific File Definitions for osa / osd / osf routines.
35 .ENVIRONMENT VAX / VMS
36 .COMMENTS Only VMS-specific code common to
37 osf / osa / osd routines.
38 This module keeps thearray of opened files.
39
40 .VERSION 1.0 08-Oct-1988
41 .VERSION 1.1 08-Jan-1990: Added parameters U (undefined)
42 .VERSION 1.2 08-Feb-1990: Check ^Z that describes the EOF
43 .VERSION 1.3 24-Aug-1990: Add more parameters to osfop function.
44 .VERSION 1.4 09-Dec-1991: Add no attribute to fixed length record files
45 ------------------------------------------------------------*/
46
47 #define DEBUG 0
48
49 #define _NFILE_ 32 /* Max. number of opened files */
50
51 #include <atype.h> /* Character classification */
52 #include <osdefos.h>
53 #include <osfile.h>
54 #include <macrogen.h>
55 #include <errno.h> /* System */
56 #include <iodef.h> /* System */
57 #include <ssdef.h> /* System */
58 # define dsc$w_length len /* Simplify names... */
59 # define dsc$a_pointer s
60 #include <descrip.h> /* System */
61 # define fab$l_fna name
62 # define fab$b_fns lname
63 # define fab$l_ctx file_no
64 # define TheSector(n) (n-1)
65 # define FileSector(n) (n+1)
66 #include <rms.h> /* System */
67 #include <ssdef.h> /* System */
68 #include <devdef.h> /* System */
69
70 MID_EXTERN int vmserror; /* VMS-specific error code */
71 MID_EXTERN int oserror;
72 MID_EXTERN char *oserrmsg;
73
74 /* Define Default File Organisation */
75 #define RECORD_LENGTH 512
76 #define OPEN_FMT FAB$C_STMLF
77 #define OPEN_ORG FAB$C_SEQ
78 #define OPEN_RAT FAB$M_CR
79 #define OPEN_BKS 0
80
81 #define FINISH goto FIN
82
83 struct IOSB { /* IO control Block */
84 unsigned short iostatus;
85 unsigned short length;
86 unsigned long info;
87 };
88 /* Define the default files */
89 static char *perm_files[3] = {"SYS$INPUT", "SYS$OUTPUT", "SYS$ERROR"};
90 static int perm_open[3] = {READ, WRITE, WRITE};
91
92 /* Define local structure prototypes */
93 static struct FAB fax, *fap;
94 static struct RAB rab;
95 static struct XABFHC fhc,*fhp; /* File Header Characteristics */
96 static struct XABPRO pro; /* Protections */
97 static struct XABRDT rdt; /* Revision Date & Time */
98 static struct NAM nam; /* Name block */
99
100 static struct IOSB iosb; /* The i/o status block */
101
102 /* Character descriptor */
103 static struct dsc$descriptor_s dev_des =
104 { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
105
106 /* Array of Opened Files */
107 static struct RAB *fp,
108 *Files[_NFILE_] = {0,0,0,0,0,0,0,0};
109 static int nf = 2;
110
111 /* Open Options (set by osfop) */
112 static unsigned short open_len = RECORD_LENGTH;
113 static char open_fmt = OPEN_FMT ;
114 static char open_org = OPEN_ORG ;
115 static char open_rat = OPEN_RAT ;
116 static char open_bks = OPEN_BKS ; /* Bucket Size */
117
118 char *osmmget();
119
120 /*======================================================================*/
121 int osfop(fmt, len)
122 /*++++++++
123 .PURPOSE Initializes the Format for the next Open / Create
124 .RETURNS 0 (understood) / -1 (wrong)
125 .REMARKS Only for VMS (useless in Unix context). Values are
126 => File organisation Q (sequential)/ Y (relative) / X (indexed) / H (hashed)
127 => Relative bucket size (Z)
128 => Record organisation U (undefined) / F (fixed) / V (variable) /
129 C (variable with control) / S (stream CR+LF) /
130 L (Stream-LF) / R (stream-CR)
131 => Record carriage 1 (Fortran) / 2 (CR) / 4 (print)
132 => Block span (8)
133 ------------------------------------------------------------*/
134 int fmt; /* IN : 'f' for Fixed, 'v' for Variable\
135 'u' for undefined, 't' for Text(PCs) */
136 int len; /* IN : Length of longest record */
137 {
138 switch(toupper(fmt)) {
139 case 'F':
140 open_rat = 0;
141 open_fmt = FAB$C_FIX; open_len = len; break; /* Fixed */
142 case 'V':
143 open_fmt = FAB$C_VAR; open_len = len; break; /* Variable */
144 case 'U':
145 open_fmt = FAB$C_UDF; open_len = len; break; /* Undefined */
146 case 'S': case 'T':
147 open_fmt = FAB$C_STM; open_len = len; break; /* Text CR+LF */
148 case 'L':
149 open_fmt = FAB$C_STMLF; open_len = len; break; /* Stream-LF */
150 case 'C':
151 open_fmt = FAB$C_VFC; open_len = len; break; /* var with ctrl*/
152 case 'R':
153 open_fmt = FAB$C_STMCR; open_len = len;break; /* stream-CR */
154
155 case 'Q':
156 open_org = FAB$C_SEQ; break; /* Sequential */
157 case 'Y':
158 open_org = FAB$C_REL; break; /* Relative */
159 case 'X':
160 open_org = FAB$C_IDX; break; /* Indexed */
161 case 'H':
162 open_org = FAB$C_HSH; break; /* Hashed */
163
164 case '1':
165 open_rat = FAB$M_FTN; break; /* Fortran CR */
166 case '2':
167 open_rat = FAB$M_CR; break; /* LF carriage */
168 case '4':
169 open_rat = FAB$M_PRN; break; /* Printfile CR */
170 case '8':
171 open_rat |= FAB$M_BLK; break; /* No block span*/
172
173 case 'Z':
174 open_bks = len; break; /* bucket size */
175
176 default: return(-1);
177 }
178
179 return(0) ;
180 }
181
182 /*======================================================================*/
183 struct RAB *vmsinit (phname)
184 /*++++++++
185 .PURPOSE Initializes one RMS structure, with what was specified in osfop
186 .RETURNS Pointer to filled RAB structure (which includes links to other)
187 ------------------------------------------------------------*/
188 char *phname; /* IN : physical filename */
189 {
190 vmserror = 0;
191
192 rab = cc$rms_rab;
193 fax = cc$rms_fab;
194 fhc = cc$rms_xabfhc;
195 rdt = cc$rms_xabrdt;
196 pro = cc$rms_xabpro;
197 nam = cc$rms_nam;
198
199 rab.rab$l_fab = &fax;
200 rab.rab$l_ctx = 0;
201
202 fax.fab$b_fac = FAB$M_BRO|FAB$M_PUT;
203 fax.fab$b_shr = FAB$M_NIL;
204 fax.fab$b_org = open_org;
205 fax.fab$b_rfm = open_fmt;
206 fax.fab$w_mrs = open_len;
207 fax.fab$b_rat = open_rat;
208 fax.fab$b_bks = open_bks;
209
210 fax.fab$l_nam = &nam; /* NAM block address */
211 fax.fab$l_xab = (char *)&fhc; /* File Header Characteristics */
212
213 fhc.xab$l_nxt = (char *)&pro; /* Next block = protection */
214
215 pro.xab$l_nxt = (char *)&rdt; /* Next block = date/time */
216
217 if (phname){ /* Add name of file */
218 fax.fab$b_fns = strlen(phname); /* sets length of file_name */
219 fax.fab$l_fna = phname;
220 }
221
222 open_len = RECORD_LENGTH; /* Reset variables to default */
223 open_fmt = FAB$C_STMLF;
224 open_org = OPEN_ORG ;
225 open_rat = OPEN_RAT ;
226 open_bks = OPEN_BKS ;
227
228 return(&rab);
229 }
230
231 /*======================================================================*/
232 static int vmsop1(phname, mode)
233 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
234 .PURPOSE Interface to $OPEN / $CREATE
235 The variable mode defines the way of opening the file as READ,
236 WRITE, READ_WRITE and APPEND. (see osfile.h).
237 Option NOATTR available.
238 .RETURNS Upon successful completion a file descriptor is returned. -1 is
239 returned on error.
240 .REMARKS The rab$l_ctx takes values -1 for QIO access
241 ------------------------------------------------------------*/
242 char *phname; /* IN : physical filename */
243 int mode; /* IN : open mode */
244 {
245 register int i;
246 register long pos;
247 register char *trname;
248
249 vmsinit(phname);
250
251 fax.fab$b_fac = FAB$M_GET | FAB$M_BRO;
252 fax.fab$b_shr = FAB$M_NIL;
253
254 i = 0; /* No creation */
255
256 switch (mode&3) {
257 case READ : /* open for read only */
258 fax.fab$b_shr = FAB$M_SHRGET;
259 break;
260 case WRITE : /* open for write only */
261 fax.fab$b_fac |= FAB$M_UPD|FAB$M_PUT|FAB$M_TRN;
262 /* fax.fab$l_fop |= FAB$M_CIF; */
263 fax.fab$l_fop |= FAB$M_TEF;
264 if(mode&NOATTR) fax.fab$b_rat = 0;
265 fax.fab$b_fsz = 2;
266 i = 1; /* CREATE utillity */
267 break;
268 case APPEND:
269 fax.fab$b_fac |= FAB$M_PUT|FAB$M_UPD;
270 rab.rab$l_rop |= RAB$M_EOF;
271 fax.fab$l_fop |= FAB$M_TEF;
272 break;
273 default:
274 fax.fab$b_fac |= FAB$M_UPD|FAB$M_PUT;
275 fax.fab$l_fop |= FAB$M_TEF;
276 break;
277 }
278
279 vmserror = i ? SYS$CREATE(&fax) : SYS$OPEN(&fax);
280 if (!(vmserror&1)) FINISH;
281
282 /* It's not a file when the file-id is zero in NAM block.
283 In this case, set rab$l_ctx to -1, which means that
284 logical QIO's must be used for access */
285
286 if ((nam.nam$w_fid[0] == 0) && (nam.nam$w_fid[1] == 0)) {
287 dev_des.len = nam.nam$t_dvi[0];
288 dev_des.s = &nam.nam$t_dvi[1];
289 vmserror = SYS$ASSIGN(&dev_des,&(rab.rab$w_isi),0,0);
290 rab.rab$l_ctx = 0xffffffff;
291 }
292
293 /* Find a free slot */
294 for (i=3; (i < _NFILE_) && (Files[i]); i++) {}
295 if (i >= _NFILE_) {
296 oserror = EMFILE; /* Too many opened files */
297 FINISH;
298 }
299 if (rab.rab$l_ctx != 0) FINISH; /* Device */
300
301 /* For non-sequential organisation, the only access provided
302 here is via QIOs.
303 If the file has such an organisation, close it,
304 reopen with option UFO which only allows QIO's
305 */
306
307
308 vmserror = SYS$CONNECT(&rab);
309 if (!(vmserror&1)) { oserror = EIO; FINISH; }
310
311 if ((mode&3) == APPEND){
312 pos = (fhc.xab$l_ebk-1)*fax.fab$w_bls;
313 if (pos%fax.fab$w_bls) (rab.rab$l_bkt)++;
314 *(long *)(rab.rab$w_rfa) = 1 + pos/fax.fab$w_bls;
315 rab.rab$w_rfa[2] = pos % fax.fab$w_bls;
316 }
317
318 FIN:
319 if (!(vmserror&1))
320 { oserror = ENOENT;
321 i = -1;
322 }
323 fax.file_no = i;
324 #if DEBUG
325 printf("Internal File Idenfier=%d\n", fax.fab$w_ifi);
326 printf("Status =%d\n", fax.fab$l_stv);
327 printf("Lst block =%d\n", fhc.xab$l_ebk);
328 printf("last byte in block =%d\n", fhc.xab$w_ffb);
329 printf("rfm=%d, rat=%d\n", fax.fab$b_rfm,fax.fab$b_rat);
330 printf("File Identifier is =%d\n", fax.file_no);
331 #endif
332
333 return(i);
334 }
335
336 /*==========================================================================*/
337 static struct RAB *falloc(name)
338 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
339 .PURPOSE Copy structures in newly allocated pieces of memory.
340 .RETURNS Address of allocated structures, NULL in case of error
341 .REMARKS For internal use only.
342 ------------------------------------------------------------*/
343 char *name; /* IN: Name of File */
344 {
345 register struct RAB *fp;
346 register char *p, *q;
347
348 fp = (struct RAB *)osmmget(sizeof(struct RAB) + sizeof(struct FAB)
349 + sizeof(fhc) + fax.lname + 1);
350 if (oserror) FINISH;
351 *fp = rab;
352 fap = (struct FAB *) (fp+1);
353 *fap = fax;
354 fhp = (struct XABFHC *) (fap+1);
355 *fhp = fhc;
356 fhp->xab$l_nxt = 0; /* No link to other extensions */
357 p = (char *) (fhp + 1);
358 fap->fab$l_fna = p; /* File Name */
359 fp->rab$l_fab = fap;
360 fap->fab$l_xab = (char *)fhp; /* File Header Characteristics */
361 fap->fab$l_nam = (struct NAM *)0; /* No NAM block address */
362
363 for (q = name; *q; ) *(p++) = *(q++);
364 *p = EOS;
365
366 FIN:
367 return(oserror ? NULL_PTR(struct RAB) : fp);
368 }
369
370 /*==========================================================================*/
371 struct RAB *vmsrab(fid)
372 /*++++++++
373 .PURPOSE Retrieve the "file pointer" from file identifier.
374 .RETURNS Upon successful completion the pointer.
375 Else , NULL is returned and the system error code is set into
376 oserror.
377 .REMARKS The permanent files (stdin, stdout, stderr) are implicitely opened.
378 For internal use only.
379 ------------------------------------------------------------*/
380 int fid; /* IN : file identifier */
381 {
382 register struct RAB *fp;
383
384 oserror = 0, vmserror = 0;
385
386 #if DEBUG
387 printf("vmsrab: File Number is: %d\n", fid);
388 #endif
389 if ( (fid < 0)||(fid > nf) ) { oserror = EBADF; FINISH; }
390 else if ( (Files[fid] == 0) && (fid < 3)) { /* Permanent Files */
391 if (vmsop1(perm_files[fid], perm_open[fid]) < 0) FINISH;
392 fax.file_no = fid;
393 fp = falloc(perm_files[fid]);
394 if (oserror) FINISH;
395 Files[fid] = fp;
396 }
397
398 fp = Files[fid];
399 if (!fp) oserror = EBADF;
400
401 FIN:
402 return ( oserror ? NULL_PTR(struct RAB) : fp );
403 }
404
405 /*======================================================================*/
406 int osfunix(phname)
407 /*++++++++
408 .PURPOSE Check if a file is Unix-compatible (STMLF)
409 .RETURNS 1 if STMLF format, 0 otherwise, -1 if error
410 .REMARKS
411 ------------------------------------------------------------*/
412 char *phname; /* IN : Name of the file */
413 {
414 int i;
415
416 vmsinit(phname);
417
418 fax.fab$b_fac = FAB$M_GET | FAB$M_BRO;
419 fax.fab$b_shr = FAB$M_SHRGET;
420
421 vmserror = SYS$OPEN(&fax);
422 if (!(vmserror&1)) FINISH;
423
424 vmserror = SYS$CONNECT(&rab);
425 if (!(vmserror&1)) FINISH;
426 i = (fax.fab$b_rfm == FAB$C_STMLF) && (fax.fab$b_org = FAB$C_SEQ);
427 SYS$CLOSE(&fax);
428
429 FIN:
430 if (!(vmserror&1)) oserror = ENOENT, i = -1;
431 return(i);
432 }
433
434 /*==========================================================================*/
435 int vmsopen(phname, mode)
436 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
437 .PURPOSE Opens RMS file for read or write. The variable mode
438 defines the way of opening the file as READ,
439 WRITE (the file is created),
440 READ_WRITE and APPEND. (see osfile.h).
441 SHARE option to be implemented ?
442 .RETURNS Upon successful completion a file descriptor is returned. -1 is
443 returned on error; oserror specifies the error.
444 .REMARKS Special case phname = -1 to reopen file in UFO mode.
445 ------------------------------------------------------------*/
446 char *phname; /* IN : physical filename */
447 int mode; /* IN : open mode */
448 {
449 register int i;
450
451 oserror = 0;
452 if (phname == (char *)(-1)) { /* Non-sequential file. Reopen */
453 SYS$CLOSE(&fax);
454 fax.fab$l_fop = FAB$M_NAM | FAB$M_UFO;
455 vmserror = SYS$OPEN(&fax);
456 if (!(vmserror&1)) { oserror = EIO; FINISH; }
457 i = fax.fab$l_stv; /* IO channel */
458 FINISH;
459 }
460 fp = 0;
461
462 i = vmsop1(phname, mode); /* Call system-dependent part */
463 if (i<0) FINISH;
464
465 nf = MAX(i, nf);
466 fp = falloc(phname); /* Copy file pointers to new area */
467
468 Files[i] = fp; /* Store in table the file pointer */
469
470 FIN:
471 #if DEBUG
472 printf("vmsopen %d: ", i);
473 if (fp) printf ("fab$w_bls=%d, rab$l_bkt=%d\n\n",
474 fap->fab$w_bls,fp->rab$l_bkt);
475 #endif
476 return(oserror ? -1 : i);
477 }
478
479 /*==========================================================================*/
480 int vmsclose(fid)
481 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
482 .PURPOSE Closes a disk file.
483 The argument fid is the file identification obtained from osbopen.
484 .RETURNS 0 (success) / -1 (failure)
485 ------------------------------------------------------------*/
486 int fid; /* IN : file identifier */
487 {
488
489 if (!(fp = vmsrab(fid))) FINISH;
490
491 if (fp->rab$l_ctx == 0xffffffff) /* Special Device */
492 vmserror = SYS$DASSGN(fp->rab$w_isi);
493 else vmserror = SYS$CLOSE(fp->rab$l_fab);
494
495 if (!(vmserror&1)) oserror = EIO;
496
497 osmmfree(Files[fid]);
498 Files[fid] = NULL_PTR(struct RAB);
499
500 FIN:
501 return(oserror ? -1 : 0);
502 }
503
504 /*======================================================================*/
505 long vmsize(fid)
506 /*++++++++++++++++++++++++++++
507 .PURPOSE Returns the size of an opened a file
508 .RETURNS Upon successful completion the total size in bytes (-1 on error)
509 .REMARKS
510 -------------------------------*/
511 int fid; /* IN : file identifier */
512 {
513 register long pos;
514
515 if (!(fp = vmsrab(fid))) FINISH;
516
517 fap = fp->rab$l_fab;
518 fhp = (struct XABFHC *) fap->fab$l_xab;
519
520 if ((fap->fab$b_org == FAB$C_SEQ) && (fap->fab$b_fac & FAB$M_PUT)) {
521 /* Update the File Header */
522 vmserror = SYS$FLUSH(fp);
523 if (!(vmserror&1)) oserror = EIO;
524 SYS$DISPLAY(fap); /* ... and retrieve it */
525 }
526 else vmserror = RMS$_NORMAL;
527
528 if (fhp->xab$l_ebk > 0)
529 pos = (fhp->xab$l_ebk-1)*fap->fab$w_bls + fhp->xab$w_ffb;
530 else pos = 0;
531
532 FIN:
533 return(oserror ? -1 : pos);
534 }
535
536 /*======================================================================*/
537 int vmsqio (chan, op, buffer, length, blkno)
538 /*+++++++++++++
539 .PURPOSE Interface to SYS$QIOW, with test of 2 returned codes
540 .RETURNS Length / -1 if error
541 .REMARK
542 --------------*/
543 int chan; /* IN: The channel for QIO */
544 int op; /* IN: The operation to perform */
545 char *buffer; /* OUT: Buffer address */
546 int length; /* IN: Buffer length */
547 int blkno; /* IN: Block number */
548 {
549 register int l;
550
551 oserror = 0;
552 iosb.iostatus = 0, iosb.length = 0;
553
554 vmserror = SYS$QIOW (0,chan,op,&iosb,0,0,buffer,length,blkno,0,0,0);
555 l = iosb.length;
556 if (!(vmserror & 1)) { oserror = EIO; FINISH;}
557
558 if (oserror == 0) {
559 switch(iosb.iostatus)
560 { case SS$_NORMAL:
561 break;
562
563 case SS$_DATAOVERUN: break;
564
565 case SS$_ENDOFVOLUME:
566 case SS$_ENDOFFILE: l = -1; break; /* No error */
567
568 case SS$_ENDOFTAPE: oserrmsg = "Physical End reached";
569 oserror = -1;
570 break;
571
572 default: oserror = EIO;
573 vmserror = iosb.iostatus;
574 break;
575 }
576 }
577 FIN:
578 return(oserror ? -1 : l);
579 }
580
581 /*======================================================================*/
582 int vmsrlb(channel, buffer, length)
583 /*+++++++++++++
584 .PURPOSE Interface to SYS$QIOW, reading a logical block
585 .RETURNS Bytes read over channel / -1 if error
586 .REMARK Test the ending ^Z on devices.
587 --------------*/
588 int channel; /* IN: Channel id */
589 char *buffer; /* OUT: Buffer to read */
590 int length; /* IN: Size of buffer */
591 {
592 int stat; /* Returned status */
593
594 buffer[0] = 0;
595 stat = vmsqio(channel, IO$_READLBLK, buffer, length, 0);
596
597 /* Check ^Z */
598 if ((stat == 0) && (buffer[0]) == 26) stat = -1;
599
600 return(stat);
601 }
602
603 #if 0 /* The following functions may just be skipped. */
604 /*======================================================================*/
605 int vmswlb(channel, buffer, length)
606 /*+++++++++++++
607 .PURPOSE Interface to SYS$QIOW, writing a logical block
608 .RETURNS Length / -1 if error
609 .REMARK
610 --------------*/
611 unsigned short channel; /* IN: Channel id */
612 char *buffer; /* IN: Buffer to write */
613 int length; /* IN: Number of bytes to write */
614 {
615 return(vmsqio(channel, IO$_WRITELBLK, buffer, length, 0));
616 }
617
618 /*======================================================================*/
619 int vmsrvb(channel, buffer, length)
620 /*+++++++++++++
621 .PURPOSE Interface to SYS$QIOW, reading a virtual block
622 .RETURNS Bytes read over channel / -1 if error
623 --------------*/
624 int channel; /* IN: Channel id */
625 char *buffer; /* OUT: Buffer to read */
626 int length; /* IN: Size of buffer */
627 {
628 return (vmsqio(channel, IO$_READVBLK, buffer, length, 0));
629 }
630
631 /*======================================================================*/
632 int vmswvb(channel, buffer, length)
633 /*+++++++++++++
634 .PURPOSE Interface to SYS$QIOW, writing a virtual block
635 .RETURNS Length / -1 if error
636 --------------*/
637 iont channel; /* IN: Channel id */
638 char *buffer; /* IN: Buffer to write */
639 int length; /* IN: Number of bytes to write */
640 {
641 return(vmsqio(channel, IO$_WRITEVBLK, buffer, length, 0));
642 }
643 #endif