Author |
Message
|
PEPERO |
Posted: Thu Sep 20, 2012 3:33 am Post subject: Null default value When defining a local Element |
|
|
Disciple
Joined: 30 May 2011 Posts: 177
|
What should be determine when defining a Null default value for a simple local element under the Value frame of the Default text box in the properties tab of an element? I have checked the Nillable check box , but when running , the Parser throws an exception showing there is no default value for an unspecified element.I've tried '\0' , '', NULL, NUL ... |
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 20, 2012 5:06 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
How can you have a NULL with a default value? Either the element is NULL or it has a value. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
wbi_telecom |
Posted: Thu Sep 20, 2012 5:12 am Post subject: |
|
|
 Disciple
Joined: 15 Feb 2006 Posts: 188 Location: Harrisburg, PA
|
At your message set level, check what your output setting is for missing elements. If you want your NULL setting to take place, Policy for missing Elements should be set to "UseNullValue". By default its set to UseDefaultValue.
Cheers, |
|
Back to top |
|
 |
PEPERO |
Posted: Thu Sep 20, 2012 5:24 am Post subject: |
|
|
Disciple
Joined: 30 May 2011 Posts: 177
|
I'm making a message with the mqcih , brmq vector and brmq send/receive headers. I've defined a message model to have the headers within it. I've to set some values of the related header fields at run time and left the others as their default values would be. Then i've to serialize the message and send it to the host. I want to set the default values for the MQCIH related fields and since some of their default values are NULL values, i've gotten into trouble. |
|
Back to top |
|
 |
PEPERO |
Posted: Thu Sep 20, 2012 5:36 am Post subject: |
|
|
Disciple
Joined: 30 May 2011 Posts: 177
|
Quote: |
At your message set level, check what your output setting is for missing elements. If you want your NULL setting to take place, Policy for missing Elements should be set to "UseNullValue". By default its set to UseDefaultValue.
|
I've seen it before but some of the missing elements have the default value of NULL not all of them. |
|
Back to top |
|
 |
NealM |
Posted: Thu Sep 20, 2012 7:43 am Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Are you sure you are interpreting the meaning of null correctly on the MQCIH? Here is a trace of one:
Code: |
(0x01000000:Name ):MQCIH = ( ['MQCICS' : 0x90c94a10]
(0x03000000:NameValue):Version = 2 (INTEGER)
(0x03000000:NameValue):Format = 'MQSTR ' (CHARACTER)
(0x03000000:NameValue):Encoding = 785 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 1047 (INTEGER)
(0x03000000:NameValue):Flags = 3 (INTEGER)
(0x03000000:NameValue):ReturnCode = 0 (INTEGER)
(0x03000000:NameValue):CompCode = 0 (INTEGER)
(0x03000000:NameValue):Reason = 0 (INTEGER)
(0x03000000:NameValue):UOWControl = 273 (INTEGER)
(0x03000000:NameValue):GetWaitInterval = -2 (INTEGER)
(0x03000000:NameValue):LinkType = 1 (INTEGER)
(0x03000000:NameValue):OutputDataLength = 27120 (INTEGER)
(0x03000000:NameValue):FacilityKeepTime = 0 (INTEGER)
(0x03000000:NameValue):ADSDescriptor = 0 (INTEGER)
(0x03000000:NameValue):ConversationalTask = 0 (INTEGER)
(0x03000000:NameValue):TaskEndStatus = 0 (INTEGER)
(0x03000000:NameValue):Facility = X'0000000000000000' (BLOB)
(0x03000000:NameValue):Function = 'PUT ' (CHARACTER)
(0x03000000:NameValue):AbendCode = ' ' (CHARACTER)
(0x03000000:NameValue):Authenticator = '********' (CHARACTER)
(0x03000000:NameValue):Reserved1 = ' ' (CHARACTER)
(0x03000000:NameValue):ReplyToFormat = ' ' (CHARACTER)
(0x03000000:NameValue):RemoteSysId = ' ' (CHARACTER)
(0x03000000:NameValue):RemoteTransId = ' ' (CHARACTER)
(0x03000000:NameValue):TransactionId = ' ' (CHARACTER)
(0x03000000:NameValue):FacilityLike = ' ' (CHARACTER)
(0x03000000:NameValue):AttentionId = ' ' (CHARACTER)
(0x03000000:NameValue):StartCode = ' ' (CHARACTER)
(0x03000000:NameValue):CancelCode = ' ' (CHARACTER)
(0x03000000:NameValue):NextTransactionId = ' ' (CHARACTER)
(0x03000000:NameValue):Reserved2 = ' ' (CHARACTER)
(0x03000000:NameValue):Reserved3 = ' ' (CHARACTER)
(0x03000000:NameValue):CursorPosition = 0 (INTEGER)
(0x03000000:NameValue):ErrorOffset = 0 (INTEGER)
(0x03000000:NameValue):InputItem = 0 (INTEGER)
(0x03000000:NameValue):Reserved4 = 0 (INTEGER)
|
I'm pretty sure the MQCIH is fixed length, so there can be no true null, just a default null value (of zero or blanks, depending). So if you attempt to serialize with a true null, I would expect a failure.
PS., use the above as a guide to setting your "nulls". |
|
Back to top |
|
 |
NealM |
Posted: Thu Sep 20, 2012 8:12 am Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
By the way, we use mapping nodes a lot (never for the headers though, sorry). One big difference between ESQL and Mapping is that it appears that when you code in ESQL, the null values are filled in, but when you use the (pre-MB8) Mapping Node, you have to map a value into every field or expect the serializing to fail. I don't really know if it has anything to do with using a message set or not. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 21, 2012 12:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
@NealM: You are confusing transformation with parsing. The MRM parser ( or any other parser ) will write whatever message tree you give to it. It does not know or care how that message tree was built. If you saw different MRM outputs when using the Mapping node it is because the Mapping node was building a different message tree.
@PEPERO: The term 'NULL value' means different things to different people.
- In WMB NULL is a special value that can be assigned to any syntax element in the message tree.
- In XML Schema, 'nil' is a special value that can be assigned to any element, regardless of its type. But only if the element is 'nillable'. XMLNSC and MRM both use NULL to represent a nil value in the message tree.
With those points cleared up, we can talk about how to output the data format that you need. The MRM parser works like this:
- when writing a fixed-length structure, any fields that are missing from the message tree are assigned their XML Schema default value. That value is then written as if it had been in the message tree.
- if any field in the message tree has the value NULL, and the element is declared as 'nillable' then the MRM parser will write its 'null representation'. This is not the same as the normal representation of the element. ( @NealM : please note that MRM will not necessarily throw an error if you try to write a field with a NULL value ).
From your description, I don't think you need to use NULL values at all. You need to set the default value and then use the padding options provided by the MRM parser to fill out the rest of the field. |
|
Back to top |
|
 |
NealM |
Posted: Fri Sep 21, 2012 6:34 am Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
kimbert, not to disagree since you obviously know more about the inner workings of the parsers than I, but here is a situation for you to consider.
1. I can build an MQMD or MQCIH header in ESQL just by using their parsers and filling in only the values that I want to be different than the default (usually "nulls" of 0's or blanks depending on field type). As you mention, the parser takes care of all the rest, witness my MQCIH trace above wherein I only filled in about 6 fields.
2. If I create a COBOL Copybook based MRM message definition using the wizard, specifying Source platform = z/OS, Create default values from INITIAL VALUEs, and Create null values for all fields (and padding = SPACE),
the same is true for building data in ESQL, and used to be true for using the Mapping Node in v6.0. HOWEVER, when we went to v6.1, you could no longer check the "Create default values from INITIAL VALUEs" box on the wizard if you were using a Mapping Node, as it would generate a ton of errors in the Mapping Node ("Unable to find local element xxx in global group yyy in message set zzz"). So that box has to be unchecked. And now, every field in the (copybook) MRM needs to have a 0 or blank mapped into it in the Mapping Node or the serializer will fail with a (runtime) wrong length error at the MQOutput node that follows. And most of our request copybooks are fixed length. Try it.
Note, I haven't yet experimented with the new MB8 Mapping Node, so cannot comment on its behavior. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 21, 2012 6:43 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
That makes a lot more sense, and is a lot less likely to confuse the readers of this thread. So
- the MQMD/MQCIH domains perform defaulting automatically.
- the MRM can perform defaulting too, but...
- you found a defect in the v6/v7 Mapping node that prevented you from exploiting the MRM defaulting features without lots of manual editing of your message definitions.
I would be quite surprised if the v8 Mapping node suffers from the same problem. |
|
Back to top |
|
 |
NealM |
Posted: Fri Sep 21, 2012 6:53 am Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Quote: |
you found a defect in the v6/v7 Mapping node |
At the time (2009) we were so busy migrating from v6.0 to v6.1 that when we ran into the MRM issue and an easy solution, we just figured it was how the Mapping Node worked in v6.1. It seemed too grossly visible a problem to have been overlooked by Toronto/Hursley. Also, we have worked our way now over the years to v6.1.0.10, and it still has the same issue (I just tried it), so I am surprised that no PMRs have ever been posted by anyone on the subject.
Quote: |
I would be quite surprised if the v8 Mapping node suffers from the same problem. |
I will be sure to test for it soon. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Sep 21, 2012 9:24 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
At the time I raised a request to have V7 message set cobol import behave like v6.0 in regards to null, default and 88 level as enum... The response was it will be fixed in V8. Happy checking  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|