Procedure 10

Write Spectrum

capability

 

pathname length

 

pathname

 

array number

offset

count

base1

base2

:

base8

range1

range2

:

range8

arraytype

data length

 

data

 

REQUEST

If the access capability is valid and the spectrum defined by pathname exists then the supplied data is written to the spectrum.
The fields are as defined in the document EDOC061. Undefined fields should be set to -1 or all one bits.
The elements of the arrays base, range, and size defined must be consistent with the dimension of the spectrum.
Use array number = 1 to access the spectrum and = 2 to access the error spectrum.
The data to be written is supplied in the array data and arraytype defines the format of each data item in this array.

The arrays base and range define a region of counts within the spectrum to be written and the counts may then be considered to form a sequence of data items of size determined by arraytype. count counts are written starting at offset data items into the defined region. The first data item is at offset zero. Type conversion takes place if arraytype differs from the type of the spectrum array being written.

The least significant 8 bits of arraytype defines the format of the data items as defined in EDOC061. The next bit (bit 8 - where bit 0 is the least significant bit and bit 31 is the most significant bit) of arraytype is used as a data format bit to indicate the format of the data.

0

data is big endian (i.e. Sparc)

1

data is little endian (i.e. Intel x86)

data format bit

success = 0

flag

RESPONSE - success

flag will normally be set to zero but will be set to -1 (all 1 bits) if truncation/overflow occurred while converting the data between the type supplied and the type defined for the data array.

procedure status

RESPONSE - failure

procedure status which is non zero indicates the cause of the failure.

3

invalid capability

4

invalid pathname

5

invalid parameter value

6

pathname not a spectrum

procedure status

XDR Specification

procedure   WriteSpectrum (cap, path, number, offset, count, bse, rng, type, data)
                 returns(reply)
            capability   cap;
            pathname   path;
            unsigned   number;
            unsigned   offset;
            unsigned   count;
            base   bse;
            range   rng;
            arraytype   type;
            string   data <>;

            union switch (stat status)  {
                OK:
                unsigned   flag;
                default:
                struct   {}
            }  reply;

Implementation

Spectra data may exist with the data in either big endian format (that is as used by SunMicrosystems Sparc and Motorola processors) or in little endian format (as used by Intel processors of the x86 family and Digital). Data is passed from the client to the server as an opaque data stream for reasons of efficiency and thus the format of the data must be supplied by the client to the server.
The server will convert the supplied data to the format implied by the existing spectrum header before writing to the spectrum.
All other information based between the server and client (including the data format bit in the arraytype field) will be handled by the XDR encodeing and hence will not appear dependent on processor architecture.
See also corresponding handling in the Read Spectrum and Create Spectrum procedures.