Writing extra records

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

Post Reply
Ronnie
Premium Member
Premium Member
Posts: 18
Joined: Thu Feb 14, 2008 9:13 pm
Location: Herndon, Va

Writing extra records

Post by Ronnie »

Hello Forum,

How do I go about writing extra records for every record read in? For instance, if a input sequential file has 300 records, the output should have 600.

Input:
14,A,<FI RSSD901="35301" RSSD905="0014">
628,A,<FI RSSD901="82203 RSSD905="0628">

Output:
14,A,<FI RSSD901="35301" RSSD905="0014">
14,A,<CONCEPTS>
628,A,<FI RSSD901="82203 RSSD905="0628">
628,A,<CONCEPTS>

I read in a mixture of XML and key/text data and then I have to create new XML tags based on input info. It might not always be "<CONCEPTS>" as in my example above. This logic is located as a job within a sequence. The majority of the sequence is parallel. But this logic has to be sequential.

Thanks for any advice.
Ronnie B
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

use copy stage to make 2 records of a record and then funnel to a single output
Ronnie
Premium Member
Premium Member
Posts: 18
Joined: Thu Feb 14, 2008 9:13 pm
Location: Herndon, Va

Post by Ronnie »

Thanks for replying Keshav0307.

I don't see where I can install logic (like IF-THEN-ELSE) within the COPY stage though. As I said in my post, I have to add XML tags based on input data.

Another example is if I create a Transformer Stage variable, I would like to build a new output record if the stage variable resolves to "true", write out the new record line, then write out the input record. This process is then repeated for every input record, though not every input record may need an additional line written.

Can this be done? More importantly, can this be done within the Transformer stage?

Thanks
Ronnie B
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You cannot put in any conditions to a copy stage, but you can use your proprosed logic in a transform stage to create 2 output links with different value and then join them together with a funnel.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Can you not use the old trick of supplying your own EOR characters in a string to create multiple records from a 'single' record? There's a FAQ on the subject, btw.

Use the logic noted in a transformer to still produce 'one' record, but one that will (at the appropriate times) turn into two when landed and read back in. When you need this 'new record', concatenate it to the normal record with the appropriate EOR character(s) between them and write the result to a sequential file. Kind of a Reverse Thunderdome - one man enters, two men leave. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Ronnie
Premium Member
Premium Member
Posts: 18
Joined: Thu Feb 14, 2008 9:13 pm
Location: Herndon, Va

Post by Ronnie »

Thank you ArndW and Chulett for your responses!

I did a mixture of both of your suggestions. I used EOR (End of Record, I presume) characters in which I was able to retrieve a couple of the commands to perform that from a previous post titled, "writing multiple lines from 1 source row", from roy.

After creating multiple lines and multiple output links, I funnelled the files together to form a perfectly organized XML document.

Thanks!

p.s.- I looked for the FAQ mentioned by Chulett on this subject and couldn't find it. All I see under FAQ are topics regarding administrative type stuff such as signon's, registration, etc. Where or how do I find the technical FAQ? I could add a new post stating where to find the technical FAQ if so needed. Just let me know.
Ronnie B
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ronnie wrote:I did a mixture of both of your suggestions. I used EOR (End of Record, I presume) characters in which I was able to retrieve a couple of the commands to perform that from a previous post titled, "writing multiple lines from 1 source row", from roy.
Ronnie wrote:p.s.- I looked for the FAQ mentioned by Chulett on this subject and couldn't find it.
That was the FAQ I mentioned, Roy's post in the FAQ forum, not anything from the FAQ section of the website. Sorry for the confusion.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply