Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ab Initio - How to split a file based on values of a field

Status
Not open for further replies.

ars100

Programmer
Mar 15, 2003
2
US
Hi,
I'm beginner in Ab Initio, and need your help.
How can I split a file based on the value of one of the field in the file. For example I have file like this:

Name(5 chars) City(5 chars) Address(10 chars)
ARS10SANJOSE123 A ST.
JOHNSHAYWARD235 B ST.
PAULA L.A. 1000 A ST.
MARKFOAKLAND2500 X ST.

I want to split this file into 3 files, based on the first letter of the City.
If the first letter of city = S
go to file 1
else if the first letter of city = H
go to file 2
else
go to file 3

Can anyone help me with this...
Someone told me it can be done with reformat component, but I could not figure out how to do.

Thanks you.
Ars100
 
Ars100,

There are variety of ways of doing this. You could use a reformat, 2 filter by expressions or a partion by expression.

If you want to use a reformat, basically you increase the 'count' parameter under the reformat component to
give yourself 3 outputs. Then you define separate
transformations for each output where you only
pass records that match your criteria (ex: if (string_substring(city,1,)=='S')). Each transform will reject records that don't match your criteria.

RabbitChaser
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top