Need to merge files? Our products offer more value than the competition, and are trusted by more than 75% of the top-20 financial institutions in North America. Connect with us at sales@x9ware.com and start a free evaluation today.

X9Utilities Merge

Merge combines one or more x9 input files into x9 output file(s). Merge is a robust process which can be run against a potentially large number of input x9 files. Eligible input files are selected from an input “landing zone” which is identified on the command line. Merge is designed to be run periodically against the landing zone, most probably as a scheduled task, where all current content of the input folder will be merged into one or more output x9 files. In support of that design, merge operates in the following manner:

The landing zone can contain files, folders, or a combination of files and folders. Merge will automatically drill down into subfolders to identify candidate files to be merged. This implementation is essentially based on folder of folders, which allows the landing zone to be organized as needed to control the incoming files based on your requirements and to keep the number of files within folders to a reasonable level.

Merge has a command line option to operate at either the cash letter or bundle levels. When merging at the cash letter level, output x9 files will contain the complete cash letters from each of the input files. When merging at the bundle level, output x9 files will contain a single cash letter. Regardless of which option is selected, bundles are always copied in their entirety from input to output.

A maximum file size must be defined for the output files to be created (default is 800MB). One or more output files will be created from each merge run. The command line provides the output x9 pattern name which is then suffixed with a sequential number for each file that is written by the merge.

Input files which are successfully copied into the merged output can be optionally renamed to a new file extension on completion. This rename allows the file to be excluded from a future merge operation. Input files which are failed (they could not be copied into the merged output file) can be optionally renamed to a new file extension on completion. This rename allows the file to be clearly marked as failed for exception processing and will also exclude them from a future merge operation.

Input files are typically only selected for the merge when they end in a type 99 file trailer, since the lack of a file trailer is a structural issue which means that either the file is in the process of being transmitted to the input folder, or that they are flawed. In either case, files without type 99 file trailers would always be excluded from a merge.

Input files that were recently created can be further bypassed from one merge operation and thus deferred to the next scheduled run, with the intent to skip over files that may be actively transmitted. This skip interval can be set via the command line and defaults to 60 seconds.

Output files are initially created as TEMP and are renamed to their final names on the ultimate completion of the merge. These renames are performed at the end of the merge, for all output files that were created by the merge run, and before the individual files are renamed to their merged extension.

Landing Zone Batch Script

Merge would typically be run from a batch script that would be periodically invoked by a scheduler. Part of this batch script will be send an email if certain embedded functions are determined to be failed. The origination of this email can be done directly from Windows PowerShell but can also be done using tools such as SwithMail, CMail, SendSMTP, Blat, MailSend, SendEmail, or Send-It_Quietly. We would suggest writing a separate notification batch script that can be invoked with the failed message needs to be sent. The merge batch script would perform the following basic functions:

  • Zip the landing zone contents to an external backup folder using an output file name that is fully date-time stamped. This zip file would be used on an exception basis for either research or to allow this merge operation to be completely rerun should that be needed. The backup is needed since it is assumed that the content of the landing zone will be a constant state of change hence a snapshot backup is required.
  • Abort if this zip was unsuccessful.
  • Run the merge using options to rename both merged and failed files.
  • Abort if the exit status posted by merge is negative.
  • Zip all files which were renamed to “merged” to a backup file in an external folder using a file name that is fully date-time stamped. This zip file is used for archive purposes and represents all files that were merged in this run.
  • Abort if this zip was unsuccessful.
  • Delete all files that were renamed to “merged” since they have now been written to the archive zip file.
  • Abort if this delete was unsuccessful.
  • Send an email if the merge exit status indicates that the landing zone contains failed files. This will be true if the failed files either existed prior to the merge run or were actually created by this specific merge run.
  • Otherwise all is successful.

Command Line Options

