Help needed with hashed files

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Novak
Participant
Posts: 97
Joined: Mon May 21, 2007 10:08 pm
Location: Australia

Help needed with hashed files

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Help needed with hashed files

Post 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).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Novak
Participant
Posts: 97
Joined: Mon May 21, 2007 10:08 pm
Location: Australia

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In the Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply