Page 1 of 1

Help needed with hashed files

Posted: Wed Sep 03, 2008 2:09 am
by Novak
Hi,

Before I start explaining the issue with the hashed files, I would like somebody to confirm that there is no way to extract a value from a text file and store it into a job parameter within the job itself?

OK, the current design is as follows.
There is a text file that has to be split into 3 because of the header, body and footer. For that purpose I created 2 hashed files for header and footer and a sequential file stage for the body (thinking that it is better for that stage to contain a larger amount of data).
There are values from header that are to be used in the footer and body target tables.
All of the 3 files used are joined in the transformer with the intention of obtaining these header contained values and sending them into the designated tables.
The problem I am facing now is that the header and footer target tables are written to as many times as there are records in the source file. The value written is what I want but I only want it once? :?

Anybody has any suggestions...

Regards,

Novak

Re: Help needed with hashed files

Posted: Wed Sep 03, 2008 2:54 am
by ray.wurlod
Novak wrote:Before I start explaining the issue with the hashed files, I would like somebody to confirm that there is no way to extract a value from a text file and store it into a job parameter within the job itself?
Confirmed.

Use just a Sequential File stage. Use stage variables in the Transformer stage to store the header and trailer information. Use a before-stage subroutine to write the header (echo header > file), append to the file in the main flow of your job, and use an after-stage subroutine to append the trailer (echo trailer >> file).

Posted: Wed Sep 03, 2008 7:58 am
by Novak
Hi Ray,

Thanks for a quick response. I am sure you see it solved, but I am sorry to say that I did not quite understand.
A bit about using the stage variables to store header and trailer information is clear. But where exactly you are suggesting to use the before and after-stage subroutines?

Regards,

Novak

Posted: Wed Sep 03, 2008 3:32 pm
by ray.wurlod
In the Transformer stage.