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!
sequential file data length checking
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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
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
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!
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!
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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
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