Description
The FixedDelimitedSegmentMergeReceiver merges from two or more segmented data files, generated from the SegmentDataCreatorReceiver, into one or more Fixed file delimited formatted output files. Each Segment will be separated by a delimiter, and fields within a Segment will be at a fixed position in the file.
In This Article
- When should this Receiver be used?
- When should this Receiver not be used?
- Are any additional items required to use this Receiver?
- List of Steps to Generate Nested Delimited File Output
- Receiver Parameters
- Receiver Attribute Property Keys
- File Config and Directory Config Tabs
- Example Transaction Story
- Configuration File
- Template Files
- Example Files
When should this Receiver be used?
- Any time you want to generate nested fixed delimited file output.
When should this Receiver not be used?
- Any time you want to generate another type of nested output.
Are any additional items required to use this Receiver?
- SegmentDataCreatorReceiver- Must be assigned to each Domain, except the Merge Domain.
- Note: The FixedDelimitedSegmentMergeReceiver should only be assigned to the Merge Domain that merges the generated segments.
- Note: The FixedDelimitedSegmentMergeReceiver should only be assigned to the Merge Domain that merges the generated segments.
- Configuration File - Used to determine the XML output format. This is typically named "config.xml", but can be named differently if needed.
- Note: When named differently, the name will also need to be changed for the configName parameter within the Receiver.
- Note: When named differently, the name will also need to be changed for the configName parameter within the Receiver.
- Template Files - Automatically created for each Domain when the configuration file is downloaded to the user's local machine and referenced within the configuration file to determine the XML output format.
List of Steps to Generate Nested Delimited File Output
- Set up a Project with Domains, Parent-Child Relationships, and Scenarios.
- For each Domain except the Merge Domain, complete the following:
- Assign the SegmentDataCreatorReceiver and configure it accordingly.
- Create a Merge Domain with just an id Attribute
- Note: This may have already been done if Domains were imported.
- Add the FixedDelimitedSegmentMergeReceiver to the Merge Domain and configure it, as discussed in this article.
- Create a Scenario Chain with all Domain Scenarios. Make sure the Merge Scenario is in the last position.
- Create a Configuration File as discussed in this article.
- Download the Scenario Chain to your local computer.
- Download the Configuration file to your local computer.
- Note: This is a zip file containing the configuration and Domain template files. It will need to be unzipped, and all files will need to be placed in the location defined here (see the image below):
- Note: This is a zip file containing the configuration and Domain template files. It will need to be unzipped, and all files will need to be placed in the location defined here (see the image below):
Receiver Parameters
The FixedDelimitedSegmentMergeReceiver requires that the following parameters are defined. Items with an asterisk* are required.
- outputPath* - Defines the location to store the newly generated nested Fixed Delimited text file(s).
- outputSubDirectory* - Defines the prefix name of subdirectories that are auto-created under the outputPath and then appended with a number.
- configName* - Defines the name of the configuration file.
- configPath*- Defines the location where the configuration file is to be stored.
- configSubDir - Defines the subdirectory under the configPath directory where the configuration file is to be stored.
- segmentPath* - Defines the path to the Segment directory where all segment subdirectories can be found.
- segmentSubDirectory - Defines the subdirectory under the segmentPath where segment files can be found.
- filesPerOutputSubDir* - Defines the number of files to be generated per output subdirectory.
- segmentDelimiter* - Defines the delimiter that separates the segments.
- overrideFileName - Defines the fileName, which will override the fileName provided in the configuration file.
- deleteOutputSubDir - Defines whether to delete the generated or an existing outputSubDirectory or not during the execution of the Scenario.
- deleteSegmentDir - Defines whether to delete the segments directory or not.
- multipleFileOutput - Determines whether the nested records will be generated in one or multiple output files based on the loop count of the Root Domain. When set to "False," only one file containing all nested records will be generated. When set to "True," one file will be created for each nested record to generate multiple output files.
- columnDelimiter - Defines the delimiter that will be used to separate columns.
Receiver Attribute Property Keys
There are no property keys necessary for this Receiver.
File Config and Directory Config Tabs
The File Config and Directory Config Tabs are used to configure what event will trigger file/directory creation and the naming configuration for generated files/directories. Please click here for more information on how to use the File Config and Directory Tabs.
Example Transaction Story
In this basic use case, the user wants to generate five transaction records per day which will be followed by a delimiter after each record and a record trailer by the end of the record header.
So, the example given below will be based on the generation of segmented data for three Domains. There are three Domains that represent the following hierarchy in parent-child relationships:
- FileHeaderDomain is the root Domain
- TransactionRecordDomain is a child of the FileHeaderDomain
- FileTrailerDomain is a child of the FileHeaderDomain
Each Domain will use a SegmentCreatorReceiver to generate segmented data output with referential integrity with regard to parent-child relationships. The last Domain, Merge, will also use a FixedDelimitedSegmentMergeReceiver to merge the segmented data generated for each Domain into one or more nested Fixed Delimited text output files.
Four Scenarios will be created, out of which Three Scenarios will be containing the instruction on how much segmented data to generate for each Domain, and the last Scenario will merge the segments together to generate the output.
Lastly, the Scenarios can be chained together so that they can be run with one command instead of four separate commands. See the following page to learn how to create a Scenario Chain: How do I create a Scenario Chain?
Configuration File
The FixedDelimitedSegmentMergeReceiver requires a configuration file (e.g., config.xml) to properly merge the generated segments. In most cases, the configuration file must be manually created within the GenRocket web platform. For some Domain Imports, this configuration file is created automatically for you.
The configuration file defines the following elements of information:
fileNameSegments - contains sub-elements that define how file names are created for each delimiter file generated.
segmentFiles - contains sub-elements that define the file names of the segment data files to merge.
elements - contains nested subelements that define the format of the Fixed Delimited text output.
Steps to Create Configuration File
- Within the Project Dashboard, select the Configuration Management Tab within the Management pane.
- Click the New Configuration button.
- Select the Fixed Format radio button and click the Select button.
- Enter the required parameters to create a configuration file.
- Name: Defines the unique name for the Fixed File configuration.
- Config File Name: Defines the name of the configuration file that FixedDelimitedSegmentMergeReceiver will read to create a Delimited Fixed File format file.
- Output File Name Format: Defines the format for the name of the output file.
- Definitions: Defines the various segment and template files that will be used to build nested XML.
- Arrange the Segments in a hierarchy by dragging/dropping the segments.
Steps to Download Configuration File
Once the configuration file has been created within the GenRocket web platform, the user must download it to their local machine and any other required files (e.g., Scenario, Scenario Chain, Scenario Chain Set, Test Data Cases).
To do so, select the Download (Cloud) icon for the configuration file.
A zip file will be downloaded to the user's local machine. This is typically the user's downloads folder. This zip file will contain the configuration file and the required template files for generating the nested fixed file format data.
The user must copy these files (config and templates) to a "config" subdirectory located in the path defined for their resource.output.directory Organization Resource.
Note: If the subdirectory value has been changed within the FixedDelimitedSegmentMergeReceiver, the configuration and template files must be placed there.
Example Configuration File
The created configuration file for this example is defined to allow three segment files to be merged into one or more Fixed Delimited nested output files. The format of the segmented data must produce nested output which meets the following rules:
- There must be one fileHeader generated and each to its own nested Fixed Delimited text file.
- Each fileHeader must have five transaction records
- Each fileHeader must have one fileTrailer
The XML configuration file
The following is a preview of the XML configuration file, which will produce the Fixed Delimited file formatted output files based on the settings provided in the configuration file.
<Config>
<fileNameSegments>
<fileNameSegment segmentType='Constant' value='FixedFile-' />
<fileNameSegment segmentType='Counter' value='1' />
<fileNameSegment segmentType='Constant' value='.txt' />
</fileNameSegments>
<segments>
<segment domainName='FileTrailer' templateFile='FileTrailerTemplate.xml' segmentFile='FileTrailerSegment.xml' />
<segment domainName='TransactionRecord' templateFile='TransactionRecordTemplate.xml' segmentFile='TransactionRecordSegment.xml' />
<segment domainName='FileHeader' templateFile='FileHeaderTemplate.xml' segmentFile='FileHeaderSegment.xml' />
</segments>
<segmentHierarchy>
<segment domainName='FileHeader'>
<segment domainName='TransactionRecord' />
<segment domainName='FileTrailer' />
</segment>
</segmentHierarchy>
</Config>
The example configuration file defines the following information.
FileNameSegments
The subelements will produce a file naming convention that looks like the following:
- FixedFile-1.txt
TemplateFiles
The following template files will be loaded and used to create the XML output when merged with segment data.
- FileHeaderTemplate.xml
- TransactionRecordTemplate.xml
- FileTrailerTemplate.xml
SegmentFiles
The following segment files will be loaded, and their data used in the merge process.
FileHeaderSegment.xml
TransactionRecordSegment.xml
FileTrailerSegment.xml
Elements
The elements and subelements are configured to produce the following nested Fixed Delimited structure.
File Header Record
**********
Detail Entry Record 1
**********
Detail Entry Record 2
**********
Detail Entry Record 3
**********
Detail Entry Record 4
......
File Trailer Record
Template Files
The Template Files are created automatically when the configuration file is downloaded to the user's local machine.
Each template file below represents a block of XML elements used for merging with segment data that, combined together, will create a nested Fixed Delimited file.
FileHeader Template
This template will be used for data segment merging with <segment name="FileHeader">
<Segment name='FileHeader'> <attributes> <attribute fieldName='recordType' length='2' /> <attribute fieldName='fileId' length='6' /> <attribute fieldName='fileIdSeparator' length='2' /> <attribute fieldName='fileIdValue' length='12' /> <attribute fieldName='filler' length='12' /> </attributes> </Segment>
TransactionRecord Template
This template will be used for data segment merging with <segment name="TransactionRecord">
<Segment name='TransactionRecord'> <attributes> <attribute fieldName='recordType' length='2' /> <attribute fieldName='customerNumber' length='10' /> <attribute fieldName='customerAccountNumber' length='12' /> <attribute fieldName='transactionId' length='36' /> <attribute fieldName='transDate' length='12' /> <attribute fieldName='cardNumFirst6' length='7' /> <attribute fieldName='totalTransAmt' length='12' /> </attributes> </Segment>
FileTrailer Template
This template will be used for data segment merging with <segment name="FileTrailer">
<Segment name='FileTrailer'> <attributes> <attribute fieldName='recordType' length='2' /> <attribute fieldName='institutionName' length='12' /> <attribute fieldName='institutionID' length='8' /> <attribute fieldName='filler' length='12' /> </attributes> </Segment>
Example Files
All of the example files below were generated by GenRocket.
Example merged nested Fixed Delimited file.
The following is an example of a merged Fixed Delimited file for the first fileHeader generated.
HHFILEID||2020-01-15 000000
***********
DT43637446 3854113929949c020401-ee58-11e7-aca1-de9802ff4a812021-09-01 511000 8402
***********
DT12840191 5866789137349c020402-ee58-11e7-b1ea-d6dfb95c8ca52021-07-14 521000 54089
***********
DT23591618 7527497533319c020403-ee58-11e7-93f9-140d9ca88c1c2021-05-06 531000 47529
***********
DT35793317 2347431459909c020404-ee58-11e7-9ec1-d7466b8488b02021-12-14 541000 31152
***********
DT64863061 3058124868099c020405-ee58-11e7-bd14-56f00866007a2021-11-01 551000 94107
***********
TTGenRocket GNRCKT 000000
Example Segment Files
The following are three example segmented data files used to generate the merged nested Fixed files. These files are automatically created when the data is generated and stored within a "segment" subdirectory within the user's output path.
FileHeaderSegment.xml
This file will contain one segment having one data element containing the fileHeader attributes, a loopCount equal to one, and no parentId since the fileHeader is the root Domain and does not have a parent Domain.
<segments> <segment id="1" setId="1"> <attribute name="recordType"><![CDATA[HH]]></attribute> <attribute name="fileId"><![CDATA[FILEID]]></attribute> <attribute name="fileIdSeparator"><![CDATA[||]]></attribute> <attribute name="fileIdValue"><![CDATA[2020-01-15]]></attribute> <attribute name="filler"><![CDATA[000000]]></attribute> </segment> </segments>
TransactionRecordSegment.xml
This file will contain five segments, each having eight data elements containing the userRecord attributes, a loopCount equal to five, and a parentId given each set of users referential integrity to a given fileHeader defined within FileHeaderSegment.xml.
<segments> <segment id="1" setId="1"> <attribute name="recordType"><![CDATA[DT]]></attribute> <attribute name="customerNumber"><![CDATA[15934998]]></attribute> <attribute name="customerAccountNumber"><![CDATA[198680530800]]></attribute> <attribute name="transactionId"><![CDATA[9c020401-ee58-11e7-ac64-fd02db979799]]></attribute> <attribute name="transDate"><![CDATA[2021-06-10]]></attribute> <attribute name="cardNumFirst6"><![CDATA[511000]]></attribute> <attribute name="totalTransAmt"><![CDATA[79357]]></attribute> <attribute name="fileHeader"><![CDATA[1]]></attribute> </segment> <segment id="2" setId="1"> <attribute name="recordType"><![CDATA[DT]]></attribute> <attribute name="customerNumber"><![CDATA[40369607]]></attribute> <attribute name="customerAccountNumber"><![CDATA[733867508081]]></attribute> <attribute name="transactionId"><![CDATA[9c020402-ee58-11e7-994a-1b3aeb69e153]]></attribute> <attribute name="transDate"><![CDATA[2021-05-06]]></attribute> <attribute name="cardNumFirst6"><![CDATA[521000]]></attribute> <attribute name="totalTransAmt"><![CDATA[67408]]></attribute> <attribute name="fileHeader"><![CDATA[1]]></attribute> </segment> <segment id="3" setId="1"> <attribute name="recordType"><![CDATA[DT]]></attribute> <attribute name="customerNumber"><![CDATA[33309838]]></attribute> <attribute name="customerAccountNumber"><![CDATA[717539711082]]></attribute> <attribute name="transactionId"><![CDATA[9c020403-ee58-11e7-9268-9180d664e317]]></attribute> <attribute name="transDate"><![CDATA[2021-12-15]]></attribute> <attribute name="cardNumFirst6"><![CDATA[531000]]></attribute> <attribute name="totalTransAmt"><![CDATA[74727]]></attribute> <attribute name="fileHeader"><![CDATA[1]]></attribute> </segment> <segment id="4" setId="1"> <attribute name="recordType"><![CDATA[DT]]></attribute> <attribute name="customerNumber"><![CDATA[36968742]]></attribute> <attribute name="customerAccountNumber"><![CDATA[200612319715]]></attribute> <attribute name="transactionId"><![CDATA[9c020404-ee58-11e7-bc25-f148b538ac01]]></attribute> <attribute name="transDate"><![CDATA[2021-02-09]]></attribute> <attribute name="cardNumFirst6"><![CDATA[541000]]></attribute> <attribute name="totalTransAmt"><![CDATA[97030]]></attribute> <attribute name="fileHeader"><![CDATA[1]]></attribute> </segment> <segment id="5" setId="1"> <attribute name="recordType"><![CDATA[DT]]></attribute> <attribute name="customerNumber"><![CDATA[82799644]]></attribute> <attribute name="customerAccountNumber"><![CDATA[593560623561]]></attribute> <attribute name="transactionId"><![CDATA[9c020405-ee58-11e7-bfcb-f5ccac9dc2dc]]></attribute> <attribute name="transDate"><![CDATA[2021-02-16]]></attribute> <attribute name="cardNumFirst6"><![CDATA[551000]]></attribute> <attribute name="totalTransAmt"><![CDATA[23307]]></attribute> <attribute name="fileHeader"><![CDATA[1]]></attribute> </segment> </segments>
FileTrailerSegment.xml
This file will contain one segment having one data element containing fileTrailer attributes, a loopCount equal to 1, and a parentId given each fileHeader referential integrity to a given fileHeader defined within FileHeaderSegment.xml.
<segments> <segment id="1" setId="1"> <attribute name="recordType"><![CDATA[TT]]></attribute> <attribute name="institutionName"><![CDATA[GenRocket]]></attribute> <attribute name="institutionID"><![CDATA[GNRCKT]]></attribute> <attribute name="filler"><![CDATA[000000]]></attribute> <attribute name="fileTrailer"><![CDATA[1]]></attribute> </segment> </segments>