Read a network request and response file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

Chetan, So did you get what you wanted?
Kandy
_________________
Try and Try again…You will succeed atlast!!
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

chulett wrote:That sounds like a good start. Now that we know you want to store rather than parse it, can you tell us what 'store' means here? Where / how does it need to be stored?
Hi Craig,

Actually i have to parse it and also store it.

By parsing i will be getting values from the XML which along with the field value data apart from the XML(example:RequestTimeEx=2011-12-21T01:27:05.228746Z) and write it into a table.

The XML's from different files need to be appended together and should be stored as one singl XML.

Thanks.
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

ray.wurlod wrote:The logic is correct, and you can accumulate the XML as a single string in a stage variable. Output it once the closing tag has been processed (that is, if the input value is "</Request>"). ...
Hi Ray,

I have been trying to read as much as possible on stage variables.
Can you please let me know how to output the single string whihc has XML once the closing tag is processed?

Also please post any link for further reading on stage variables if you have any.

Thanks,
Chetan
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

kandyshandy wrote:Chetan, So did you get what you wanted?
hi kandy,

Thanks for the help with the logic and implementation!! Really appreciate you response.

Currently i am stuck in the last part where in the XML data is in different rows.
As ray suggested i have to write the XML once the closing tag(</Request>) has been processed.

Since XML is in different rows can you please help me with the logic on how to start reading at the opening tag in stage variable and output it after closing tag has been processd?


I am able to do this if XML is in one single coulmn and one single row.(To make it more clear like A1 cell in excel). But if it is in different rows i do not know how to process it.


Please let me know your thoughts on this.


Thanks,
Chetan
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

It is something similar to what you have implemented for your non-XML lines ;)

When you read start tag, set a stage variable to empty, otherwise concatenate the input row to the stage variable with some delimiter.

e.g. ''|Row1|Row2|.....

When you encounter the closing tag, write the stage variable to output column (use Index, Len, Field functions if required)
Kandy
_________________
Try and Try again…You will succeed atlast!!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

chetan wrote:Can you please let me know how to output the single string whihc has XML once the closing tag is processed?
Place a constraint expression on the output link the specifies that the input field value is "</Request>".
Last edited by ray.wurlod on Tue Feb 07, 2012 5:33 am, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

Hi kandy,
Can you please paste some sample code for this?
I'm trying but getting confused on the way stage variables are working.


Thanks.
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

Hi ,

Finally succeded in developing the code for the job.
It is working perfectly.

A big thanks to Kandy :).

Ray,craig,Muni shekar

Thanks for all the inputs.

Will be posting the entire code here shortly.

Thanks again,
Chetan.C
Post Reply