File Stage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vzmz
Participant
Posts: 36
Joined: Sun Nov 23, 2003 12:10 pm
Location: Dallas

File Stage

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
vzmz
Participant
Posts: 36
Joined: Sun Nov 23, 2003 12:10 pm
Location: Dallas

Post 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
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply