Previous Topic: COMPUTE ... GROUP BYNext Topic: DEFINE PATH


DEFINE FILE

DEFINE FILE allows OLQ/Batch to include a data set as input to a query or to send to a data set the unedited data that was captured during a query. A DEFINE command identifies a file and relates an input data set to an IDD-defined record.

Syntax:

►►─── DEFine FIle ─┬─────┬─ file-name ────────────────────────────────────────►
                   └─ = ─┘

 ►─┬────────────────────────────────────────────────┬─────────────────────────►
   └─ RECord ─┬─────┬─ record-name ─┬─────────────┬─┘
              └─ = ─┘               └─ (version) ─┘

 ►─┬──────────────────────────────────────┬───────────────────────────────────►
   └─ DICtname ─┬─────┬─ dictionary-name ─┘
                └─ = ─┘

 ►─┬───────────────────────────────────────────┬──────────────────────────────►
   └─ DICTNOde ─┬─────┬─ dictionary-node-name ─┘
                └─ = ─┘
 ►─┬────────────────────────────────┬─────────────────────────────────────────►
   └─ LOGical unit ─┬─────┬─ sysnn ─┘
                    └─ = ─┘

 ►─┬──────────────────────────┬───────────────────────────────────────────────►
   └─ RECFm ─┬─────┬─┬─ F ──┬─┘
             └─ = ─┘ ├─ FB ─┤
                     ├─ V ──┤
                     ├─ VB ─┤
                     └─ U ──┘

 ►─┬────────────────────────────┬─────────────────────────────────────────────►
   └─ DSOrg ─┬─────┬─┬─ PS ───┬─┘
             └─ = ─┘ └─ VSAM ─┘

 ►─┬─────────────────────────────────┬────────────────────────────────────────►
   └─ DEVtype ─┬─────┬─┬─ DISK ────┬─┘
               └─ = ─┘ ├─ TAPE ────┤
                       ├─ CARD ────┤
                       ├─ LIST ────┤
                       └─ PRINTER ─┘

 ►─┬─────────────────────────────────────────┬────────────────────────────────►
   └─ LREcl ─┬─────┬─ logical-record-length ─┘
             └─ = ─┘

 ►─┬────────────────────────────────┬─────────────────────────────────────────►
   └─ BLKsize ─┬─────┬─ block-size ─┘
               └─ = ─┘

 ►─┬─────────────────────────────────────┬────────────────────────────────────►
   └─ TAPe labels are ─┬─ OMmitted ────┬─┘
                       ├─ STAndard ────┤
                       ├─ NONstandard ─┤
                       └─ USEr ────────┘

 ►─┬──────────┬───────────────────────────────────────────────────────────────►◄
   └─ OUTput ─┘

Parameters:

file-name

In OS and CMS, a 1- to 8-character alphabetic file name that assigns a file name and file characteristics to an input or an output file. In DOS, file-name can be a maximum of 7 characters long. The file name must be referenced by a DD name in your batch job stream.

RECORD= record-name

A 1- to 32-character alphabetic name of a record stored in the data dictionary that names an Integrated Data Dictionary (IDD®) record corresponding to the file definition.

DICTNAME= dictionary-name

A 1- to 8-character alphabetic dictionary name that identifies the dictionary where the IDD record definition resides.

DICTNODE= dictionary-node-name

A 1- to 8-character alphabetic dictionary node name, Distributed Database System (DDS) only, that identifies the dictionary node in which the IDD record definition resides.

LOGICAL UNIT= sysnnn

Specifies the name of the logical unit.

RECFM= record-format

Specifies the record format of the named file. Record-format can be:

Record-format is required for DOS.

DSORG= data-set

Specifies the data set organization of the named file.

DEVTYPE= device-type

Specifies the device type for the named file. Device-type can be:

LRECL= logical-record-length

Specifies the logical record length, in bytes, of the named file. Logical-record-length is an integer in the range of 1 to 32,767. This parameter is required for DOS.

BLKSIZE= block-size

Specifies the block size, in bytes, of the named file. Block-size is an integer in the range 1 to 32,767.

This parameter is required for DOS.

TAPE LABELS ARE label-status

Specifies tape labels for the file definition. Label-status can be:

OUTPUT

Identifies the file as an output file.

Example 1:

To use a data set as input to a query, describe the data in the input file as a record in IDD such as:

ADD
  RECORD NAME IS INPUT-REC VERSION IS 1.

02 INPUT-ELE-1
   PICTURE IS S999
   USAGE IS COMP-3.

02 INPUT-ELE-2
   PICTURE IS  9(18)
   USAGE IS DISPLAY.
and include input cards such as:

//SYSIPT   DD  *
   DEFINE FILE INFILE RECORD INPUT-REC
   SELECT * FROM INPUT-REC
   DISPLAY
//INFILE   DD  *
   123456789012345678   **  COLUMNS 1 AND 2 CONTAIN x'013C'  **
   456789012345678901   **  COLUMNS 1 AND 2 CONTAIN x'123C'  **
*/

INPUT-REC REPORT 05/17/07 INPUT-ELE-1 INPUT-ELE-2 13 123456789012345678 123 456789012345678901

The corresponding job control language statement must name the file in the DD name:

Op. System

JCL Statement

z/OS

//INFILE DD DSN=infile,DISP=SHR

z/VSE

// DLBL INFILE,'infile'

 

// EXTENT sysnnn, nnnnnn,,,1,ssss

 

// ASSIGN sysnnn,DISK,VOL=nnnnnn,SHR

CMS

FILEDEF INFILE DISK filename filetype filemode (OPTIONS

Example 2:

To use a data set as output from a query, include commands:

//OUTFILE  DD  DSN= 
//SYSIPT   DD  *  
SIGNON SS=EMPSS01   
DEFINE FILE OUTFILE OUTPUT   
SELECT 'DEPARTMENT'.* 'EMPLOYEE'.* FROM 'DEPARTMENT', 'EMPLOYEE'  -   
OUTPUT OUTFILE

It is not required to define a record in the data dictionary to describe the output. The output will contain all the fields from the DEPARTMENT record followed by every field in the EMPLOYEE record. No editing of any fields will be done, and the fields will be contiguous.

5300BLUE SKIES2			03210023CATHERINE O'HEAR 
5100BRAINSTORMING		00150023CATHERINE O'HEAR 
2000ACCOUNTING AND PAYROLL	00110023CATHERINE O'HEAR