Author |
Message
|
Muthukrishnan |
Posted: Sat Feb 16, 2013 10:01 pm Post subject: To remove spaces in between the output data before being put |
|
|
Apprentice
Joined: 16 Feb 2013 Posts: 48
|
Hi,
My requirement is to trim the spaces that occurs in between the output data being they are put to queue. Basically, we are using two message sets in the flow. Once the message is put to queue, we create a structure for the incoming message, validate them based on the message set.
Below image is the subflow used
And I use the below code to map the input to output. While doing so, I am able to see spaces inbetween the output data. Please suggest how this can be removed.
Below refer for the sample input data and output data after the code.
SET COUNT1 = CARDINALITY("InputBody"."ABSO_I_CT_EL"[]);
SET "OutputRoot"."MRM".ABSO_O_CT_EL_COUNT = COUNT1;
DECLARE inref REFERENCE to "InputBody"."ABSO_I_CT_EL"[1];
CREATE FIELD "OutputRoot"."MRM"."ABSO_O_CT_EL";
DECLARE outref REFERENCE to "OutputRoot"."MRM"."ABSO_O_CT_EL";
DECLARE CNT INT 1;
while (LASTMOVE(inref) = TRUE ) DO
-- Changes as part of EDI AUTOBACS Project
IF inref."ABSO_COL1_I" IS NULL OR inref."ABSO_COL1_I" = '0' THEN
SET outref."ABSO_COL1_O" ='' ;
ElSE SET outref."ABSO_COL1_O" = inref."ABSO_COL1_I" ;
END IF;
IF inref."ABSO_COL2_I" IS NULL OR inref."ABSO_COL2_I" = '0' THEN
SET outref."ABSO_COL2_O" ='' ;
ElSE SET outref."ABSO_COL2_O" = inref."ABSO_COL2_I" ;
END IF;
IF inref."ABSO_COL3_I" IS NULL OR inref."ABSO_COL3_I" = '0' THEN
SET outref."ABSO_COL3_O" ='' ;
ElSE SET outref."ABSO_COL3_O" = inref."ABSO_COL3_I" ;
END IF;
IF inref."ABSO_COL4_I" IS NULL OR inref."ABSO_COL4_I" = '0' THEN
SET outref."ABSO_COL4_O" ='' ;
ElSE SET outref."ABSO_COL4_O" = inref."ABSO_COL4_I" ;
END IF;
IF inref."ABSO_COL5_I" IS NULL OR inref."ABSO_COL5_I" = '0' THEN
SET outref."ABSO_COL5_O" ='' ;
ElSE SET outref."ABSO_COL5_O" = inref."ABSO_COL5_I" ;
Sample input data:
041$|20130122$|171937$|123456$|0$|0$|0$|0$|0$|$|0$|0$|0$|0$|$|$|0$|$|$|$|0$|0$|0$|0$|0.$|0$|0$|0$|900578$|123456$|1$|12$|123$|12$|20131212$|20121210$|20121112$|20121112$|20121112$|20121210$|0$|$|$|$|0$|0$|0$|0$|0.$|0$|0$|0$|0$|0$|0$|0$|0$|0$|0$|0$|0$|0$|0$|$|1$|03516012$|175/65R14 86T XLXI3$|4985009671245$|35160$|3516
Output data:
04120130122171937123456
900578123456112123120131212
0121210201211120121110121112
0121210
103516012175/
65R14 86T XL XI3498500967124
5 3516035160123 35160123 3516012
3 20
Required output should be
04120130122171937123456900578123456112123120131212
01212102012111201211101211120121210103516012175/65R14 86T XL XI349850096712453516035160123351601233516012320 |
|
Back to top |
|
 |
