How to populate filename to column name in the table

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

sreewin7
Participant
Posts: 41
Joined: Tue Sep 14, 2010 8:48 pm

How to populate filename to column name in the table

Post by sreewin7 »

Hi Floks,

I have a requirement, my source is sequential files and they want to populate filename to target table one of the column.
Provide me some logic to fulfill this requirement.

Request you to please help me to slove this issue.

Thanks
Sree
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: How to populate filename to column name in the table

Post by SURA »

Try with APT_IMPORT_PATTERN_USES_FILESET.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

As with what SURA said (if you are trying to use wildcard consumption) and within the sequential file stage, define a column to hold the filename and use the option on the sequential file stage along the lines of "Filename column"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Don't believe that's possible in a Server job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sreewin7
Participant
Posts: 41
Joined: Tue Sep 14, 2010 8:48 pm

Post by sreewin7 »

Thanks very much everyone.

I tried everything , if any one did in server job, please help me.

Regards,
Sree
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Make the file name a job parameter. Use that parameter in the Sequential File stage. Populate the "FileName" output column of a Transformer stage using the same job parameter. Of course, this only works for a single file, but you can use a sequence to loop through a set of file names.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

I am not aware that variable is not for Server jobs. I am sorry for that; but did you try to add that variable in the job level and make the default value to 1?

Just interested to see what is a happening?
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Any environment variable with APT_ at the beginning of its name applies to the Orchestrate engine (and therefore to parallel jobs only). The same goes for environment variables whose name begins with OSH_.

APT comes from "Applied Parallel Technologies", the name of the company that invented the parallel engine technology before they became Torrent Systems, which was acquired by Ascential Software in about 2003.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

Hi Ray

Thanks for the clarification. Now i understood.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
sreewin7
Participant
Posts: 41
Joined: Tue Sep 14, 2010 8:48 pm

File_name issue is not resolved.

Post by sreewin7 »

Thanks every, still my issues is not resolved.

Is any other way to finish this task.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What about Ray's advice? Are you not passing in the filename to read as a job parameter? If so, simply leverage that in the appropriate column.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sreewin7
Participant
Posts: 41
Joined: Tue Sep 14, 2010 8:48 pm

Post by sreewin7 »

Thanks, here my situation is not static it is dyamically changes for every file.
Kindly advice.

Thanks
Sree
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Of course, no-one assumed it was static. Answer this: how does the job know what filename to use each time it runs? Is the current filename passed in as a job parameter or are you using some other mechanism?
-craig

"You can never have too many knives" -- Logan Nine Fingers
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: How to populate filename to column name in the table

Post by SURA »

How you are going to get the file names?

OR

Every day set of files will be placed in the folder and need to load that?

Is that all the files to the same table / different tables?

So lot of questions behind this!

Though, there are different ways to handle this!

You can use Sequence / routine to achieve this.

You can search for server routine loop / basic code loop and use that to achieve that.

If you are not good with routine, then go for sequence.

Code: Select all

1)cmd activity stage-->2)StartLoop-->3)GetFileName-->4)JobToLoadData-->5)EndLoop
You can use the Unix commands to find out how many jobs you are going to use to run? That count can be the loop counter.

What you have tried so far?

What is your approach?

share with us. Some one will fine tune / correct it
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
sreewin7
Participant
Posts: 41
Joined: Tue Sep 14, 2010 8:48 pm

Re: How to populate filename to column name in the table

Post by sreewin7 »

chulett
-Sorry for not providing full description.
SURA
- Yes, they are posting total files along with trigger file in one folder ,based on the module.
And i am trying with your logic, and update the status.
Ray -Thanks for your clarification and Thanks every one.

Regards,
Sree
Post Reply