understanding Rountine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

understanding Rountine

Post by karthi_gana »

All,

What this below routine will do?
what is the purppose of this routine?

RoutineName: InputFileList
Argument Name: FileName

*Ans = ""
DFILE = TRIM(FileName)
OPENSEQ DFILE TO F.DFILE THEN
READSEQ REC FROM F.DFILE ELSE NULL
Ans1 = REC
Ans = 0
RETURN(Ans1)
END ELSE
* Could not open the file. It may not exist. Return empty string
END

i saw this routine is being used in a sequencer job.

in the value expression,

FileDirectory : AsOfDate : ".df_excp.lst"

what it means?
Karthik
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The routine will read the first line of the file specified in "FileName" and return that string.
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Post by karthi_gana »

ArndW wrote:The routine will read the first line of the file specified in "FileName" and return that string. ...
I have files like

df_excp1.log
df_excp2.log
df_excp3.log

i want to get these file names. I used like

"df_excp*.log" in the value expression.

will it work out?
Karthik
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No. The routine reads a single file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Post by karthi_gana »

chulett wrote:No. The routine reads a single file. ...
then How to achieve my requirement?
Karthik
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You should write a loop in a job sequence to expand that wildcard and call the routine within the loop.
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Post by karthi_gana »

ArndW wrote:You should write a loop in a job sequence to expand that wildcard and call the routine within the loop. ...
Arul, can you help me to write this loop ?
Karthik
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

karthi_gana wrote:
ArndW wrote:You should write a loop in a job sequence to expand that wildcard and call the routine within the loop. ...
Arul, can you help me to write this loop ?
Where did Arul come from?

You need an executeCommand stage to get list of files in the pattern. Also loop stages to control the flow.

Try it and ask when you hit any problem.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What else do you need to do? There must be more than just calling this routine X times. :?

Either build a looping Sequence job as noted or create a new routine that can do whatever with multiple files.
-craig

"You can never have too many knives" -- Logan Nine Fingers
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Post by karthi_gana »

chulett wrote:What else do you need to do? There must be more than just calling this routine X times. :?

Either build a looping Sequence job as noted or create a new routine that can do whatever with mu ...

I am not getting you....
Karthik
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Karthik,

could you explain for us at a high level what you want to do; perhaps there is a better approach to use. I, for one, don't understand your wishes and therefore gave up on adding to the thread. You have a routine that processes one file and returns one value. Then you asked about multiple files - but with no idea of what you are trying to achieve there is nobody here who can assist.
Post Reply