cancel
Showing results for 
Search instead for 
Did you mean: 

check if file exists in file receiver adapter

michel_dekimpe
Participant
0 Kudos

hello,

we have following scenario -> proxy to file

before appending to the file, it should be copied/renamed to a "tmp" file

xi should then append to that tmp file and copy/rename the file back to the normal name

I tried it with "Run operating system command before message processing" but

it's not working

anybody has an example on how to use those settings before/after message processing ?

regards,

michel

Accepted Solutions (0)

Answers (5)

Answers (5)

michel_dekimpe
Participant
0 Kudos

hello,

another question, anybody knows with which user xi is trying to execute the os command ?

we receive following error 'Error when executing OS command', nothing more

regards,

michel

Former Member
0 Kudos

Hi Michel,

little confused,

1) before message processing do there any file exists?

2) why should we change file name to 'tmp' and append data to that and again rename that file ?

con't we directly proceed in append mode with file name?

When we use single command say for example cp or mv (copy or move) the commands then

eg: cp %F /var/opt/data/outbound/Test/Dummy.txt

when we club commands together or try to redirect the outputs of commands

eg: cp %F /var/opt/data/outbound/Test/Dummy.txt & mv %F /var/opt/data/outbound/Test/Dummy.txt

or

cp %F /var/opt/data/outbound/Test/Dummy.txt

mv %F /var/opt/data/outbound/Test/Dummy.txt

Include all ur command in one file and call that file in the OS parameter

Regards,

Pradeep A.

michel_dekimpe
Participant
0 Kudos

Hello Pradeep,

the file should exist and should be copied first to make sure that when

the other system picks up the file, the append is done correctly

the append should be done on that copied file, later the tmp file should be copied to the normal file

the script is ok when we run it on the os, but not when called via xi

we can see in the rwb log that the script is called, but it gives and error

unfortunately we can't see the exact error, just a small message

any idea's where we could find such a log ?

Regards,

Michel

Former Member
0 Kudos

Hi,

You can use redirectional operator ">>" provided as one of the operators in DOS to create one error file on your application server in your script file to create a log of execution of each command in your file for example :

copy d:ftpfile.txt G:PIftpfile.txt >> G:PIerror.txt

The above command would create a file error,txt on the application server which would contain the log of the copy command as to whether it was succesfully executed/ error in case there was some problem when copying.

In your case what you can do is to use redirectional operator ">>" after each line of your code and redirect the output of your command to error text file to see where the problem is.

[Michael's Blog|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5814] [original link is broken] [original link is broken] [original link is broken]; would be helpful.

Hope this helps !!

Regards,

Amit

michel_dekimpe
Participant
0 Kudos

Hi Amit,

Thanks for your reply but we are using a as400 environment, not dos.

Regards,

Michel

Former Member
0 Kudos

Michel,

Have you tried using the same redirectional operator ">>" in your script as i searched over net to find redirectional operators in AS400 and i think we can use the same operator in AS400 as well.

Can you tell me if you are using the qshell script file ?

Regards,

Amit

michel_dekimpe
Participant
0 Kudos

Hi Amit,

It seems to be not working for us, we've tried it.

We are using a cl script

Regards,

Michel

michel_dekimpe
Participant
0 Kudos

Hello,

We found out what the problem was.

It seems that you have to create a command that calls the script.

So this works now, but, XI doesn't wait until the script is finished on the os.

It only calls the command and returns immediately to continue.

Does anybody know if it's possible that xi waits until the command is finished ?

Regards,

Michel

michel_dekimpe
Participant
0 Kudos

anybody has an idea on this ?

thanks

michel_dekimpe
Participant
0 Kudos

Hi André,

it's on an as400 operating system

so, we created a script that renames the file

this works when we run it on the as400 itself but not when

we call the command via xi

any idea's why this doesn't work ?

regards,

Michel

RKothari
Contributor
0 Kudos

Hello,

Check the Write option on Processing tab. Use Temporary file option instead of Directly.

you Give the file name *.tmp .

BR,

Rahul

Former Member
0 Kudos

Hi Michel,

with "Run operating system command before message processing" you can call a script on your server.

The script can check if there is a file, can rename it, etc.

Cheers,

André