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.
FILE file-name [File type] [Device type] [Record format] [TABLE] |
Let us we look into the parameters in define Statement.
This is a name you give to each of your files. It is the only FILE statement parameter that is mandatory under every circumstance.
It must start with a letter, can contain letters, numbers, and a few special characters.
It can be from one- to eight-characters long.
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.
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.
This optional parameter specifies where to look for your file. Vallues for TAPE, DISK, CARD, PUNCH, PRINTER.
Record Format(literal-1 [literal-2]) |
F - fixed unblocked
V - variable unblocked
U - undefined
FB - fixed blocked
VB - variable blocked
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.
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.
[ [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!