Concatination of two command outputs as a filepath

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
tanmaya
Participant
Posts: 38
Joined: Tue Jun 16, 2009 7:57 am
Location: Bangalore

Concatination of two command outputs as a filepath

Post by tanmaya »

Hi,

I am using 2 different execute command activities in a sequence job in DS 8.1.

1) First execute command activity returns me the system date in the format of yyyymmdd (eg: 20090727).

2) Second execute command activity reads a file in unix and returns me a string (eg: LOCATION)


Now the difficulty that i am facing is that I am using a wait for file activity in the sequence job ahead. And this activity waits for the file in a certain folder. The name of the file is the combination of the returned values of execute command 1 and execute command 2.


therefore for the file path in the wait for file activity i need to give something like

FILEPATH : /Data/#Execute_Command_1.$CommandOutput#_#Execute_Command_3.$CommandOutput#.csv

which should ideally be coming out to be in the following format.

FILEPATH: /Data/20090727_LOCATION.csv

but when i run the job it does not concatenate the output from the two execute command activity and it is only taking the value from the first execute_command. Which is something like this

FILEPATH: /Data/20090727

here _LOCATION.csv is not being taken by the datstage engine.

please help me with this issue.

Thanks in advance

Tanmaya
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

try to see if secong execute activity stage is producing desired result or not .

Another option is you can use in single execute activity stage ...

and write a command like

path/`date +"%Y%m%d` ..Hope this helps you
Nag
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Try:

FILEPATH : /Data/#Execute_Command_1.$CommandOutput<1>#_#Execute_Command_3.$CommandOutput<1>#.csv
-craig

"You can never have too many knives" -- Logan Nine Fingers
BugFree
Participant
Posts: 82
Joined: Wed Dec 13, 2006 6:02 am

Post by BugFree »

tanmaya,

Can you just check your director log for these 2 command output.
I think the the Command output will write the output with the newline character at the end. If so, your concatination will not give correct result.
Use field function to get the correct result and then try to concatinate. Let me know any progress on the workaround.
Ping me if I am wrong...
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Actually there will be a field mark at the end. The syntax in Craig's post should work.
You can also use convert like
convert(@FM,'',#Execute_Command_1.$CommandOutput#)
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply