Page 1 of 1

Concatination of two command outputs as a filepath

Posted: Mon Jul 27, 2009 5:26 am
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

Posted: Mon Jul 27, 2009 5:40 am
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

Posted: Mon Jul 27, 2009 6:28 am
by chulett
Try:

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

Posted: Mon Jul 27, 2009 6:43 am
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.

Posted: Mon Jul 27, 2009 8:48 am
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#)