cancel
Showing results for 
Search instead for 
Did you mean: 

Create .txt empty file After Message Processing Command Line Linux command

sridharreddy_kondam
Active Contributor
0 Kudos

Hi All,

An empty .txt file has to be created in FTP location(FTP loc c:\xyz\Customer20082910.txt) only after the .dat file has been created(FTP loc c:\xyz\Customer20082910.dat)

Note:.dat has the actual data and .txt is an empty file and is created only after .dat is created

I know that .txt empty file can be created using the After Message Processing Command Line...

But confused which command to be given such that it will be created in the FTP location(c:\xyz\Customer20082910.txt)

Can any one please give the Linux command for it...

Regards,

Sridhar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey

OS commands triggered by File receiver communication don't run on FTP,they run on NFS.

If you want to handle this via File adapter,then use the "Use temporary file" option in the mode instead of OS scripts.

If you want to use a script then run the script via a scheduler on FTP itself,it will run Independent of XI adapter(wont be called from File receiver communication channel).

Thanx

Aamir

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Aamir,

You are right ...

I have already used Use Temporary file and the .dat file is created only after all the data has been transferred...

But still our client needs the .txt to be created once the .dat has been created...

So should i suggest the Client to create shell scripts at FTP location so that whenever .dat has been created an .txt has to be created...

Or is there any other way which i can handle...

Please suggest...

Regards,

Sridhar

Former Member
0 Kudos

>>So should i suggest the Client to create shell scripts at FTP location so that whenever .dat has been created an .txt has to be created...

Yes,this is the best approach.Do not connect to FTP server from XI machine and then run the script there,technically speaking its possible to do it but is always discouraged coz your script will reside on XI system but will run on FTP.Its the same way as an external system gets control of your PC and then run scripts on it remotely.I bet your client doesn't want this to happen to his system

Thanx

Aamir

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Aamir,

Thanks for the suggestion, I will ask my client to create a shell script at FTP server...

And one more question,

This is reverse side , now the .dat file is to be picked only if .txt exists at the FTP server (scenario File > XI>SAP) (earlier was SAP>XI>File)..

So please can you suggest for this also...

How can i check for the .txt and pick corresponding .dat file...

i had posted question long back

Regards,

Sridhar

Former Member
0 Kudos

Hi

As Amir suggested better approach is to create script at FTP server and execute.

You can do like this to connect to FTP in script


#!/bin/sh
HOST='ftp hostname'
USER='id'
PASSWD='yourpw'
FILE='file.txt'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit 0

Thanks

Gaurav

Former Member
0 Kudos

>>now the .dat file is to be picked only if .txt exists at the FTP server

We had the exact same issue some time ago:)

This will be a very simple script too.ask the sender system to write the complete file in a .txt file itself(no need of both .dat and .txt at the same time).then in the end just rename this .txt file to .dat file and XI can pool for *.dat file.

I guess they are using .dat and .txt because they want to make sure that you don't pick up half written files.

Thanx

Aamir

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Aamir,

Thanks for your suggestion, and even i had seen your answers to my earlier thread on the same issue...

And i think the best solution is to go as you suggested..

and please can you tell what are the disadvantages in using shell script for FTP server and calling them from XI...

This i need to explain to the client ... please send your valuable suggestions...

Regards,

Sridhar

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Gaurav,

Thanks for your reply,

As per Aamir he suggesting to ask the client to create shell scripts at FTP server and it will be scheduled at FTP server only such that whenver .dat is created FTP itself creates .txt and XI will not call any shell script... but The FTP server takes care...

Aamir can you please confirm this if i understood was right

Regards,

Sridhar

Former Member
0 Kudos

Hi

Always Welcome !!!

I think you understood it correctly

Thanks

Gaurav

Former Member
0 Kudos

Sridhar,

This requirement can be handled using standard functionality of XI itself. Just use multiple inbound interfaces and select the option "Maintain Order at run time". The second inbound interface will contain its own mapping (probably dummy one)

Regards

Jaishankar

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Jai Shankar,

Can you please elaborate more...if i use two Inbound Interfaces then i need to create two Communication Channels... Am i right..

and note that .txt an empty file to be created only after .dat is created...

Regards,

Sridhar Reddy

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Jai,

I even tried the way you said but that would not work... as we will not be able to create an empty file... but ends up only with the IDOC data also filled in it eventhough no Mapping i used ..

If any inputs from you please suggest..

Regards,

Sridhar

Answers (3)

Answers (3)

sridharreddy_kondam
Active Contributor
0 Kudos

Solved ,

As we suggested the client to write the scripts at their FTP server to create .dat files....

Former Member
0 Kudos

Hey Sridhar

The OS Command for the file adapter only runs on the system in which the Adapter Framework is running.

Using Shell Script execution it is possible to put file on FTP. You can execute Shell Script in XI box. Inside your shell script you can FTP/S FTP program and connect to the remote server and create file.

If you are doing like this, then you need to dump the file into XI box using NFS protocol and then using shell script FTP the Files into FTP server.

Thanks

Gaurav

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Gaurav,

Please can you give the shell script code to handle this...

or suggest with e.g on how to handle this...

I dont have any idea or knowledge on how to use shell script..

It would great helpful if you give ex.

Regards,

sridhar

Former Member
0 Kudos

Hi

cat > filename.txt to create a file

cp firstfile secondfile copy file

mv thirdfile file3 renaming file

rm file3 removing file

Thanks

Gaurav