beautypg.com

Reading counter records from a data file – HP NonStop G-Series User Manual

Page 126

background image

Creating a Custom Measurement Application

Measure User’s Guide 520560-003

6- 14

Reading Counter Records From a Data File

The Measure Reference Manual shows the counter record format for each entity
type using DDL RECORD statements. To create a source file containing TAL
template structures for each record, use this DDL command:

DDL /IN MEASDDLS/TAL filename, TALBOUND 0

where MEASDDLS is the DDL source file provided with Measure and

filename

is

the TAL output file.

The first field in a counter record is an error field. If this field is nonzero, counter
space could not be allocated for the entity, and thus valid information cannot be
returned in the counter value fields. The entire counter record is still returned, with
valid information in the measurement and entity identification fields. For
descriptions of the possible error values for each entity type, see the Measure
Reference Manual
.

Reading Counter Records From a Data File

To retrieve records from a data file:

1. If you have not obtained read access to the data file, call MEASOPEN to do so. Do

not specify write access on this call. Doing so deletes the data in the file.

2. Call MEASREAD or MEASREAD_DIFF_ and pass it the entity descriptor and the

size and location of the buffer to receive the returned records.

3. Check the

bytesret

parameter returned by MEASREAD or MEASREAD_DIFF_.

If it is zero, the procedure could not find a record meeting the specifications.

Check the

firstcall

parameter returned by the MEASREAD or MEASREAD_DIFF_

procedure. If the specified buffer is too small to hold all the counter records, the
procedure returns as many complete records as it can and returns a nonzero value in

firstcall

. To read the remaining records, call the read procedure again and pass it

the value returned in

firstcall

. Continue calling the read procedure until it returns a

zero in

firstcall

, indicating that all records have been read.

To access a remote data file, use the

measfh

parameter of the MEASOPEN procedure

to start a MEASFH process on the remote system. The MEASFH process must run on
the same system that contains either MEASCOM or the data file. If you used the
optional MEASOPEN SWAPVOL parameter to specify an alternate volume for
MEASFH swap files, the volume you specified must belong to the system on which
MEASFH is running.

You can allocate space in an extended segment for the counter records and specify a
buffer size as large as 32000 bytes (the maximum data transfer permitted by the file
system) in a MEASREAD or MEASREAD_DIFF_ call. However, the read procedure
might have more than 32000 bytes to return. If so, the procedure returns a nonzero
value in

firstcall

, and you must continue to call MEASREAD or

MEASREAD_DIFF_ until it returns a zero in

firstcall

. Each time you call the read

procedure, specify a buffer size equal to 32000 or the space remaining in the extended
segment, whichever is smaller.