Hi,
I tried using Folder stage in my job to use a set of Files in a folder and post in a seq File / Table. it is a CSV file. When I run the Job, I either get only the Column Names or Column Names and fields in the Resulting File. How do I use the Folder stage to Extract the required Fields
Victor Auxilium
Folder Stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Take a look at the properties of the Folder stage in Manager, or from the Repository view in Designer. There are two "columns". One is the "key" which, from the O/S point of view, is the file name. The other is the "record" which, from the O/S point of view, is the entire file. The second of these is of limited use, though can be parsed within a DataStage job. The Folder stage is really intended for the "see what file names are there" kind of operation.
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Hi,
This is what I did as same as your requirement. First, I created a job using the Folder Stage with output column (1) Docname (filenames) to a sequential file then I transferred this to a hash file in the same Job. Then, I created another Job (Job3), which will accept the File name & File path as a Input parameter. The In a Script I read this Hash file and pass the file name to Job3.
Thiruma Valavan.
This is what I did as same as your requirement. First, I created a job using the Folder Stage with output column (1) Docname (filenames) to a sequential file then I transferred this to a hash file in the same Job. Then, I created another Job (Job3), which will accept the File name & File path as a Input parameter. The In a Script I read this Hash file and pass the file name to Job3.
Thiruma Valavan.
Best Regards,
Thiruma Valavan
Thiruma Valavan
Hi,
I want to point out that the folder stage has a file size limit (probably configurable).
It will cause errors, if I'm not mistaken, in cases any file exeeds the limit.
Hence I would prefer to use any DSExecute() flavour via DSRoutine toget the list of file you need, especially if they might be really big ones.
( up to 100 MB is usually fine maybe even more but around 150-200+ MB your in trouble )
IHTH (I Hope This Helps)
I want to point out that the folder stage has a file size limit (probably configurable).
It will cause errors, if I'm not mistaken, in cases any file exeeds the limit.
Hence I would prefer to use any DSExecute() flavour via DSRoutine toget the list of file you need, especially if they might be really big ones.
( up to 100 MB is usually fine maybe even more but around 150-200+ MB your in trouble )
IHTH (I Hope This Helps)
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DataStage (and therefore DataStage BASIC) has the quirky ability to treat a directory (folder) as a "table". This is the underlying premise of the Folder stage. You can do the same thing in DataStage BASIC. If the O/S directory is seen by DS as a table, then each file name in that directory is seen by DS as a record key, and each file in that directory is seen by DS as a "record" - even though it's unlikely that every record has the same structure.
Use OpenPath to open the directory, Select to generate a list of file names, and ReadNext to process that list. For example:
Use OpenPath to open the directory, Select to generate a list of file names, and ReadNext to process that list. For example:
Code: Select all
$INCLUDE UNIVERSE.INCLUDE FILENAMES.H
OpenPath "/usr3/datastage/hashedfiles" To filevariable
Then
Clearselect 10
Select filevariable To 10
Loop
While ReadNext FileName From 10
FilePath = "/usr/datastage/hashedfiles/" : FileName
Cmd = UV.BIN : UV.FSEP : "clearfile " : FilePath
Call DSExecute("UV", Cmd, Output, ExitStatus)
Call DSLogInfo(Output, "MyRoutine")
Repeat
End
Else
Msg = "Can not open /usr3/datastage/hashedfiles"
Call DSLogWarn(Msg, "MyRoutine")
End