cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic File Name for Operating System Command

0 Kudos

Hello Experts,

I have Proxy-PI-FILE scenario in which the target File Name is obtained from sending system and added to the Header DynamicConfiguration segment within Message Mapping so the receiver file adapter can takes it by using the Adapter Specific Message Attributes.

The files are being written in a PI local folder by using NFS mode and then, through an Operating System Command (script), moved to an external FTP location.

The ftp script is already in use by another interfaces, will be executed in "Run Operating System Command After Processing" section, and it expects 2 parameters: SourceFileName and TargetFileName.

As in configuration time the target file name is unknown, is it possible to use something like "<ftpScripName> %F %F" so the File gets stored in the FTP location with the same name as it was temporarily stored in PI local folder by the Comm. Channel through the Dynamic Configuration FileName value?

Thank you very much for your help.

Best Regards,

Fran

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

The best way is to try it out , check this doc (pg 11), where dynamic filename is given at OS command line field. here the FTP command is given/ run directly, in your case it is a script.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/bd994384-0a01-0010-92b5-c54f5a1d8...

good luck,

Regards

Vishnu

Answers (1)

Answers (1)

Former Member
0 Kudos

%F for both source and target file will look like this (just an example) if the internal message file for PI is /tmp/filename.txt:

<script> /tmp/filename.txt /tmp/filename.txt

So the file will be written to the same location you got it from.

Therefor <script> %F %F will not work.

As i do not know the content of the script i can only guess the following.

If providing a target directory as second parameter you could just add the target directory if the target location is always the same.

But more information would be necessary to give a more proper advice.

Best regards,

Peter

Former Member
0 Kudos

Hi Peter,

nice point, as there is always a shade of doubt on what is in the script... but normally (from his above post), he talks about FTPscript, so it is expected that the servers are different and in the other (FTP) server the file is stored in a similar path as in the source with same filename..

but then Fran has to try it out and comment.

Regards

Vishnu

0 Kudos

Thank you very much for your responses.

The FTP connection (host and login details) are also sent as parameters and included in the script code, from where the ftp connection is being made.

I was just referring to the way the the Dynamic File Name can be passed as a parameter so I should not set it statically in the command call within the channel configuration.

I will try by putting "<scriptName> %F %f", as I just want to assign the same file name (%f) but send it to a different target host (file name will include it, as the target is a based on a mainframe platform).

I will confirm once is done.

Best Regards,

Fran