Skip to main content


class EnsLib.EDI.X12.Operation.FileOperation extends EnsLib.EDI.X12.Operation.BatchStandard

Property Inventory

Method Inventory


parameter ADAPTER = EnsLib.File.OutboundAdapter;
Inherited description: The type of adapter used to communicate with external systems


property Filename as %String (MAXLEN = 1000, MINLEN = 1) [ InitialExpression = "%f_%Q%!+(_a)" , Required ];
Name of file to output the document(s) to.
Consists of literal characters and zero or more format codes. A format code is preceded by a percent sign (%); characters that are not part of a format code are output unchanged.
The %f or %F specifier if present will be replaced with the name of the document's original source stream (stripped of characters illegal in filenames).

Timestamp format codes are documented in the method FormatDateTime() in class Ens.Util.Time
. The additional format code '+' is supported to guarantee filename uniqueness by incrementing a counter string. This additional code is supported in the following forms, where nn is an alphanumeric counter string of 0 or more characters:

  • %+(nn) - Increment nn until the generated filename does not exist in the target directory specified by pDirectory
  • %#+(nn) - Increment nn omitting leading non-significant 0/a characters
  • %!+(nn) - Only use nn if the base filename already exists
  • %#!+(nn) or %!#+(nn) - Omit nn if the filename without it does not exist already, otherwise use nn but omit leading non-significant 0/a characters within it
  • %$+(nn) - increment nn without testing for existence of the resulting filename; then re-increment while the resulting filename exists
  • %#$+(nn) or %$#+(nn) - increment nn regardless without testing for existence, omitting leading non-significant 0/a characters

  • Thus the '#' character means to output only the rightmost significant (non-zero,non- a/A) alphanumeric characters, the '!' means to only use nn if needed to create a unique local filename, and '$' means to increment nn for each call regardless of the local filesystem. The '$' form can be used to generate a series of filenames on a local or remote filesystem. This form relies on a counter variable in $$$EnsStaticAppData("Ens.Util.File:CreateTimestamp").
    The counter string nn may also contain non-alphanumeric characters. If these are present they are output unchanged as literal characters. To ensure a unique filename, first the filename including string nn is checked for existence, and if that already exists the string is incremented in its rightmost alphanumeric character first. Digits are incremented in the range 0-9, and alphabetic characters are incremented in the ranges a-z and A-Z. If the entire range represented by nn is exhausted, additional digits/letters will be prepended as needed.
For example, the string %F_%Q_%!#+(.a1) means the the document's original source stream is used with a timestamp appended, and if a file like that already exists then .1 is further appended, and if that also exists already then .2 is appended, and so on, up to .9, then to .a1, then up to .z9, and beyond that to .az1 and so on. Only one '%+' format code is supported.
The timestamp string used always reflects the current time, converted to the timezone specified using the %K format code.
Property methods: FilenameDisplayToLogical(), FilenameGet(), FilenameIsValid(), FilenameLogicalToDisplay(), FilenameLogicalToOdbc(), FilenameNormalize(), FilenameSet()


method fileExists(pFilename As %String, ByRef pStatus As %Status = $$$OK) as %Boolean
Inherited description: Implemented by subclasses
method outputDocument(pFilename As %String, pDocument As EnsLib.EDI.X12.Document, pSeparators As %String, pDoFraming As %Integer) as %Status
method outputSegment(pFilename As %String, pSegObj As EnsLib.EDI.X12.Segment, pSeparators As %String, pCount As %Integer = 0) as %Status

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab