PARSEMESSAGE

Parses a message body that has been received.
Supports: MQSeries, MQSeries C, MSMQ, Rendezvous, Rendezvous-CM

Syntax

CALL PARSEMESSAGE(qid, cursor, rc, map, data);

Required Arguments

qid
Numeric, input
Specifies the handle of an open queue that is obtained from a previous OPENQUEUE function call.
cursor
Numeric, input or output
Sets the cursor to zero in order to parse from the beginning. Upon return, the cursor is positioned at the next data location, according to the specified map.
rc
Numeric, output
Provides the return code from the CALL routine. If an error occurs, then the return code is nonzero. You can use the SAS function SYSMSG() in order to obtain a textual description of the return code.
map
Character, input
Specifies the map data descriptor that is defined by a previous SETMAP function call.
data
Character or numeric, output
Identifies the data to be parsed from the internal receive buffer.

Example

The following example parses a message:
length msg $ 200;
length qid rc attchflg 8 event $ 10;
length msgtype 8 corrid $ 48 map $ 80;
length employee $ 20 id 8;
rc=0;
map='employeerecord';
/* data descriptor defined in repository...
ie., "char,,20;double" */
cursor=0;
call parsemessage(qid, cursor, rc, map, employee, id);
if rc ^= 0 then do;
  put 'PARSEMESSAGE: failed';
  msg = sysmsg();
  put msg;
end;
else do;
  put 'PARSEMESSAGE: succeeded';
  put 'employee = ' employee;
  put 'id = ' id;
end;