SwitchDescription
-exti:”x1|x2|x3|…”Provides a list of one or more file extensions that identify x9 files within the input folder to be selected for merge. Files that do not match these extensions will be bypassed and not selected. Extensions are separated using the pipe character. Usage examples are -exti:x9 and -exti:“x9|x937″. Specifying a value of -exti:* will accept all extensions. Quote marks are needed around this parameter due to the embedded “|” special character.
-extr:mergedIndicates the file extension to be used for processed file renames. Processed files will not be renamed when no extension is provided.
-extf:failedIndicates the file extension to be used for failed file renames. Failed files will not be renamed when no extension is provided.
-max:nnnnControls the maximum file size for each output file in MB. When this facility is activated, each output file will be named using a suffix beginning at 1 (outputFile_1.x9, outputFile_2.x9, etc). Default maximum file size (when not specified) is 800MB. This limit can be set to zero for unlimited file size, and in that situation file suffixes are not assigned. A value of “900mb” would be provided to override the maximum file size to 900mb. This same value could alternatively be specified as “921600kb”. When the maximum limit is being controlled based on items (and not bytes), the maximum might be assigned as “10000″ or “20000″.
-creditsAddToItemCount:trueIndicates that credits are added to trailer item counts. The value can be assigned as either true or false.
-creditsAddToItemAmount:trueIndicates that credits are added to trailer item amounts. The value can be assigned as either true or false.
-creditsAddtoImageCount:trueIndicates that credits are added to trailer image counts. The value can be assigned as either true or false.
-mrgbIndicates that the merge should be run at the bundle level, which means that the output will contain a single cash letter. Default is false.
-modbIndicates that the bundle origination and destination routing numbers should be modified to match the cash letter header, as required by various x9 specifications. Default is false.
-gbnIndicates that the input files should be grouped (resequenced) using their logical file name. This is the default when no other sequencing has been specified.
-gbsIndicates that the selected input files should be grouped (resequenced) by their total file size in bytes.
-gbcIndicates that the input files should be grouped (resequenced) by item count.
-sdIndicates that the input files should be sorted descending on their control factor (size or items). This can reduce the number of output files when a large number of files are being created, since it increases the potential to group more files during the merge.
-sfIndicates that subfolders (within the input folder) should be included.
-select:”[1.nn]match-string”Indicates that matching should be applied against the type 01 file header record. This facility allows the input to be filtered, with only matching files selected for the merge. Files that do not match (those that are not selected) are excluded and are untouched by this merge (they will not be renamed, etc). This facility allows you to run several consecutive merge operations against the same folder, where each picks up their appropriate files. The format of the match string is that same as used by -split, so refer to that documentation for more information. The nn value indicates the field within the file header to be matched against. For example, [1.4] would match against the Immediate Destination Number. A match string of -select:”[1.4]=123456780″ would select that specific routing, while -select:”[1.4]^12.*” is a regex comparison that would select the 12th district.
-skpi:nnnIndicates a number of seconds that is compared against each individual file creation time and is used to bypass files that are very recently created within the input folder and may be in the process of being transmission. Files that do not meet this minimum skip interval are considered as “in-progress” and will be bypassed. Default value is 60.
-utsf:fileName.csvIndicates that the optional time stamp file should be created. The time stamp file name will be defaulted to mergeTimeStamp.csv when not provided via the switch setting. If a time stamp file name is provided, it can be a base name or a fully qualified file name. If only a base name is provided, then the file will be created in the output folder.
-t99mIndicates that input files should be selected even when they do not contain a type 99 file control trailer. This option would only be enabled in very unusual merge situations.
-dnrIndicates that file renames are not to be performed on completion. This switch is help helpful during testing since a merge test can be run repetitively without the inputs being changed.
-awxAbort when the selected output file already exists. The default action is to allow output files to be overwritten. Setting switch -awx will force an abort instead of overwriting the existing file.
-config:Use a specific x9 configuration which defaults to “x9.37″. For example, this parameter could be specified as “-config:x9.37″ or “-config:x9.100-187-2008″.
-jA summary JSON file will be created with a suffix of “_summary.json” in the same folder as the output x9 file.
-tA summary text file will be created with a suffix of “_summary.txt” in the same folder as the input x9 file(s).
-xA summary XML file will be created with a suffix of “_summary.xml” in the same folder as the input x9 file(s).
-lWill list all x9 records to the system log.
-lxbForces logging of all xml beans, which can be helpful during testing.
-batchInvokes batch (folder based processing; see that earlier topic for more information.
-workUnit:Assigns command line parameters and files from an xml file that was previously created and saved by the X9Utilities facility within X9Assist. This allows you to easily repeat an X9Assist task directly in X9Utilities batch.
Scroll to Top