sequential file data length checking

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
sweetleaf
Participant
Posts: 30
Joined: Fri Jan 24, 2003 3:28 pm
Location: Canada

sequential file data length checking

Post by sweetleaf »

Hi there,

I have a Sequential file stage and an ORAOCI8 stage.
So far I can import the contents of the sequential file into an
oracle table.
But I need to be able to check that the character length of one of the inbound columns from the csv file is 12 digits long, and if not then reject the entry and resume loading the rest of the csv contents.

Can I do this in DataStage?

Any help would be greatly appreciated!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This one's easy.
Set up a constraint expression in the Transformer stage that uses the Len() function. For example:
Len(Link1.Column3) = 12
Only rows in which there are 12 characters in Column3 will be transmitted on this link. Create a separate output link to catch the rejected rows.

Another possibility is to guarantee that there are 12 characters by truncation/padding as appropriate. The easiest way to achieve this is to use the Fmt() function. For example:
Fmt(Link1.Column3, "L#12")


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
sankar18
Participant
Posts: 34
Joined: Mon Dec 16, 2002 1:18 am

Post by sankar18 »

Hi,

As Ray suggest put a constraint in the Transformer stage, If you want 12 digit or less than 12 digit use
Len(Link1.Column3)
sweetleaf
Participant
Posts: 30
Joined: Fri Jan 24, 2003 3:28 pm
Location: Canada

Post by sweetleaf »

Thanks guys!

That was a big help,
As you can tell I'm a DataStage newbie!

I just got your helpful posts now.

A quick question: If I have a job that I want to read the contents of all the csv files in a given directory into a database table, how can I get it so that where it prompts for file name (Sequential File Stage), I can enter file names like "Test" & "*" - so that DataStage will know to pick up and process anything starting with "Test".

Short of this functionality, how can I get it so that DataStage processes all of the CSV's in a given directory (assuming all csv's are the same format)?

Thank you soo very much for your help!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need to build a hierarchy of jobs, one that processes the search, the other that processes one CSV file. The first sets a "filename" parameter for the second.
A hierarchy is handled via Job Control (on the job properties tab) or, if you have a sufficiently recent release of DataStage (5.x or later) you can manage it with a sequence.


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