IBM Support

Doesn't OdetteFTP's "Virtual Filename Pattern" in B2B work for you?

Technical Blog Post


Abstract

Doesn't OdetteFTP's "Virtual Filename Pattern" in B2B work for you?

Body

While configuring Odette FTP (OFTP) profile for an inbound flow, it is always mandatory to ensure that there is only one Logical Partner Contract(LPC) is identified for a given incoming message. If not, message will be rejected. Here is how an LPC is located for a given incoming message in SB2Bi.

Screen captured from SB2Bi Create LPC documentation

image

Peeking into this criteria, it is quite apparent that "Receive Virtual Filename Pattern" is an important configuration, in complex OFTP profile configuration, to identify one single LPC for an inbound flow. And is configured through LPC itself and it must be "Regular Expression" as mentioned in above screenshot from SB2Bi documentation. Often times, users forget the fact it must be valid Regular Expression (RE); they tend to use normal wild card sequence and that might result in process failures as in 0 or more than one LPCs located.

With some knowledge of Regular Expressions, it is easier to use right expression for the given use case or inbound flow. Here are some sample Regular Expressions (RE) that can be used as "Receive Virtual Filename Pattern" in LPC.

1. * is not a valid RE. One of the following represents string/text/filename comprised of any characters.
^.*
^.*$


2. myfile[0-9] represents text starts with "myfile" and is followed by one single digit.
It covers myfile0 through myfile9 ONLY.

 

3. myfile[0-9]* represents text starts with "myfile" and is followed by any number of digits.
e.g., myfile9, myfile99, myfile999, myfile9999 and so on

 

4. myfile[0-9]? represents text starts with "myfile" and is followed by either one digit or no digit.

It covers myfile and myfile0 through myfile9 ONLY

 

5. myfile* is not valid RE. Where as myfile.* is valid and it covers any text followed by "myfile".
e.g., myfile.txt, myfile$, myfile100, myfile2015may-05 etc
 

Few more followed.....

- What is the RE for filename my.file?

my\\.file

- What is the RE for MYFILE-1000XY or MYFILE-287YZ or similar.

MYFILE-.*

Following tool (java class) would help to validate whether Regular Expression for a given text/string is valid. Please be aware that execution of this tool requires basic knowledge of running java classes.

// StringMatches.java

public class StringMatches {

public static void main( String args[] ){
if(args.length < 2) {
System.out.println("Usage: java StringMatches <filename> <regular-expr>");
System.exit(-1);
}

boolean result = args[0].matches(args[1]);
System.out.print(args[0]);
System.out.print((result?" matches ":" does not match "));
System.out.println(args[1]);
}
}

$ javac StringMatches.java

$ java StringMatches

Usage: java StringMatches <filename> <regular-expr>

Some sample executions

image


Please post if you have any questions on this topic or something is unclear. Thanks for reading through.


Here are some of the OdetteFTP based articles from IBM SB2Bi product.

http://www-01.ibm.com/support/docview.wss?uid=swg27041976

https://www-304.ibm.com/connections/blogs/SterlingB2B/entry/oftp_secure_auth_ibm_sb2bi?lang=en_us

https://www-304.ibm.com/connections/blogs/SterlingB2B/entry/oftp_ssl_b2bi?lang=en_us

 

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SS3JSW","label":"IBM Sterling B2B Integrator"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

UID

ibm11120629