The Question is:
How i can perform analog of DCL command
in my C program, which must executed as
a detached process(i cannot use a system() call)?
Where i can found function description?
My problem is - i can't understand how to
modify FAB in easy way, because i think,
what file descriptor structure can be
accessed only for read.
The Answer is :
The stock file record format created by C routines is stream LF.
While system() and lib$spawn are not available to a detached process
lacking a CLI, a lib$creprc() creation of a subprocess running the
LOGINOUT image is permitted. (Please see the OpenVMS FAQ for some
The file-level record attributes are generally accessed via an
IO$_ACPCONTROL call, specifying the ATR and FAT item blocks. For
details on this API, please see the I/O User's Reference Manual.
In this particular case, the required ATR block would contain a
reference to ATR$C_RECATTR code which would reference a FAT block
where the FAT$V_RTYPE field contains FAT$C_STREAMLF.
The following example sets the DIRECTORY bit via the IO$C_MODIFY.
This involves using ATR$C_UCHAR rather than the ATR$C_RECATTR
code needed to access the FAT$C_STREAMLF field, but is otherwise
rather similar to what would need to be done to alter the record
.title SETDIRBIT fixes the DIRECTORY bit
; this program is used to turn on the "DIRECTORY" bit in the
; file header. The file (more correctly directory) to be
; reset is specified by FID (file identification) and device.
; (The FID can be retrieved from a DIRECTORY/FULL command.)
; a) Put the FID into the "fid" buffer, below.
; b) The device the FID is from must also be plugged into
; the "dev" descriptor, below.
; The UCHAR field is protected -- see the I/O Abuser's Guide,
; Part I, ACP/QIO Interface. (SYSTEM or OWNER access to the
; file (directory) is required.)
; 11-Apr-1988 Stephen Hoffman, DIGITAL Equipment Corp.
; This was written up... No claims to style or content:
; intended simply to solve a one-shot problem. MINIMAL
; error checking and user-hostile!
$atrdef ; File attribute definitions
$fchdef ; File characteristics
$fibdef ; File Information Block
$iodef ; I/O definitions
$ssdef ; System Service Definitions
fid: ; A file id (FID) looks like this: [NUM,SEQ,RVN]
.word 652 ; file NUM
.word 9 ; file SEQ
.word 0 ; file RVN
.word 0 ; (so we can use a MOVQ)
dev: ; And the name of the disk the file id is from...
iosb: .blkw 4 ; garden variety IOSB
fchan: .blkw 1 ; channel to the disk
FIBSIZE=22 ; use the short FIB
fibbuf: .blkb FIBSIZE ; here's the FIB itself
fib: .long FIBSIZE ; here's the FIB descriptor
uchar: .blkb ATR$S_UCHAR ; the FAT characteristics buffer
fat: ; The File Attributes itemlist follows:
.word ATR$S_UCHAR ; length of the buffer
.word ATR$C_UCHAR ; address of the buffer
.address uchar ; where the UCHAR field is...
.blkq 0 ; zero marks the end...
.entry SETDIRBIT, ^M<R2>
; Get a channel to the device
; Move the two important "bits" of trivia out to the FIB.
; Access the file (directory)
; Force the DIRECTORY bit on!
; Write the modified characteristics out...
; And deaccess the file (directory)
; Deassign the channel to the disk
; And bail out...