Initiating File Processing
This section discusses how to:
Set up inbound flat file processing.
Initiate inbound flat file processing.
Pages Used to Initiate File Processing
Page Name |
Definition Name |
Navigation |
Usage |
---|---|---|---|
File Inbound |
EO_FILE_INBOUND |
|
Set up inbound flat file processing. |
Inbound File |
EO_FILETOMSG |
|
Initiate inbound flat file processing. This file-to-message processing function reads the file rowset and publishes it as a message. |
File Inbound Page
Use the File Inbound page (EO_FILE_INBOUND) to set up inbound flat file processing.
Image: File Inbound page
This example illustrates the fields and controls on the File Inbound page. You can find definitions for the fields and controls later on this page.
Referencing Application Engine Program
The file inbound setup allows you to reference an AE program and section that gets called as soon as the data processing of the specified inbound file is completed. This functionality comes in handy if you wish to invoke customized actions after the flat file utility finishes processing data--simply build the custom AE program and specify it on this page for the corresponding file rule.
Below is a sample code for an AE program that removes entries of data files that have been processed from index files. Steps of this program are executed only if the input file is flagged as an Index file.
/* Open the index file in Read-only mode */ /* Initialize a string array and save all unprocessed file names from the Index file */ /* Open the Index in Write mode, thereby clearing contents from previous iteration, and write the contents of the array to the file */ /* When the last data file has been processed, write ‘All Done’ to the Index file */ Local string &Index_FileName, &LineString; Local File &Index_File; Local array of string &Inbound_Files; Local number &I; Local boolean &Found; If EO_FILEPUB_AET.INDEX_FILE_FLG = "Y" Then /* Get index filename from the Inbound File Publish Rule */ SQLExec("Select FILE_INBOUND from PS_EO_FLOINDEFN WHERE FILE_ID = :1", EO_ FILEPUB_AET.FILE_ID, &Index_FileName); /* Open Index file as Read-only */ &Index_File = GetFile(&Index_FileName, "R", %FilePath_Absolute); /* Initialise string array */ &Inbound_Files = CreateArrayRept("", 0); /* Save unprocessed filenames to array */ While &Index_File.ReadLine(&LineString); If &LineString <> EO_FILEPUB_AET.FILE_INBOUND Then &Inbound_Files.Push(&LineString); End-If; End-While; &Index_File.Close(); /* Open index file in Write mode */ &Index_File = GetFile(&Index_FileName, "W", %FilePath_Absolute); /* Write unprocessed filenames to index file */ &I = 0; While &Inbound_Files.Next(&I) &Found = True; &Index_File.WriteLine(&Inbound_Files [&I]); End-While; /* If all files processed, print Done */ If Not &Found Then &Index_File.WriteLine("All Done!"); End-If; &Index_File.Close(); End-If;
File Layout
Note: Use the wildcards * and ? for the file name but not for the directory path. The file layout and message mapping must be valid for all files that meet the wildcard criteria.
Inbound File Page
Use the Inbound File page (EO_FILETOMSG) to initiate inbound flat file processing.
This file-to-message processing function reads the file rowset and publishes it as a message.
Image: Inbound File page
This example illustrates the fields and controls on the Inbound File page. You can find definitions for the fields and controls later on this page.
Use this page to initiate inbound flat file processing. This file-to-message processing function reads the file rowset and publishes it as a message.
Parameters
File Identifier |
Select or enter the name of the file identifier that you set up in the File Inbound page. The file identifier is tied to the publish rules. |
Run |
Click to run this request. |
Publishing a New Message
The Inbound File page runs an Application Engine process that initiates the file-to-message processing. The file-to-message processing function reads the file rowset and publishes it as a message.
If an index file exists when the inbound conversion process runs, the Application Engine program loads the list of files to be converted into a parameter table and completes a commit. The Application Engine program uses the list of files within the parameter table to restart the processing if a particular flat file fails. If a single data file is provided, then the rowset processing immediately begins.
The file publish process goes through each of the rowsets of the file layout and copies them into the message row sets.
If the audit action (AUDIT_ACTN) exists in the file, it is copied to the PSCAMA record. If the audit action does not exist in the file, the publishing process uses the default value that is specified in the file layout field property.
The Flat File utility publishes a new message when one of the following situations occurs:
Maximum message size is exceeded.
Logical unit of work publish size is reached.
A new file layout is detected.
End of file is reached.
The Application Engine program completes a commit every time a message is published from a file. After conversion, the flat file remains in the parameter table with a status of Processed.
Note: The file layout should exactly match the message layout (excluding the PSCAMA record) and should use the same character set as that used by the file: either American National Standards Institute or Unicode.