SPI Programming Manual (G06.24+, H06.03+, J06.03+)

General SPI Programming Guidelines
SPI Programming Manual427506-006
5-34
Checking Tokens in the Command
go to send^reply
end case
end do
! Check that all the required tokens were supplied.
if count[subsys^TNM^REQUIRED1] = 0 then
reject(subsys^TKN^REQUIRED1,0,
subsys^ERR^REQUIRED^MISSING)
go to send^reply
end
if count[subsys^TNM^REQUIRED2] = 0 then
reject(subsys^MAP^REQUIRED2^V,0,
subsys^ERR^REQUIRED^MISSING)
go to send^reply
end
(Repeat for each required token.)
! do inter-field value and presence checks, if any
if required1^value = x and count[subsys^TNM^TOKEN2] = 0 then
begin
reject(subsys^MAP^TOKEN2^V,0,
subsys^ERR^OPTIONAL^MISSING)
go to send^reply
end
if count[subsys^TNM^TOKEN1] <> 0 and
count[subsys^TNM^TOKEN3] <> 0 then
begin
reject(subsys^TKN^TOKEN3,1,
subsys^ERR^CONFLICTING^TOKENS)
go to send^reply
end
if token1^value[3] > max^token1^value then
begin
reject(subsys^TKN^TOKEN1,3,subsys^ERR^BAD^VALUE)
go to send^reply
end
(Include as many tests of whatever form as are needed.)
(Execute the command using the values obtained above.)
REJECT: Inserts RETCODE and error list into response buffer
to report missing or incorrect token in command
proc reject(tokencode,index,errcode,ssid) variable
int(32) .tokencode
int index