Initiating File Processing

This section discusses how to set up and initiate inbound flat file processing.

Page Name

Definition Name

Usage

File Inbound Page

EO_FILE_INBOUND

Set up inbound flat file processing.

Inbound File Page

EO_FILETOMSG

Initiate inbound flat file processing. This file-to-message processing function reads the file rowset and publishes it as a message.

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.

File Inbound 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;

Field or Control

Definition

File Identifier

Displays the inbound file that you are associating with the rule.

Inbound File

Enter the index file name or the data file name. Specify the full path information. The PeopleCode program uses the %filepath_absolute variable when opening the file.

Index Flag

Select to distinguish between the index and the data file.

Status

Select whether this inbound file rule is Active or Inactive. The default value is Inactive.

File Layout ID

Select a layout to associate with the file.

LUWSize (logical unit of work size)

To limit the message size, enter the number of level zero rows that are in each message. The output message is normally determined by the MaxMessageSize system parameter.

Program and Section

Enter the name of a PeopleSoft Application Engine (AE) program and section to invoke when the utility finishes processing data.

Create Message Header

Select to create a header message. Use the header message as a trigger in the subscription process to initialize tables before they receive the data messages. This option is selected by default.

Create Message Trailer

Select to create a trailer message. Use the trailer message as a trigger in the subscription process to indicate that all the data messages have been received. This option is selected by default.

File Layout

Field or Control

Definition

Definition Name and Message Name

If the File Layout ID field is blank, this field should contain only one entry.

If the File Layout ID field is not blank, this scroll area must contain an entry for each file layout definition name that is specified in the inbound file.

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.

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.

Inbound File 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

Field or Control

Definition

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.