ASAP 2.7 Extension Manual

Implementing the ASAP Extension in an Application
HP NonStop ASAP Extension Manual425265-004
4-13
Updating DataItems
int error
;
string domain^name[0:26] !27 bytes
;
domain^name ‘:=’ “ “ & domain^name for 26; !load domain
domain^name ‘:=’ my^domain^name for name^len;
if (error := ASAP_REMOVE_ ( seg^offset
,!error^detail!
,!segment^id!
,!flags! ))<> 0 then begin
call write(ems^collector,error^message…..
end;
Example 2 – Application Uses Its Own Extended Data Segment
int(32) seg^offset;
int error ,segment^id;
string domain^name[0:26]; !27 bytes
segment^id := 1; !set segment id
domain^name ‘:=’ “ “ & domain^name for 26; !load domain
domain^name‘:=’ my^domain^name for name^len;
if (error := ASAP_REMOVE_ ( seg^offset
,!error^detail!
,segment^id
)) <> 0 then begin
call write(ems^collector,error^message…..
end;
Updating DataItems
Applications make a procedure call to update any DataItem or set of DataItems. The
applications must:
Supply the global memory address passed back from the registration procedure
Indicate the DataItem or DataItems they want to update
Supply the value or values to use in the operation
Indicate the math operation or operations to use
Applications also need to handle errors returned from the update procedures. In some
cases, the applications need to remove the domain registration and reregister it. In
other cases, the applications might be forced to stop updating DataItems altogether.
Checksum Processing
The update, opstate, and control procedures maintain a simple 16-bit checksum. The
checksum is updated after each data update and is validated before any update is
applied. If the checksum match fails, no updates are performed, and error –4 (memory
corrupted error) is returned to the caller. This error means that shared memory location