Constructing File Layouts
This section discusses topics related to creating file layouts.
In PeopleSoft Application Designer, select
A new file layout contains only one element, the root node to which file records are attached. The default root node name is NEW FILE.
Save the new file layout definition. You are prompted to name the file layout, which also becomes the name of the root node.
Note: The default file layout format is FIXED.
You can add file records and file fields to your file layout in two ways:
Base them on existing record and field definitions in the database.
Construct them directly in the file layout without reference to any database records or fields.
A file record that you construct in this way is added as a segment, but the result is an ordinary file record.
You can use both methods in any combination when creating file records and file fields in a file layout definition. Each file record and file field is generically referred to as a node.
Important! Regardless of the method that you use, file records and file fields exist only as definitions within a file layout and have no connection with any database record or field. Even with file records based on records in the database, a change to the database record definition is not reflected in the file layout.
After any update to PeopleTools, you should regenerate all file layout definitions.
Using a Segment Instead of a Record
Suppose that in the file that is provided to you, some of the file records contain new data and must be inserted, while others contain data that updates existing data. You can add a segment with a single field (like AUDIT_ACTION) that indicates whether the file record is new or changed. When you process the file, you can use PeopleCode to look at this field and, based on its value, perform the appropriate action.
As another example, suppose that you want to include only two fields from the PERSONAL_DATA table in the file. You have two choices: insert the PERSONAL_DATA table and manually delete all of the unwanted fields or insert a segment, name it PERSONAL_DATA, and then insert the two fields that you want.
Using Segments in Data Interchanges
If you create a file layout for a data interchange, you can use segments, but each file record must correspond to a record with the same name in the PeopleSoft database, and its file fields must have the same names and data formats as the fields of the database record. The file record can contain a subset of the fields in the corresponding database record. It can also contain a subset or a superset of the fields that are provided in the corresponding file data.
Adding File Records
To add a file record to the file layout definition, use one of the following methods:
Drag and drop a database record.
Drag a record definition from the project window into the definition window of the file layout. When dropping a record from a project onto a file layout definition, keep these items in mind:
If you drop the record onto the root node, it becomes the first top-level segment of the target root node.
If you drop the record onto a segment, it becomes a segment on the same level as the target segment, immediately following it in the order.
If you drop the record onto a file field of segment, it becomes the first child segment of the target segment.
The system inserts all of the constituent fields of the dragged record as well.
Whether a node is currently selected does not matter. The system only considers the location of the cursor when you drop the record (the drop site) in determining the placement of the resulting segment.
Insert a database record.
With the root node or a file record highlighted, selectWhen you select a record, the new file record appears following the highlighted file record and at the same level. The system automatically inserts all of the constituent fields of the record as well.
Insert a segment.
With the root node or a file record highlighted, select OK, the new file record appears following the highlighted file record and at the same level.and enter a file record name. When you click
Insert a child segment.
With a file record highlighted, select OK, the new file record appears one level below the highlighted file record but before any others at that level.and enter a file record name. When you click
Note: When you add a file record at the root level, it appears immediately below the root node, before all of the other file records.
Adding File Fields
To add a file field to the file layout definition, use one of the following methods:
Drag and drop a database field.
Drag a field definition from the Project window into the Definition window of the file layout, dropping it on any existing file record or file field. Confirm the field name or enter a different one, and click OK. The new file field appears following the node that you dropped it on.
Insert a database field.
With a file record or file field highlighted, select OK. The new file field appears following the highlighted node.Confirm the field name or enter a different one and click
Insert a file field.
With a file record or file field highlighted, select OK, the new file field appears following the highlighted node.and enter a file field name. When you click
Note: Each file field must have a unique name within its parent file record, but file fields in different file records can have the same name.
The file layout definition provides a set of directional arrow buttons in the toolbar, which you can use to reposition any file record within the hierarchy of the file layout or any file field within its parent file record.
The up and down arrows do not change the level of the selected item, just its order among other items at that level. The right and left arrows move the selected item lower and higher in the file layout hierarchy.
Note: When you reposition a file record in the file layout, its child records are also repositioned, and their child records are repositioned, and so on.
File layout names can be 30 characters in length, and file record and file field names can be 15 characters in length. All names should follow PeopleSoft naming standards.
Each file record within a file layout must have a unique name, but one file record can have the same name as the file layout. Each file field within a given file record must have a unique name, but file fields in different file records can have the same name.
Using WriteRecord, ReadRowset, and WriteRowset
If you use the WriteRecord, ReadRowset, or WriteRowset file layout methods for writing to or reading from records, the application record and the file record must have the same name, and the application record fields and the file fields must have the same names. These methods write only to like-named records and like-named fields within a given record. If you rename a record or a field after you use it to create a file layout definition, you must rename the file record or file field to the exact same name.
In a file layout definition containing more than one record, the system ignores records and fields that are not like-named. Like-named records do not have to contain all of the same fields, and like-named fields do not have to be the same length. Like-named fields should, however, be of the same type.
The following topics discuss issues you must consider when specifying field formats.
Numbers Format in FIXED Files
When you write numeric data to a FIXED format flat file, all numbers are right-justified in the file field. Numbers with decimal places specified are written with zeros padding the unused decimal places.
For example, a sequence of records with numbers of varying precision is written this way:
001 53.2700BUY 002 2174.0933SELL 003 108.0000SELL
Date, Time, and Datetime Field Lengths
In accordance with the International Organization for Standardization (ISO) 8601 standards, the field lengths for date, time, and datetime fields are fixed in the file layout, regardless of the file format:
Date fields have a fixed length of 10.
Time fields have a fixed length of 20.
Datetime fields have a fixed length of 31.
Datetime fields must use one of these formats.
CCYY-MM-DDTHH:MM:SS (with time separator)
CCYY-MM-DD HH:MM:SS.ssssss (with fraction of seconds)
CCYY-MM-DDTHH:MM:SS.ssssss (with time separator and fraction of seconds)
CCYY-MM-DD HH:MM:SS.ssssss+hhmm or CCYY-MM-DD HH:MM:SS.ssssss-hhmm (with fraction of seconds and universal time zone offset)
CCYY-MM-DDTHH:MM:SS.ssssss+hhmm or CCYY-MM-DDTHH:MM:SS.ssssss-hhmm (with time separator, fraction of seconds, and universal time zone offset)
Note: PeopleSoft applications comply with ISO 8601 guidelines for representing date field data. Refer to the ISO 8601 guidelines for more information.
Date Format with the ReadRowset Method
Single digits in dates in the form MMDDYY or MMDDYYYY must be padded with zeros. That is, if the date in the data is February 3, 2002, then the format must be:
The format 2/3/02 is not valid.
When using the date format DDMMYY, single digits should also be padded with zeros, and the month value should be all uppercase letters. For example, if the date in the data is February 2, 2003, then the format must be 02-FEB-03. The format 2-Feb-03 is not valid.