Next: Getting values from the Noticeboard
Up: Examples of Using the NBS Routines
Previous: Finding the Noticeboard
We can now put values into primitive items.
INTEGER CONID ! CURRENT_CONFIG ID
INTEGER STAID ! CURRENT_STATUS ID
INTEGER FIBID ! FIBRE_PARAMETERS ID
INTEGER MATID ! COORD_MATRIX ID
CHARACTER STRING*(*) ! String to write to CURRENT_CONFIG
PARAMETER (STRING=`CURRENT.FIB')
INTEGER MATRIX(2,2) ! Matrix to write to COORD_MATRIX
DATA MATRIX /1,0,0,1/
Get the IDs for all the items we want to write to.
NBS_FIND_ITEM (TOPID,`CURRENT_CONFIG ',CONID,STATUS)
NBS_FIND_ITEM (TOPID,`CURRENT_STATUS ',STAID,STATUS)
NBS_FIND_ITEM (TOPID,`FIBRE_PARAMETERS',FIBID,STATUS)
NBS_FIND_ITEM (FIBID,`COORD_MATRIX ',MATID,STATUS)
Put values to some of them.
NBS_PUT_CVALUE (CONID,0,STRING,STATUS)
NBS_PUT_VALUE (MATID,0,16,MATRIX,STATUS)
NBS_PUT_VALUE (CONID,0,LEN(STRING),%REF(STRING),STATUS)
- Normally one would get IDs for the items of interest just after
finding the noticeboard. Finding an item involves a search and is relatively
slow, whereas putting and getting a value is very fast.
- The second parameter to NBS_PUT_VALUE and NBS_PUT_CVALUE
is a byte offset. You
can use non-zero offsets to put a slice of the data associated with an item.
The current size of an item's data is the high-water mark of all PUTs.
You can use NBS_PUT_SIZE explicitly to set the size of an item's data.
- Because the NBS routines don't use the type information, it is
necessary to pass all values by reference. In Fortran this is the default
passing mechanism for all variables except for character strings, hence the
routine NBS_PUT_CVALUE to handle this case.
- However, on VMS only the %REF function enables the
user to pass the actual character pointer to NBS_PUT_VALUE, and supply
the length of the character string (or indeed, any other number) as the
maximum number of bytes to be read.
- The noticeboard is now in the same state as in the listing at the start
of this section. If another process ran NBTRACE at this stage, it would get
precisely the same output.
Next: Getting values from the Noticeboard
Up: Examples of Using the NBS Routines
Previous: Finding the Noticeboard
NBS The Noticeboard System
Starlink User Note 77
D.J. Allan
11 September 1995
E-mail:ussc@star.rl.ac.uk