Defining Work Files

A work file is a non-database file that a program uses to store and retrieve information.

You can define work files to accomplish many different tasks, including:

  • To work with data sorted in an order not indexed in the database

  • To increase the efficiency of a program (working with flat files (nonindexed files that can take a variety of formats) is faster than using SQL data files in some cases)

  • To import or export data from desktop spreadsheets or Electronic Data Interchange (EDI)

  • To pass data between Lawson programs, rather than writing to the database and reading the same data from a second program

  • To create a secondary print file

  • To create a print file associated with an online program, such as printing an invoice entry

You can also define a comma-separated-value (CSV) file as a type of work file, even though it is not a work file in the traditional sense. The data records in CSV files are arranged by using a comma or some other character to separate the data fields. This makes the file portable between applications, such as between a Lawson application and a spreadsheet program.

Once you have defined CSV files using the Work File Definition (workdef) utility, use the CSV routines to read from and write to the files. For more information on using CSV routines, see Doc for Developers: Lawson 4GL Application Program Interfaces..

Use the Work File Definition (workdef) utility to define a work file.

Work files must belong to a program defined in Program Definition or to a library. For more information, see Library Definition.