Page 1 of 1

XML Output xpath for group field

Posted: Tue Jun 09, 2009 5:57 pm
by mrvsr
Hi,
I am trying to generate xml file for below fields :

Partial definition:
record
{record_length=259, delim=none, quote=none, binary, ebcdic, native_endian, round=round_inf, nofix_zero}
(
............................
PSD_BLF_UNIT_PRICE_PCT:decimal[8,6] {default=0,packed};
FILLER_2:subrec {redefines='PSD_BLF_UNIT_PRICE_PCT'} (
PSD_BLF_UNIT_PRICE_FLAT:decimal[8,2] {default=0,packed};
);
PSD_BLF_BALANCE_AMT:decimal[13,2] {default=0,packed};
..............................
)

I have CFF >>>> Trf >>> XML Output

In the transformer Column definitions are

Level Name Key SQL Type
05 PSD_BLF_UNIT_PRICE_PCT No Decimal [8,6]

05 FILLER_2 No Char[5]
06 PSD_BLF_UNIT_PRICE_FLAT No Decimal[8,2]

05 PSD_BLF_BALANCE_AMT No Decimal[13,2]

If I use only 2 fields and xpath like below its generating xml file without any errors.
PSD_BLF_UNIT_PRICE_PCT : /dadblf0c_rec/PSD_BLF_UNIT_PRICE_PCT/text()
PSD_BLF_BALANCE_AMT : /dadblf0c_rec/PSD_BLF_BALANCE_AMT/text()


But If Include these fields
FILLER_2 and PSD_BLF_UNIT_PRICE_FLAT inbetween I am getting erros like FILLER_2 in not a value field.


I tired xpaths like below also

for
for FILLER_2 : " / " and " /rec/ FILLER_2" and " /rec/ FILLER_2"
for PSD_BLF_UNIT_PRICE_FLAT : " / " and " /rec/ PSD_BLF_UNIT_PRICE_FLAT/" and " /rec/ PSD_BLF_UNIT_PRICE_FLAT/text()"


But getting the error messages

" Error when checking operator: Could not find input field "PSD_BLF_UNIT_PRICE_FLAT". " etc.,

I also tried droping the FILLER_2 and making level of PSD_BLF_UNIT_PRICE_FLAT 05 then

05 PSD_BLF_UNIT_PRICE_PCT No Decimal [8,6]
05 PSD_BLF_UNIT_PRICE_FLAT No Decimal[8,2]

but no luck


I Could write to Sequential file by simply removing the FILLER_2 like below
05 PSD_BLF_UNIT_PRICE_PCT No Decimal [8,6]
06 PSD_BLF_UNIT_PRICE_FLAT No Decimal[8,2]
05 PSD_BLF_BALANCE_AMT No Decimal[13,2]

But cant do same in xml output file.

Please let me know how to define xpaths in xml output stage for below field definitions.


Level Name Key SQL Type
05 PSD_BLF_UNIT_PRICE_PCT No Decimal [8,6]

05 FILLER_2 No Char[5]
06 PSD_BLF_UNIT_PRICE_FLAT No Decimal[8,2]

05 PSD_BLF_BALANCE_AMT No Decimal[13,2]

(FILLER_2 redefines PSD_BLF_UNIT_PRICE_PCT )

or

PSD_BLF_UNIT_PRICE_PCT:decimal[8,6] {default=0,packed};
FILLER_2:subrec {redefines='PSD_BLF_UNIT_PRICE_PCT'} (
PSD_BLF_UNIT_PRICE_FLAT:decimal[8,2] {default=0,packed};
);
PSD_BLF_BALANCE_AMT:decimal[13,2] {default=0,packed};



Thanks In advance..
Srini

Posted: Tue Jun 09, 2009 9:36 pm
by chulett
So... FILLER_2 redefines the PSD_BLF_UNIT_PRICE_PCT field? How can you include both if one redefines the other? My COBOL days are way behind me but that smells a little fishy to me. :?

Posted: Wed Jun 10, 2009 6:49 am
by eostic
Who is doing the complaining? The source operator, or the target xml operator? I can't tell for sure, but it sounds like perhaps there are issues here across Stage types. Get all of your columns clear and separate before going into your XMLOutput Stage.....

Check the following:

a) have at least a Transformer in between your XMLOutput and anything that is upstream.

b) make sure that there is no "xpath" or anything else extraneous in your Description property except on the input link to your XMLOutput.

c) for extra clarity, unless you are trying to do fancy things with cutting mulitple xml output documents, send your finished XML content to a sequential Stage....use just one big column on the output link of the XMLOutput Stage, with a single "/" in its description property.

Ernie

Posted: Wed Jun 10, 2009 1:30 pm
by mrvsr
UnCheck Enable all group column selection in
CFF>>OUTPUT>>Selection.

Then all the fields will be at same level.