TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

Easytrieve File Statement


File Statement:

The FILE statement describes the files and/or the databases your program references. This description is provided by parameters coded following the keyword FILE. Not all parameters are used with any one file. The next exhibit diagrams the most commonly used FILE parameters.

Syntax:

FILE file-name [File type] [Device type] [Record format] [TABLE]

Let us we look into the parameters in define Statement.

File-name Parameter:

This is a name you give to each of your files. It is the only FILE statement parameter that is mandatory under every circumstance.

Rules:

  1. It must start with a letter, can contain letters, numbers, and a few special characters.

  2. It can be from one- to eight-characters long.

  3. The name of each file must be unique(i.e. no two files can have the same name).

In the FILE statement sample program (shown earlier), the input file-name is PERSNL.

FILE PERSNL

The other parameters in File statement are optional.

File-type Parameters:

This parameter specifies your file-type. If you do not supply it, the assumption is that your file is sequentially ordered. If it is not, you must specify this parameter to identify your file-type.


Device-type Parameters:

This optional parameter specifies where to look for your file. Vallues for TAPE, DISK, CARD, PUNCH, PRINTER.


Record Format Parameters:

Syntax:

Record Format(literal-1 [literal-2])
Record format codes are:
  1. F - fixed unblocked

  2. V - variable unblocked

  3. U - undefined

  4. FB - fixed blocked

  5. VB - variable blocked

  6. VBS - variable blocked spann

Where,

  • literal-1 - record length

  • literal-2 - block size

In the sample program we define the FILE statement as,

FILE PERSNL FB(150 1800)

Where, FB - Fixed Block, 150 - Record length, 1800 - Block size.


TABLE:

This option identifies a file that you are specifying as a table. The format of table data must follow some strict rules, but its use is very efficient (We will see later). The information in this file is accessed by the SEARCH statement. The table data can reside within your program (INSTREAM), or you can store it external to your program.

Syntax:

[ [INSTREAM ]]
[TABLE [ ]]
[ [literal-5]]

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal