Welcome Guest ( Log In | Register )


 
Closed TopicNew Topic
Can Integrator remove trailing CRLF?, Filenames being routed to integrator with CRLF, Integrator chokes.
Tony
post Nov 7 2008, 04:12 PM
Post #1


Regular Contributor
***

Group: Members
Posts: 44
Joined: 6-November 08
From: Washington, D.C.
Member No.: 50


Hi there, using XFB to route a file to XIB that we pull using a Transfer model/decision rule that parses the names from a DIR listing and then pulls them, we encounter an issue with the files being pulled with a CRLF appended to the filename. It routes to integrator and processes without difficulty, but when integrator attempts to route it to an internal FTP site, it chokes because of the CRLF at the end.

Does anybody know a way to trim this?

Thanks,
Tony


--------------------
[i][size=2]--
Tony Lloyd
Sr. Axway Consultant
Washington DC Area
Mobile: 703-261-4449
Go to the top of the page
 
+Quote Post
Rhenus ICT Servi...
post Nov 10 2008, 03:12 PM
Post #2


Regular Contributor
***

Group: Members
Posts: 33
Joined: 6-November 08
Member No.: 82


Hi Tony,

I just did a quick test with a filename + CR/LF and the RENAME-statement in the FTP Send Script of XIB does have problems
with the CR/LF.

Yes, it's possible to remove unwanted characters from a filename:

1) Make a custom MBC that has the FTP Send as a next activity.
In this custom MBC you have to extract the original filename from the FTP ReceiveInfo Attributes:

CODE
FOR $i_Attribute = 1 TO ARRAYSIZE($AttributeNames)
{
   $AttributeValue = MBC_HIERCHMSGENV.GetAttribute($SessionId, $MessageId, $AttributeNames[$i_Attribute]);

   # FTPReceiveInfo
   IF $AttributeNames[$i_Attribute] = TA_FTP.$ReceiveInfoAttribute
   {
      $ftpinputattribute = TA_FTP.UnpackReceiveAttribute($AttributeValue);
      $InputFilename = $ftpinputattribute.$RemoteFilename;
   }
}


2) Now you can remove the CR/LF from the $InputFilename variable.
3) Use the 'clean' filename as output filename using the FTP Send Override Attributes:

CODE
# Set the filename for outgoing FTP Transfers
$ftpOverride.$Use_RemoteFilename = $TRUE;
$ftpOverride.$RemoteFilename     = $OutputFilename;

# Pack the record.
$ftpOverrideString = TA_FTP.PackSendMethodOverrideAttribute($ftpOverride);

# Set the attribute.
MBC_HIERCHMSGENV.SetAttribute $SessionId
   MessageId $NewMessageId
   Name TA_FTP.$SendMethodOverrideAttribute
   Value $ftpOverrideString;


I hope these hints will help you!
Go to the top of the page
 
+Quote Post
Gwenaël Kergunte...
post Nov 12 2008, 08:40 AM
Post #3


Visitor
*

Group: Members
Posts: 6
Joined: 31-October 08
From: Paris, France
Member No.: 15


QUOTE (Rhenus ICT Services @ Nov 10 2008, 04:12 PM) *
Hi Tony,

I just did a quick test with a filename + CR/LF and the RENAME-statement in the FTP Send Script of XIB does have problems
with the CR/LF.

Yes, it's possible to remove unwanted characters from a filename:

1) Make a custom MBC that has the FTP Send as a next activity.


If you are using Integrator V3.x, you can also do it in a Map Broker.
%sFileName := getStringAttribute("FTPReceiveInfo", "RemoteFileName");
%iCRLFPosition := index(%sFileName, "\n");
%sFileName := getStringLeft(%sFileName, %iCRLFPosition - 1);

You will have the real file name, without the CRLF.

Also, you can try the following, even more simple if it works !
%sRealFileName := trimString(getStringAttribute("FTPReceiveInfo", "RemoteFileName"), "\n");

Finally, you just need to set the attribute :
setAttribute("FTPSendMethodOverride", %sRealFileName);
Go to the top of the page
 
+Quote Post
Tony
post Nov 12 2008, 05:29 PM
Post #4


Regular Contributor
***

Group: Members
Posts: 44
Joined: 6-November 08
From: Washington, D.C.
Member No.: 50


Thanks to both of you. We're in 2.1.1. so I'll give the MBC thing a shot!

QUOTE (Gwenaël Kergunteuil @ Nov 12 2008, 02:40 AM) *
If you are using Integrator V3.x, you can also do it in a Map Broker.
%sFileName := getStringAttribute("FTPReceiveInfo", "RemoteFileName");
%iCRLFPosition := index(%sFileName, "\n");
%sFileName := getStringLeft(%sFileName, %iCRLFPosition - 1);

You will have the real file name, without the CRLF.

Also, you can try the following, even more simple if it works !
%sRealFileName := trimString(getStringAttribute("FTPReceiveInfo", "RemoteFileName"), "\n");

Finally, you just need to set the attribute :
setAttribute("FTPSendMethodOverride", %sRealFileName);



--------------------
[i][size=2]--
Tony Lloyd
Sr. Axway Consultant
Washington DC Area
Mobile: 703-261-4449
Go to the top of the page
 
+Quote Post
Rhenus ICT Servi...
post Nov 20 2008, 02:50 PM
Post #5


Regular Contributor
***

Group: Members
Posts: 33
Joined: 6-November 08
Member No.: 82


I'm not an Integrator v3 programmer, but I think the following line:
CODE
%iCRLFPosition := index(%sFileName, "\n");

should be:
CODE
%iCRLFPosition := index(%sFileName, "\r");

Please correct me if i'm wrong...
Go to the top of the page
 
+Quote Post

Closed TopicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Skin designed by IPB Forum Skins