Specify File Pattern for Sequential files

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
lazydev
Participant
Posts: 1
Joined: Sat Jul 04, 2009 2:48 am

Specify File Pattern for Sequential files

Post by lazydev »

I have three files named fileA.txt,FileB.txt,FileC.txt

I want to read all the files at a time and process them into the other table.

In The Properties Tab

Under Source :-

FILEPATTERN :- C:\DXFILES\File?.txt
READMETHOD :- filePattern .

But i am not able to read all the three files .

What would be the expresssion to read all the files .I think it's ? or anyother .
Thanks
Jack
mithun.mg
Participant
Posts: 11
Joined: Thu Feb 22, 2007 6:04 am
Location: banglore

Re: Specify File Pattren for Sequential files

Post by mithun.mg »

lazydev wrote:I have three files named fileA.txt,FileB.txt,FileC.txt

I want to read all the files at a time and process them into the other table.

In The Properties Tab

Under Source :-

FILEPATTREN :- C:\DXFILES\File?.txt
READMETHOD :- filePattren .

But i am not able to read all the three files .

What would be the expresssion to read all the files .I think it's ? or anyother .

Hi Lazydev,

Use * instead of the "?" then you will be able to read the files using the file pattern in sequential file stage.

FILEPATTREN :- C:\DXFILES\File*.txt
Thanks & Regards
MITHUN M G
ETL Devloper
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Technically that "?" should work as it is a wild-card match for any single character which you have in your 1,2,3 differentiator. It works fine from DOS but perhaps the stage doesn't allow or 'understand' it.

As noted, you can fall back on the 'splat' or asterisk to mean 'any number of characters' from that point to the dot. So not only would it match

FileA.txt
FileB.txt
FileC.txt


It will also match FileAAA.txt which your first choice would not, hopefully that's not a problem.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Maybe you can explain what you do mean by
But i am not able to read all the three files .
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

Give the name of your three files
Nag
lshort
Premium Member
Premium Member
Posts: 139
Joined: Tue Oct 29, 2002 11:40 am
Location: Toronto

Post by lshort »

I have the same issue:

Can read multi file if specifed seperately use -File option.

File = D:\IBM\InformationServer\Server\SeqFiles\NameAmountDate2.csv
File = D:\IBM\InformationServer\Server\SeqFiles\NameAmountDate3.csv
Read Method = Specific Files

-File Pattern option does not function with (?) nor (*) as referenced in documentation.

Example:

FilePattern = D:\IBM\InformationServer\Server\SeqFiles\NameAmountDate?.csv
Read Method = File Pattern

Windows 2003 Server
version 8.1
Lance Short
"infinite diversity in infinite combinations"
***
"The absence of evidence is not evidence of absence."
ddevdutt
Participant
Posts: 47
Joined: Wed Aug 22, 2007 2:38 pm

Post by ddevdutt »

In fact as Craig specified, both "*" (asterisk) and "?" work just fine. It depends on what your requirement is.

1. "?" - used to replace a single character.

For Example:
File1 = /TestPath/File1.txt
File2 = /TestPath/File2.txt

These files can be read as follows:
File Pattern: /TestPath/File?.txt
OR
File Pattern: /TestPath/File*.txt

2. "*" - used to replace any number of characters.

For Example:
File1 = /TestPath/Yahoo_File.txt
File2 = /TestPath/Google_File.txt

The above files can be read as follows:
File Pattern: /TestPath/*File.txt
DD

Success is right around the corner
ddevdutt
Participant
Posts: 47
Joined: Wed Aug 22, 2007 2:38 pm

Post by ddevdutt »

I just happened to notice that the two people who have problems reading the files using File Pattern are both on Windows. Not sure if it has anything to do with that.

I have no problems reading those files, but I'm using V8.1 on Linux.
DD

Success is right around the corner
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'd noticed the same thing - this somehow seems to be a Windows issue. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
siauchun84
Participant
Posts: 63
Joined: Mon Oct 20, 2008 12:01 am
Location: Malaysia

Post by siauchun84 »

I am a windows user and I have no issue in using the pattern when the input files was in fixed width and all the column type in the files defination have been set it to char and no nullable.
Those who have issue on it, may I know the input files setting of it?
Have you tried changed the "\" to "/" for the file path?
Post Reply