IBM Support

Understanding Sterling File Gateway Facts

Technical Blog Post


Abstract

Understanding Sterling File Gateway Facts

Body

The recent Broadcasting in Sterling File Gateway helped demystify various methods for broadcasting but left at least one participant scratching their head over the fact names and file pattern names. Where are keywords or facts like ConsumerBroadcastGroup, myFilename, ProducerName documented? It's simple to say they're in the IBM Sterling File Gateway Infocenter but maybe not quite obvious as to where. If you look into the Routing Channel Template section they are listed.

These seemingly strange combinations of curly brackets {}, pre-defined names, etc. make a relatively simple process more confusing. Let's break this down into System Fact Names, Provisioning Facts, Producer File Structure, File Format Expressions, Delivery Channels and Consumer File.

System Fact Names include ConsumerName, ConsumerCode, ProducerFilename, ProducerName, ProducerCode, RoutingTimestamp and ConsumerPgpExtension.

Provisioning Facts provide a way to customize routing channels (RCs) within the context of a particular routing channel template (RCT). User-created facts MUST start with the lower case "my" and the valid characters are alphanumeric in English ONLY plus the hyphen (-) key. I've been told the first character following the "my" should be capitalized for example ${myFactname}.

Producer File Structures contain a description of the basic content structure and naming conventions for files the producer sends. The default is /${ProducerName} but the infocenter help provides additional examples

File Format Expressions are also discussed in the infocenter Producer File Structure and patterns.

For Delivery Channels the mailbox name pattern can be specified using the following:

  • System facts (for example, /${ConsumerName}/Inbox) where the actual name would be determined dynamically
  • Explicit strings (for example, /${ConsumerName}/myInbox)
  • Provisioning facts (for example, /${ConsumerName}/${myUserName} that are specified on the Provisioning Facts tab of the Routing Channel Template wizard
  • A combination of system facts, explicit strings, and provisioning facts. The mailbox pattern must always start with /${ConsumerName}

While the consumer file structure uses the same set of System Fact Names listed above plus ConsumerFilename as shown in this section of the IBM Sterling File Gateway infocenter. The infocenter provides a "file format in regular expression" example but fails to mention what the \p and \d denote. Instead there's an early note to search the internet for "regular expressions are a standardized pattern matching language"

EXAMPLE ONE:

(\p{Alpha}+)(\p{Digit)+)[.]TXT

\p means a single character, the type is specified in the {} that follows so \p{Alpha} expects a single A-Z character. Leave off the \p means any number of characters are allowed.

+ that follows the \p{Alpha} is contained within parenthesis so this indicates it is ONE custom fact and the next custom fact can now follow it (because of the +)

the (\p{Digit}+) means a single 0-9 digit is expected and again the + modifies this to include the expression that follows

The square brackets [.]with the dot means the following is to be read literally; not as a variable.

What kind of file would this produce? A 2 character file with the .TXT extension. The first character being A-Z, the second character 0-9 then .TXT

Suppose you want to be able to accept files like PRODUCT20141121.TXT or Lot20141121.TXT then this should work:{ (a-zA-Z)(0-9).txt }

EXAMPLE TWO (from the Infocenter)

(\p{Alnum}+[-_]?(\d{4})_(\d{2})_(\d{2})\.zip)

where:
  • the full expression, (\p{Alnum}+[-_]?(\d{4})_(\d{2})_(\d{2})\.zip), = capturing group 1 with fact = "mySanitizedFilename"
  • (\d{4}) = capturing group 2 with fact = "myFileYear"
  • (\d{2}) = capturing group 3 with fact = "myFileMonth"
  • (\d{2}) = capturing group 4 with fact = "myFileDay"

Where did the A1num come from you ask? If you look back at the link of regular expressions you will find the following table:

image

Feel free to respond with some of your own nifty expressions you've used in your templates!

[{"Business Unit":{"code":"BU012","label":"WCE"}, "Product":{"code":"SSMHNK","label":"IBM Sterling B2B Integrator"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11120803