Skip to main content


abstract class EnsLib.EDI.X12.Operation.BatchStandard extends EnsLib.EDI.X12.Operation.Standard

Property Inventory

Method Inventory


parameter SETTINGS = Filename:Basic,AutoBatchParentSegs,AutoBatchCompletionTimeout;
Inherited description: List of properties can be set as settings in the configuration file format is a comma separated list of property names


property AutoBatchCompletionTimeout as %Numeric [ InitialExpression = 0 ];
How long to wait before adding the trailing segments to batch output which has been unmodified for a period of time, but does not yet have the trailing segments necessary to make a complete batch document. 0 means never timeout. This is only relevant if AutoBatchParentSegs is turned on.
Property methods: AutoBatchCompletionTimeoutDisplayToLogical(), AutoBatchCompletionTimeoutGet(), AutoBatchCompletionTimeoutIsValid(), AutoBatchCompletionTimeoutLogicalToDisplay(), AutoBatchCompletionTimeoutNormalize(), AutoBatchCompletionTimeoutSet()
property AutoBatchParentSegs as %Boolean [ InitialExpression = 1 ];
When writing a message that has a batch parent, output the batch headers first, and follow up with the batch trailers when triggered by the final batch parent header message or by a file name change.
All child messages of a batch parent message will be written out unless already written previously while AutoBatchParentSegs=true.
Property methods: AutoBatchParentSegsDisplayToLogical(), AutoBatchParentSegsGet(), AutoBatchParentSegsIsValid(), AutoBatchParentSegsLogicalToDisplay(), AutoBatchParentSegsNormalize(), AutoBatchParentSegsSet()
property Filename as %String (MAXLEN = 1000, MINLEN = 1) [ InitialExpression = "%f_%Q" , 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 OnInit() as %Status
This user callback method is called just after %OnNew()
method OnKeepalive(pAdapterStatus As %Status) as %Status
Inherited description: This method will be called within KeepaliveInterval of the last return from OnTask() or OnKeepalive(). It is called via the Adapter's OnKeepalive() method, which is called from the Host.OnTask() method; if there is no Adapter there is no keepalive call.
method OnMessage(pRequest As EnsLib.EDI.X12.Document, Output pResponse As EnsLib.EDI.X12.Document) as %Status
This method is for File and FTP Operations: per-message batch output with no reply. TCP and HTTP Operations receive reply messages and only support entire batch output.
method completeUnfinishedBatches()
Add trailers to files that have been unchanged for AutoBatchCompletionTimeout seconds
method fileExists(pFilename As %String, pStatus As %Status = $$$OK) as %Boolean
Implemented by subclasses
method outputHeaders(pKey As %String, pOldParents As %String, pParents As %String) as %Status

Inherited Members

Inherited Properties

Inherited Methods


FeedbackOpens in a new tab