1 file - multiple messages to multiple outputs using header
Posted: Fri Jan 26, 2007 7:47 am
Hi,
I'm pretty new to datastage and am trying to figure out how to read a File that contains multiple "messages" (made up of a header and a detail section). Everytime the file is sent any number of of messages can be sent and each message can be a different length and structure. Each message however will specifiy the length of it's detail and it's message type within it's Header section. Example the following is the structure of File A that contains 4 messages: -
File A
======
Header: Type 1, 15 (MessageName, length of Detail section)
Detail: MR SMITH, 12345 (Field 1, Field 2)
Header: Type 2, 12 (MessageName, length of Detail section)
Detail: 12, CAT, ABC (Field 1, Field 2, Field 3)
Header: Type 3, 6 (MessageName, length of Detail section)
Detail: 123ABC (Field 1)
Header: Type 1, 15 (MessageName, length of Detail section)
Detail: MR JONES, 67891 (Field 1, Field 2)
Another complication is that each Type represents a fixed mapping that has to be translated into a new structure and then sent to an output.
Type 1 - Needs to be translated using Map A
Type 2 - Needs to be translated using Map B
Type 3 - Needs to be translated using Map C
E.g.
Is it possilbe to read the first header row, determine the Type (Type 1) and size (15) then pass the detail section through the correct map (Map A) and then this new output be sent to an output file designed for the type provided. The process will then recognise the next header and repeat the process until the end of the file. E.g. Message 1 (Type 1) uses Map A then goes to output 1, Message 2 (Type 2) uses Map B then goes to output 2, Message 3 (Type 3) uses Map C then goes to output 3, Message 4 (Type 1) uses Map A then goes to output 1.
Any pointers on how to approach this would be great.
Thanks Andy
I'm pretty new to datastage and am trying to figure out how to read a File that contains multiple "messages" (made up of a header and a detail section). Everytime the file is sent any number of of messages can be sent and each message can be a different length and structure. Each message however will specifiy the length of it's detail and it's message type within it's Header section. Example the following is the structure of File A that contains 4 messages: -
File A
======
Header: Type 1, 15 (MessageName, length of Detail section)
Detail: MR SMITH, 12345 (Field 1, Field 2)
Header: Type 2, 12 (MessageName, length of Detail section)
Detail: 12, CAT, ABC (Field 1, Field 2, Field 3)
Header: Type 3, 6 (MessageName, length of Detail section)
Detail: 123ABC (Field 1)
Header: Type 1, 15 (MessageName, length of Detail section)
Detail: MR JONES, 67891 (Field 1, Field 2)
Another complication is that each Type represents a fixed mapping that has to be translated into a new structure and then sent to an output.
Type 1 - Needs to be translated using Map A
Type 2 - Needs to be translated using Map B
Type 3 - Needs to be translated using Map C
E.g.
Is it possilbe to read the first header row, determine the Type (Type 1) and size (15) then pass the detail section through the correct map (Map A) and then this new output be sent to an output file designed for the type provided. The process will then recognise the next header and repeat the process until the end of the file. E.g. Message 1 (Type 1) uses Map A then goes to output 1, Message 2 (Type 2) uses Map B then goes to output 2, Message 3 (Type 3) uses Map C then goes to output 3, Message 4 (Type 1) uses Map A then goes to output 1.
Any pointers on how to approach this would be great.
Thanks Andy