Vitor |
Posted: Sun Feb 17, 2013 5:16 am Post subject: Re: To remove spaces in between the output data before being |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Muthukrishnan wrote: |
I use the below code to map the input to output. |
When posting code, please use code tags to make it easier to read.
Muthukrishnan wrote: |
While doing so, I am able to see spaces inbetween the output data. |
Do you mean spaces? Looks more like line feeds to me.
Muthukrishnan wrote: |
Please suggest how this can be removed. |
Well I'd suggest you fix the output message set, which you've given no details of here. If you want suggestions on how to fix it, I'd suggest you take a user trace to determine why it's coming out like that, then change it so it comes out more like you want.
A process commonly known as "problem investigation", and sometimes "debugging". You may want to check it out; it helps. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Feb 17, 2013 12:11 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Presumably you are not using version 8, since you are using the MRM parser.
IF you were using v8, you would presumably be using the DFDL parser. |
|
Back to top |
|
 |
Muthukrishnan |
Posted: Sun Feb 17, 2013 10:32 pm Post subject: |
|
|
Apprentice
Joined: 16 Feb 2013 Posts: 48
|
Hi Vitor,
Sincere Apologies for not including code tags. Please find the below image for the output message set that I use.
I have enabled trace and found that if there is no value in the one of fields of the incoming message , I have set the output field to be null. But I am not very clear how spaces are coming intead of null.
Below is user trace for your reference.
2013-02-18 14:12:30.183820 6732 UserTrace BIP2537I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Executing statement ''SET outref.ABSO_COL18_O = '';'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '102.2').
2013-02-18 14:12:30.183841 6732 UserTrace BIP2566I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Assigning value '''''' to field / variable ''outref.ABSO_COL18_O''.
2013-02-18 14:12:30.183860 6732 UserTrace BIP2537I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Executing statement ''IF inref.ABSO_COL19_I IS NULL OR inref.ABSO_COL19_I = '0' THEN... ELSE... END IF;'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '105.1').
2013-02-18 14:12:30.183891 6732 UserTrace BIP2543I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '105.4') : Failed to navigate to path element number '2' because it does not exist.
2013-02-18 14:12:30.183906 6732 UserTrace BIP2539I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Evaluating expression ''inref.ABSO_COL19_I'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '105.4'). This resolved to ''inref.ABSO_COL19_I''. The result was ''NULL''.
2013-02-18 14:12:30.183923 6732 UserTrace BIP2540I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Finished evaluating expression ''inref.ABSO_COL19_I IS NULL'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '105.25'). The result was ''TRUE''.
2013-02-18 14:12:30.183952 6732 UserTrace BIP2539I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Evaluating expression ''inref.ABSO_COL19_I IS NULL OR inref.ABSO_COL19_I = '0''' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '105.33'). This resolved to ''TRUE OR X''. The result was ''TRUE''.
2013-02-18 14:12:30.183969 6732 UserTrace BIP2537I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Executing statement ''SET outref.ABSO_COL19_O = '';'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '106.2').
2013-02-18 14:12:30.183990 6732 UserTrace BIP2566I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Assigning value '''''' to field / variable ''outref.ABSO_COL19_O''.
2013-02-18 14:12:30.184026 6732 UserTrace BIP2537I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Executing statement ''IF inref.ABSO_COL20_I IS NULL OR inref.ABSO_COL20_I = '0' THEN... ELSE... END IF;'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '109.1').
2013-02-18 14:12:30.184040 6732 UserTrace BIP2543I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '109.4') : Failed to navigate to path element number '2' because it does not exist.
2013-02-18 14:12:30.184057 6732 UserTrace BIP2539I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Evaluating expression ''inref.ABSO_COL20_I'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '109.4'). This resolved to ''inref.ABSO_COL20_I''. The result was ''NULL''.
2013-02-18 14:12:30.184091 6732 UserTrace BIP2540I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Finished evaluating expression ''inref.ABSO_COL20_I IS NULL'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '109.25'). The result was ''TRUE''.
2013-02-18 14:12:30.184104 6732 UserTrace BIP2539I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Evaluating expression ''inref.ABSO_COL20_I IS NULL OR inref.ABSO_COL20_I = '0''' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '109.33'). This resolved to ''TRUE OR X''. The result was ''TRUE''.
2013-02-18 14:12:30.184122 6732 UserTrace BIP2537I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Executing statement ''SET outref.ABSO_COL20_O = '';'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '110.2').
2013-02-18 14:12:30.184164 6732 UserTrace BIP2566I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Assigning value '''''' to field / variable ''outref.ABSO_COL20_O''.
2013-02-18 14:12:30.184179 6732 UserTrace BIP2537I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Executing statement ''IF inref.ABSO_COL21_I IS NULL OR inref.ABSO_COL21_I = '0' THEN... ELSE... END IF;'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '113.1').
2013-02-18 14:12:30.184198 6732 UserTrace BIP2539I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Evaluating expression ''inref.ABSO_COL21_I'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '113.4'). This resolved to ''inref.ABSO_COL21_I''. The result was '''0'''.
2013-02-18 14:12:30.184232 6732 UserTrace BIP2540I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Finished evaluating expression ''inref.ABSO_COL21_I IS NULL'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '113.25'). The result was ''FALSE''.
2013-02-18 14:12:30.184249 6732 UserTrace BIP2539I: Node 'JP_JDE_MAIN_MF_4.JP_JDE_REP_ABSO_SF.CreateMessage': Evaluating expression ''inref.ABSO_COL21_I'' at ('.JP_JDE_REP_ABSO_SF_Create_Detail_message.main', '113.37'). This resolved to ''inref.ABSO_COL21_I''. The result was ''ROW... Root Element Type=50331659 NameSpace='' Name='ABSO_COL21_I' Value='0'''.
My requirement is to set the output field to null and not as space if there is no value or '0' in the input field.
Code: |
IF inref."ABSO_COL1_I" IS NULL OR inref."ABSO_COL1_I" = '0' THEN
SET outref."ABSO_COL1_O" ='' ;
ElSE SET outref."ABSO_COL1_O" = inref."ABSO_COL1_I" ;
END IF;
IF inref."ABSO_COL2_I" IS NULL OR inref."ABSO_COL2_I" = '0' THEN
SET outref."ABSO_COL2_O" ='' ;
ElSE SET outref."ABSO_COL2_O" = inref."ABSO_COL2_I" ;
END IF;
IF inref."ABSO_COL3_I" IS NULL OR inref."ABSO_COL3_I" = '0' THEN
SET outref."ABSO_COL3_O" ='' ;
ElSE SET outref."ABSO_COL3_O" = inref."ABSO_COL3_I" ;
END IF;
IF inref."ABSO_COL4_I" IS NULL OR inref."ABSO_COL4_I" = '0' THEN
SET outref."ABSO_COL4_O" ='' ;
ElSE SET outref."ABSO_COL4_O" = inref."ABSO_COL4_I" ;
END IF;
IF inref."ABSO_COL5_I" IS NULL OR inref."ABSO_COL5_I" = '0' THEN
SET outref."ABSO_COL5_O" ='' ;
ElSE SET outref."ABSO_COL5_O" = inref."ABSO_COL5_I" ;
|
|
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Feb 17, 2013 11:00 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
you probably have set the null value of the field to be spaces.
What you really want to do, I suspect, is to omit the field if it is null.
Look at the difference between those 2 ESQL statements. It might help you understand
Code: |
SET folderref.FIELDNAME = NULL;
SET folderref.FIELDNAME2 VALUE = NULL; |
They do not do the same thing.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Muthukrishnan |
Posted: Mon Feb 18, 2013 1:45 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2013 Posts: 48
|
Hi fjb_saper,
I tried to use the below in my code. Still I am getting spaces in between the output. I even set nillable to true in the output message set.
Code: |
SET folderref.FIELDNAME2 VALUE = NULL; |
I would to like to highlight again that my input will have null values and I need to ignore them. Our requirement is that we use an input message set that will contain an array of values which contains valid information and some invalid null characters. I have contructed an output message set to set only valid non-null values and ignore the null values. Below is the code snippet. Please give your valuable suggestions to resolve the problem.
Code: |
SET COUNT1 = CARDINALITY("InputBody"."ABSO_I_CT_EL"[]);
SET "OutputRoot"."MRM".ABSO_O_CT_EL_COUNT = COUNT1;
DECLARE inref REFERENCE to "InputBody"."ABSO_I_CT_EL"[1];
CREATE FIELD "OutputRoot"."MRM"."ABSO_O_CT_EL";
DECLARE outref REFERENCE to "OutputRoot"."MRM"."ABSO_O_CT_EL";
DECLARE CNT INT 1;
while (LASTMOVE(inref) = TRUE ) DO
-- Changes as part of EDI AUTOBACS Project
IF inref."ABSO_COL1_I" IS NULL OR inref."ABSO_COL1_I" = '0' THEN
SET outref."ABSO_COL1_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL1_O" = inref."ABSO_COL1_I" ;
END IF;
IF inref."ABSO_COL2_I" IS NULL OR inref."ABSO_COL2_I" = '0' THEN
SET outref."ABSO_COL2_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL2_O" = inref."ABSO_COL2_I" ;
END IF;
IF inref."ABSO_COL3_I" IS NULL OR inref."ABSO_COL3_I" = '0' THEN
SET outref."ABSO_COL3_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL3_O" = inref."ABSO_COL3_I" ;
END IF;
IF inref."ABSO_COL4_I" IS NULL OR inref."ABSO_COL4_I" = '0' THEN
SET outref."ABSO_COL4_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL4_O" = inref."ABSO_COL4_I" ;
END IF; |
|
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 18, 2013 4:50 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
A couple of remarks:
- Vitor asked you to use [c o d e] tags but your data is still displayed without the tags. It is difficult to understand your output format when it is so badly formatted. Please type in your password, and then use the [ e d i t] button to add the tags.
- If your output format is fixed-length then I do not understand how it can be safe to miss out the 'null' fields. How will the downstream application interpret the data format correctly?
You may need to give us some more information about the input and output data formats, to help us understand exactly what you are trying to do. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 18, 2013 6:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
your definition says occurs 0 to 1.
Have you even tried to use
Code: |
SET ref.FIELDNAME = NULL; |
?
What was the result?
Try and read posts fully  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Muthukrishnan |
Posted: Wed Feb 20, 2013 12:00 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2013 Posts: 48
|
Hi fjb_saper,
Sorry for the delayed response. I tried the below code
Code: |
SET ref.FIELDNAME = NULL; |
But I am getting error in the message set and the broker is looking for default value. Since its a nillable field I do not want to keep any default value and even I have net nillable in the output message set. Could you please help to ingore these nillable fields in the output? |
|
Back to top |
|
 |
