Posted: Tue May 30, 2006 12:31 pm Post subject: Invalid MQMD from procedure using REFERENCE
Novice
Joined: 05 Nov 2003 Posts: 17 Location: Work
I am receiving BIP2618 Invalid MQMD errors when I try to create a basic MQMD with a common procedure.
I am not sure why the MQMD is invalid.
Here is the relevant code (hopefully)
Code:
/******************************************/
CREATE COMPUTE MODULE FLOW_CS_MBFE_F2M_MAIN
/******************************************/
--------------------------------------
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
...
-- Log that a file was received
CALL LogFileReceived();
...
RETURN FALSE;
END; ---- Main()
---------------------------------------------------------------------------------
CREATE PROCEDURE LogFileReceived()
---------------------------------------------------------------------------------
BEGIN
DECLARE RefRoot REFERENCE TO OutputRoot;
SET OutputRoot.Properties.ReplyIdentifier = MQCI_NONE; -- No correlation identifier specified.
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
CALL CreateBaseMQMD(RefRoot);
SET OutputRoot.XMLNS.CSLogging.InterfaceID = flowName;
SET OutputRoot.XMLNS.CSLogging.IOFlag = 'I';
SET OutputRoot.XMLNS.CSLogging.RunTimestamp = CURRENT_TIMESTAMP;
SET OutputRoot.XMLNS.CSLogging.MQMsgID = X'000000000000000000000000000000000000000000000000';
SET OutputRoot.XMLNS.CSLogging.MQCorrelID = X'000000000000000000000000000000000000000000000000';
IF cntlDataExists THEN
SET OutputRoot.XMLNS.CSLogging.ApplKey = 'FILE RECEIVED FOR ' || logProjectName;
ELSE
SET OutputRoot.XMLNS.CSLogging.ApplKey = 'UNKNOWN FILE RECEIVED';
END IF;
SET OutputRoot.XMLNS.CSLogging.MsgData = 'FILE ID = ' || inputFileId;
SET OutputLocalEnvironment.Destination.RouterList.DestinationData.labelName ='LOG_IN_FILE';
PROPAGATE; -- Send message to FLOW_CS_LOG to log file received
END; ---- LogFileReceived()
END MODULE;
/**************************************************************************************************
COMMON PROCEDURES AND FUNCTIONS
**************************************************************************************************/
-----------------------------------------------------------------------------------------------
CREATE PROCEDURE CreateBaseMQMD(IN ProcRef REFERENCE)
-----------------------------------------------------------------------------------------------
BEGIN
SET ProcRef.MQMD.Version = MQMD_CURRENT_VERSION; -- Current version of MQMD structure.
SET ProcRef.MQMD.StrucID = MQMD_STRUC_ID; -- Default identifier for message descriptor structure.
SET ProcRef.MQMD.Format = 'MQSTR';
SET ProcRef.MQMD.Expiry = -1; -- Non-expiring
SET ProcRef.MQMD.MsgId = MQMI_NONE; -- Generate a new MsgId for the message
Here is some additional information. When I have the ESQL inside the module the process of creating the MQMD works OK.
Code:
CREATE PROCEDURE CreateBaseMQMD()
BEGIN
SET OutputRoot.Properties.ReplyIdentifier = MQCI_NONE;
SET OutputRoot.MQMD.Version = MQMD_CURRENT_VERSION;
SET OutputRoot.MQMD.StrucID = MQMD_STRUC_ID;
SET OutputRoot.MQMD.Format = 'MQSTR';
SET OutputRoot.MQMD.Expiry = -1;
SET OutputRoot.MQMD.MsgId = MQMI_NONE;
END;
Stepping through the code with the debugger and watching the MQMD being created does not indicate anything different between the 2 approaches. But when I look at the Trace Node output I notice that the message that is successful is slightly different:
Properties.ExpirationTime and MQMD.CorrelId have values when they do not in the message that fails.
I am wondering whether I have something wrong in the combination of REFERENCE to OutputRoot.MQMD and the PROPAGATE that results in the messages being different.
This is because a REFERENCE to OutputRoot is not the same as OutputRoot itself. To be specific, a ref to OR will not create a parser, but OR itself will. You need to use CREATE FIELD with a DOMAIN of MQMD if you are using a reference to ensure a parser is created. For more info search this forum for a post by me ages ago that talks about this problem in a lot more detail.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum