Author |
Message
|
TonyD |
Posted: Thu Nov 27, 2003 7:51 pm Post subject: Trailing blanks in fixed-length MRM field question |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
I have an incoming message that is mapped to a Cobol copybook definition. It includes a Street Name field that is defined as 40 bytes, left-justified with 'space' as the padding character. I want to locate the end of the name, using the 'POSITION' function to find the first space.
The test however returns a result of '0', i.e. no space found in the field. When I view a trace I see:
Code: |
(0x0300000B):SP_AD_INDICATOR_2 = ''
(0x0300000B):SP_AD_NUMBER_2 = ''
(0x0300000B):SP_AD_STREET_NO = '13'
(0x0300000B):SP_AD_STREET_NAME = 'BOOTH'
(0x0300000B):SP_AD_STREET_TYPE = 'CL'
(0x0300000B):SP_AD_STREET_DIR = ''
|
The spaces are not displayed. Fields that are blank, e.g. SP_AD_NUMBER_2 which has fixed length of 8, are represented as null. This is in contrast to fields in the MQMD, for example:
Code: |
(0x03000000):ReplyToQMgr = 'DMQ1 '
(0x03000000):UserIdentifier = 'projct09 '
|
where trailing blanks are shown within the quotes.
What should I change in my message definition, created by importing the Cobol copybook, to ensure that the entire field, including trailing blanks, is retained?
I am using WBIMB 5, CSD01. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Nov 28, 2003 2:40 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Go to the CFW physical format properties for element 'SP_AD_STREET_NAME' and set 'String Justification' to 'Not Applicable'. Make sure that the padding character is set to <SPACE>, but it probably is...otherwise it would not be trimming the input in the way you describe. |
|
Back to top |
|
 |
kirani |
Posted: Fri Nov 28, 2003 11:07 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Try setting the Padding to "NULL" for this element. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
TonyD |
Posted: Sun Nov 30, 2003 2:26 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Kimbert. I did as you suggested, retaining 'space' as the pad character, and it worked the way I was seeking:
Code: |
(0x0300000B):SP_AD_INDICATOR_2 = ' '
(0x0300000B):SP_AD_NUMBER_2 = ' '
(0x0300000B):SP_AD_STREET_NO = '13'
(0x0300000B):SP_AD_STREET_NAME = 'BOOTH '
|
...many thanks....however now I am confused! What is the explanation for this? Left justification is the default for 'PIC (X)', and was generated as I would have expected when the copybook was imported. The Help gives no indication that a 'Not Applicable' setting has a particular significance. How did you know about this??!! |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 01, 2003 2:04 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The 'Justification' property describes how the logical value of the string is parsed or written. It therefore affects trimming (when the message is parsed), and justification (when the message is written). In your case, the value was being trimmed, but you did not want it to be, so the solution was to set 'Justification' to 'Not Applicable'.
Maybe 'Not Applicable' would be better worded as 'No Justification'. The help could certainly be improved in this area. |
|
Back to top |
|
 |
TonyD |
Posted: Mon Dec 01, 2003 2:22 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Kimbert, thanks for comment. I must say that I am surprised at this. I have always thought that specification of Left (alphanumeric) or Right (numeric) justification, together with the appropriate pad character, would cause a fixed length field to be fully populated. I have never considered 'justification' to be associated with' trimming'. You are obviously correct as your suggestion worked ...I still find it strange however!! |
|
Back to top |
|
 |
kirani |
Posted: Mon Dec 01, 2003 11:29 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
TonyD, so finally what is your Padding set to for this element? I'm pretty sure that the behavior you are seeing is controlled by Padding Char. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
TonyD |
Posted: Tue Dec 02, 2003 2:10 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
I have 'space' as the pad character. Before starting the thread I had experimented with 'null' but it did not make a difference.
My confusion is further compunded by the fact that in an output MRM message, also based on an imported Cobol copybook, fields that are defined as left-justified, space-padded, are correctly built when I 'set' them to values are less than the specified fixed length....no need to set 'Not Applicable' here. They do appear in the trace output, following the Compute node where they are created, without the trailing spaces, but are correctly represented in the queue following MQOutput.
I will have to investigate this further! |
|
Back to top |
|
 |
|