kimbert |
Posted: Wed Feb 20, 2013 1:38 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I can almost certainly help you, but I will need more information about your requirements first.
Quote: |
My requirement is to set the output field to null and not as space |
What do you mean by 'null'. There is no standard meaning for that word - you have to tell us what 'null' means for your output format.
Quote: |
Our requirement is that we use an input message set that will contain an array of values which contains valid information and some invalid null characters |
Please define what you mean by 'invalid null characters'. Are they invalid, or are they null? What does you message flow need to do with these characters?
Quote: |
I have contructed an output message set to set only valid non-null values and ignore the null values. |
What do you mean by 'ignore'?
See what I mean? Almost everything that you have told us can be misunderstood. I honestly do not know what you requirements are. If you want help, then please take time to explain clearly and carefully what your requirements are. It would probably help if you cut the problem down to a very small message with only 3 elements. |
|
Back to top |
|
 |
Muthukrishnan |
Posted: Wed Feb 20, 2013 1:59 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2013 Posts: 48
|
Ok so here is the problem I am facing
I am using a code which is iterating the input values on count basis.The input file contains 75 values in total and its making it for 25 per cycle and count comes 0. you can see the code below
Code: |
SET COUNT1 = CARDINALITY("InputBody"."ABSO_I_CT_EL"[]);
SET "OutputRoot"."MRM".ABSO_O_CT_EL_COUNT = COUNT1;
DECLARE inref REFERENCE to "InputBody"."ABSO_I_CT_EL"[1];
CREATE FIELD "OutputRoot"."MRM"."ABSO_O_CT_EL";
DECLARE outref REFERENCE to "OutputRoot"."MRM"."ABSO_O_CT_EL";
DECLARE CNT INT 1;
while (LASTMOVE(inref) = TRUE ) DO
IF inref."ABSO_COL1_I" IS NULL OR inref."ABSO_COL1_I" = '0' THEN
SET outref."ABSO_COL1_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL1_O" = inref."ABSO_COL1_I" ;
END IF;
IF inref."ABSO_COL2_I" IS NULL OR inref."ABSO_COL2_I" = '0' THEN
SET outref."ABSO_COL2_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL2_O" = inref."ABSO_COL2_I" ;
END IF;
IF inref."ABSO_COL3_I" IS NULL OR inref."ABSO_COL3_I" = '0' THEN
SET outref."ABSO_COL3_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL3_O" = inref."ABSO_COL3_I" ;
END IF;
IF inref."ABSO_COL4_I" IS NULL OR inref."ABSO_COL4_I" = '0' THEN
SET outref."ABSO_COL4_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL4_O" = inref."ABSO_COL4_I" ;
END IF;
IF inref."ABSO_COL5_I" IS NULL OR inref."ABSO_COL5_I" = '0' THEN
SET outref."ABSO_COL5_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL5_O" = inref."ABSO_COL5_I" ;
END IF;
IF inref."ABSO_COL6_I" IS NULL OR inref."ABSO_COL6_I" = '0' THEN
SET outref."ABSO_COL6_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL6_O" = inref."ABSO_COL6_I" ;
END IF;
IF inref."ABSO_COL7_I" IS NULL OR inref."ABSO_COL7_I" = '0' THEN
SET outref."ABSO_COL7_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL7_O" = inref."ABSO_COL7_I" ;
END IF;
IF inref."ABSO_COL8_I" IS NULL OR inref."ABSO_COL8_I" = '0' THEN
SET outref."ABSO_COL8_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL8_O" = inref."ABSO_COL8_I" ;
END IF;
IF inref."ABSO_COL9_I" IS NULL OR inref."ABSO_COL9_I" = '0' THEN
SET outref."ABSO_COL9_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL9_O" = inref."ABSO_COL9_I" ;
END IF;
IF inref."ABSO_COL10_I" IS NULL OR inref."ABSO_COL10_I" = '0' THEN
SET outref."ABSO_COL10_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL10_O" = inref."ABSO_COL10_I" ;
END IF;
IF inref."ABSO_COL11_I" IS NULL OR inref."ABSO_COL11_I" = '0' THEN
SET outref."ABSO_COL11_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL11_O" = TRIM(SUBSTRING(inref."ABSO_COL11_I" FROM 2 FOR 6)) ;
END IF;
IF inref."ABSO_COL12_I" IS NULL OR inref."ABSO_COL12_I" = '0' THEN
SET outref."ABSO_COL12_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL12_O" = inref."ABSO_COL12_I" ;
END IF;
IF inref."ABSO_COL13_I" IS NULL OR inref."ABSO_COL13_I" = '0' THEN
SET outref."ABSO_COL13_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL13_O" = inref."ABSO_COL13_I" ;
END IF;
IF inref."ABSO_COL14_I" IS NULL OR inref."ABSO_COL14_I" = '0' THEN
SET outref."ABSO_COL14_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL14_O" = TRIM(SUBSTRING(inref."ABSO_COL14_I" FROM 2 FOR 6)) ;
END IF;
IF inref."ABSO_COL15_I" IS NULL OR inref."ABSO_COL15_I" = '0' THEN
SET outref."ABSO_COL15_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL15_O" = TRIM(SUBSTRING(inref."ABSO_COL15_I" FROM 2 FOR 6)) ;
END IF;
IF inref."ABSO_COL16_I" IS NULL OR inref."ABSO_COL16_I" = '0' THEN
SET outref."ABSO_COL16_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL16_O" = inref."ABSO_COL16_I" ;
END IF;
IF inref."ABSO_COL17_I" IS NULL OR inref."ABSO_COL17_I" = '0' THEN
SET outref."ABSO_COL17_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL17_O" = TRIM(SUBSTRING(inref."ABSO_COL17_I" FROM 1 FOR 1));
END IF;
IF inref."ABSO_COL18_I" IS NULL OR inref."ABSO_COL18_I" = '0' THEN
SET outref."ABSO_COL18_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL18_O" = inref."ABSO_COL18_I" ;
END IF;
IF inref."ABSO_COL19_I" IS NULL OR inref."ABSO_COL19_I" = '0' THEN
SET outref."ABSO_COL19_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL19_O" = inref."ABSO_COL19_I" ;
END IF;
IF inref."ABSO_COL20_I" IS NULL OR inref."ABSO_COL20_I" = '0' THEN
SET outref."ABSO_COL20_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL20_O" = inref."ABSO_COL20_I" ;
END IF;
IF inref."ABSO_COL21_I" IS NULL OR inref."ABSO_COL21_I" = '0' THEN
SET outref."ABSO_COL21_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL21_O" = TRIM(SUBSTRING(inref."ABSO_COL21_I" FROM 2 for 5));
END IF;
IF inref."ABSO_COL22_I" IS NULL OR inref."ABSO_COL22_I" = '0' THEN
SET outref."ABSO_COL22_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL22_O" = inref."ABSO_COL22_I" ;
END IF;
IF inref."ABSO_COL23_I" IS NULL OR inref."ABSO_COL23_I" = '0' THEN
SET outref."ABSO_COL23_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL23_O" = inref."ABSO_COL23_I" ;
END IF;
IF inref."ABSO_COL24_I" IS NULL OR inref."ABSO_COL24_I" = '0' THEN
SET outref."ABSO_COL24_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL24_O" = inref."ABSO_COL24_I" ;
END IF;
IF inref."ABSO_COL25_I" IS NULL OR inref."ABSO_COL25_I" = '0' THEN
SET outref."ABSO_COL25_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL25_O" = inref."ABSO_COL25_I" ;
END IF;
move inref NEXTSIBLING;
CREATE NEXTSIBLING of outref as outref NAME 'ABSO_O_CT_EL';
SET CNT = CNT + 1;
END WHILE;
DECLARE DelRef REFERENCE TO "OutputRoot"."MRM"."ABSO_O_CT_EL"[CNT];
DETACH DelRef;
RETURN true;
END; |
Now I want to remove that field from the ouput file if one of the value in this 75 comes into the picture as space or 0 . Fo this I am setting 'NULL' on conditions like below
Code: |
IF inref."ABSO_COL1_I" IS NULL OR inref."ABSO_COL1_I" = '0' THEN
SET outref."ABSO_COL1_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL1_O" = inref."ABSO_COL1_I" ;
END IF;
IF inref."ABSO_COL2_I" IS NULL OR inref."ABSO_COL2_I" = '0' THEN
SET outref."ABSO_COL2_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL2_O" = inref."ABSO_COL2_I" ;
END IF;
IF inref."ABSO_COL3_I" IS NULL OR inref."ABSO_COL3_I" = '0' THEN
SET outref."ABSO_COL3_O" VALUE = NULL ;
ElSE SET outref."ABSO_COL3_O" = inref."ABSO_COL3_I" ;
END IF; |
What I noticed is like once it completes cycle 1st of iteration ( If I keep ref Field value= NULL) I am getting space in output.
if I keep it ref field = NULL . It asks for default value . So What should I do in this case. Here is my output value I am getting now with spaces
I want to omit the spaces in below message. It should be single line
Code: |
04120130122171937123456
9005781234561121
2312013121 20121210201211120121
11 012111 20121210
1 03516012175/6
5R14 86T XL XI3 4985009671245
5160 35160123 35160123 35160123
20 |
Please see the message set above for this.
Please advice.  |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 20, 2013 3:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Obviously your model is not right.
If your model were right you could omit entirely the output producing the spaces (null fields).
Now if you have a row defined and any of the fields in the row are not null than all fields in the row need to be displayed (creating potentially vast areas of white space (null values or default values?)
Have fun.
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Wed Feb 20, 2013 4:07 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I asked this question, and you did not answer it:
Quote: |
If your output format is fixed-length then I do not understand how it can be safe to miss out the 'null' fields. How will the downstream application interpret the data format correctly? |
|
|
Back to top |
|
 |
|