Page 1 of 1

File Stage

Posted: Wed Feb 18, 2004 2:43 pm
by vzmz
Hi friends,
I have a file "xyz02182004", which come every month(i.e monthly). I have to design a job which will run monthly. I took a file stage on this file and started validation on this file using a transformation. The problem is this file name gonna change next month but the validation process gonna be same. The file name are been suffixed by the date but the initially name or the patten remains fixed like xyz.
Can i write the file path as "\app\dump\monthly\xyz*.txt" and every time when a job is run it reads xyz02182004 file.
Thanks

Posted: Wed Feb 18, 2004 2:55 pm
by kcbland
Just setup a symbolic link to point to the appropriately named file. This allows your job to have a fixed name, and the symbolic link switches between files. An alternative is to copy the landed file into a processing directory under the fixed name.

Posted: Wed Feb 18, 2004 3:49 pm
by vzmz
kcbland wrote:Just setup a symbolic link to point to the appropriately named file. This allows your job to have a fixed name, and the symbolic link switches between files. An alternative is to copy the landed file into a processing directory under the fixed name.
What is a symbolic link (is it another stage) how do i do that

Posted: Wed Feb 18, 2004 4:27 pm
by ogmios
vzmz wrote:
kcbland wrote:Just setup a symbolic link to point to the appropriately named file. This allows your job to have a fixed name, and the symbolic link switches between files. An alternative is to copy the landed file into a processing directory under the fixed name.
What is a symbolic link (is it another stage) how do i do that
Just pitching in. A symbolic link is a file that is "pointer" to the original file in UNIX. You make it (in UNIX, not in DataStage) with:

Code: Select all

ln -s original_file link_name
Instead of using links we usually make the name of the file a parameter in the real job and have the controlling job resolve the filename, either by calculating the file name if you're sure of it as file200401.txt, file200402.txt, ... or by scanning the directory where the file will appear.

The scanning of a directory we normally do via a UNIX script which then runs dsjob passing the name of the file to the controlling job, ...

Ogmios

Posted: Wed Feb 18, 2004 5:35 pm
by kcbland
vzmz wrote:
kcbland wrote:Just setup a symbolic link to point to the appropriately named file. This allows your job to have a fixed name, and the symbolic link switches between files. An alternative is to copy the landed file into a processing directory under the fixed name.
What is a symbolic link (is it another stage) how do i do that
ogmios is correct in the explanation of a symbolic link. If you have a directory like:

Code: Select all

/tmp/file_1
/tmp/file_2
/tmp/file_3
/tmp/file_4
You could create a link to point fred to the appropriate file:

Code: Select all

ln -s /tmp/file_1 /wherever/fred
Your DataStage job accesses /wherever/fred. There is no effort or conflict with doing this. Symbolic links are a highly common practice in unix environments. It's a better option than moving or copying files around. You can remove a link and point it to the next file:

Code: Select all

rm /wherever/fred
ln -s /tmp/file_2 /wherever/fred
The advantage of using a link or a copy is that your job has a fixed filename, as opposed to a parameter. This means when you save metadata, your "file" name has a corresponding metadata item. A parameter more convoluted.