Files made out of table 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
kashif007
Premium Member
Premium Member
Posts: 216
Joined: Wed Jun 07, 2006 5:48 pm
Location: teaneck

Files made out of table records

Post by kashif007 »

Is there a way if we can produce a file for each record that is present in a table using Ascential. For example if I have 10000 unique records in a table can I have each unique record in a different .txt file as output. Please tell me if it can be done in Ascential. I need to convert a table which has 10000 unique records into 10000 different .txt files, each file containing one unique record. Please suggest.

Thanks
Regards
Kashif Khan
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It will be really messy with a datastage job.
A much easier way is to create a single text file and then run a simple shell script on the file that creates equivalent number of files as unique records.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Another alternative is to create a DataStage Server job that consists of nothing but "Job Control". However you have to create the job control yourself manually (not through the gui).

The Job Control uses a customized version of the BASIC language. Using BASIC you could fairly quickly open a single input file and then use a loop to output each line to a separate output file. It would only take about a dozen lines of code.

If you need documentation on the Basic language you can use this link to get an online copy of the manual:

http://publibfi.boulder.ibm.com/epubs/pdf/25126200.pdf

The version used by DataStage is slightly older than that, but the manual should be fairly accurate.

Note: Some would consider this solution "messy" (as DSguru2B put it) because many developers don't know how to write or support the BASIC code, making it hard to maintain over time.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you do this with the XML Output stage?

You don't need the linked manual; the DataStage BASIC manual which you have with your client has everything you need.
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