SetFileLayout method: File class
Syntax
SetFileLayout(FILELAYOUT.filelayoutname)
Description
The SetFileLayout method is a file layout method. It associates a specific file layout definition with the file object executing this method, providing easy access to rowset data. The file object must be associated with an open file. With file layout definitions, you can read and write rowsets as easily as strings. If the file object isn’t open or the definition doesn’t exist, SetFileLayout fails.
You must execute SetFileLayout before you can use any other file layout methods or properties with a file object, otherwise those methods and properties return NULL or False.
Note:
All provided PeopleTools records that have a prefix of PSFLD are related to file layout definitions.
Parameters
| Parameter | Description |
|---|---|
|
filelayoutname |
Specify as a string the name of an existing file layout definition created in Application Designer. |
Returns
A Boolean value: True if the method succeeds, False otherwise.
Example
The following example opens a data file, associates a file layout definition with it, reads and processes the first rowset from it, and closes the file.
&MYFILE.Open(&SOMENAME, "E");
If &MYFILE.SetFileLayout(FILELAYOUT.SOMELAYOUT) then
&SOMEROWSET = &MYFILE.ReadRowset();
/* Process the contents of &SOMEROWSET */
Else
/* Error - SetFileLayout failed */
End-If;
&MYFILE.Close();