DASUDI ( DAS, update data, integer )
SUBROUTINE DASUDI ( HANDLE, FIRST, LAST, DATA )
Update data in a specified range of integer addresses in a DAS
file.
DAS
ARRAY
ASSIGNMENT
DAS
FILES
INTEGER HANDLE
INTEGER FIRST
INTEGER LAST
INTEGER DATA ( * )
Variable I/O Description
-------- --- --------------------------------------------------
HANDLE I DAS file handle.
FIRST,
LAST I Range of integer addresses to write to.
DATA I An array of integers.
HANDLE is a file handle of a DAS file opened for writing.
FIRST,
LAST are the first and last of a range of DAS logical
addresses of integers. These addresses satisfy the
inequality
1 < FIRST < LAST < LASTI
_ - -
where LASTI is the last integer logical address in
use in the DAS file designated by HANDLE.
DATA is an array of integers. The array elements
DATA(1) through DATA(N) will be written to the
indicated DAS file, where N is LAST - FIRST + 1.
See $Particulars for a description of the effect of this routine.
None.
1) If the input file handle is invalid, the error will be
diagnosed by routines called by this routine.
2) Only logical addresses that already contain data may be
updated: if either FIRST or LAST are outside the range
[ 1, LASTI ]
where LASTI is the last integer logical address that
currently contains data in the indicated DAS file, the error
SPICE(INVALIDADDRESS) is signalled. The DAS file will not be
modified.
3) If FIRST > LAST but both addresses are valid, this routine
will not modify the indicated DAS file. No error will be
signalled.
4) If an I/O error occurs during the data update attempted
by this routine, the error will be diagnosed by routines
called by this routine. FIRST and LAST will not be modified.
See the description of the argument HANDLE in $Detailed_Input.
This routine replaces the integer data in the specified range of
logical addresses within a DAS file with the contents of the
input array DATA.
The actual physical write operations that update the indicated
DAS file with the contents of the input array DATA may not take
place before this routine returns, since the DAS system buffers
data that is written as well as data that is read. In any case,
the data will be flushed to the file at the time the file is
closed, if not earlier. A physical write of all buffered
records can be forced by calling the SPICELIB routine DASWUR
( DAS, write updated records ).
In order to append integer data to a DAS file, filling in a range
of integer logical addresses that starts immediately after the
last integer logical address currently in use, the SPICELIB
routine DASADI ( DAS add data, integer ) should be used.
1) Write to addresses 1 through 500 in a DAS file in
random-access fashion by updating the file. Recall
that data must be present in the file before it can
be updated.
PROGRAM UP
CHARACTER*(4) TYPE
INTEGER DATA ( 500 )
INTEGER HANDLE
INTEGER I
C
C Open the new DAS file RAND.DAS. Use the file name
C as the internal file name.
C
TYPE = 'TEST'
CALL DASONW ( 'TEST.DAS', TYPE, 'TEST.DAS', HANDLE )
C
C Append 500 integers to the file; after the data is
C present, we're free to update it in any order we
C please. (CLEARI zeros out an integer array.)
C
CALL CLEARI ( 500, DATA )
CALL DASADI ( HANDLE, 500, DATA )
C
C Now the integer logical addresses 1:500 can be
C written to in random-access fashion. We'll fill them
C in in reverse order.
C
DO I = 500, 1, -1
CALL DASUDI ( HANDLE, I, I, I )
END DO
C
C Close the file.
C
CALL DASCLS ( HANDLE )
C
C Now make sure that we updated the file properly.
C Open the file for reading and dump the contents
C of the integer logical addresses 1:500.
C
CALL DASOPR ( 'RAND.DAS', HANDLE )
CALL CLEARI ( 500, DATA )
CALL DASRDI ( HANDLE, 1, 500, DATA )
WRITE (*,*) 'Contents of RAND.DAS:'
WRITE (*,*) ' '
WRITE (*,*) DATA
END
None.
None.
K.R. Gehringer (JPL)
N.J. Bachman (JPL)
W.L. Taber (JPL)
SPICELIB Version 1.1.1 19-DEC-1995 (NJB)
Corrected title of permuted index entry section.
SPICELIB Version 1.1.0, 12-MAY-1994 (KRG) (NJB)
Test of FAILED() added to loop termination conditions.
Removed references to specific DAS file open routines in the
$ Detailed_Input section of the header. This was done in order
to minimize documentation changes if the DAS open routines ever
change.
Modified the $ Examples section to demonstrate the new ID word
format which includes a file type and to include a call to the
new routine DASONW, open new for write, which makes use of the
file type. Also, a variable for the type of the file to be
created was added.
SPICELIB Version 1.0.0, 11-NOV-1992 (NJB) (WLT)
|