Dumping Hash File

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
dickfong
Participant
Posts: 68
Joined: Tue Apr 15, 2003 9:20 am

Dumping Hash File

Post by dickfong »

Is it possible to dump the content of a hash file to a sequential file using scripts (DS Basic or UNIX shell script)? What I want to do is sth like a database export of table. Many thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sure. I can't supply something already written, but it can certainly be done in DS Basic. Very high level:

Use OPEN and OPENSEQ for the hash and flat file, respectively. Loop thru the hash with READNEXT and write to the flat file using WRITESEQ. Also be aware of WEOFSEQ and CLOSESEQ. If you don't have hard-copy manuals, there should be pdf versions of all manuals (including the BASIC manual) that installed with the client software. Also check the online help. [:)]

-craig
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Where and why do you want to do this? In particular, do you want the data or the metadata from the hashed file to be dumped?


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
dickfong
Participant
Posts: 68
Joined: Tue Apr 15, 2003 9:20 am

Post by dickfong »

Thank you both of you.

What we are trying to do is to create some backup points of the data staging area in between our programs so that we can re-reun the programs from those backup points in case of faliure.

The idea is like we have hundreds of jobs all linking by 2 job sequencers, the 2 sequencers would be executed in sequence and in between the 2 sequencers we would like to insert a job to backup all the intermediate hashes and sequential files so that in case of faliure of part 2 sequencer, we can restore the backup files and restart part 2 instead of the whole ETL process.

Any idea of how it can be achived?

Many thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you're going to insert a job to do this, why not list DataStage handle it? Source is hashed file, target is sequential file stage (or FTP stage if you want the backup on a different system).


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
dickfong
Participant
Posts: 68
Joined: Tue Apr 15, 2003 9:20 am

Post by dickfong »

Our concern is on the performance. Backing up with scripts (UNIX or UV) may generate less overhead than by a DS job, can I say so?

Another concern is the effort to develop hundreds of jobs which perform the same task. i.e. to copy from hash to sequential file or vice verse, with different table definition.

Please advices. Thanks a lot.
mnevotti
Participant
Posts: 10
Joined: Wed Nov 13, 2002 11:02 am

Post by mnevotti »

Couldn't you create a shared container in which you have the source as a hashed file, target is a sequential file using FTP? That way the other jobs can just use the shared container and the same task doesn't need to be developed hundreds of times.

-Melinda
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How will you identify the hashed files?
If they're all in a folder (ideally with nothing else) you could use a folder stage to feed the file names into a job that would process them all.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply