If the FILEDEF command is issued for a program input or output file, the ddname must be the same as the ddname or file name specified for the file in the source program. For example, you have an Assembler language source program that contains the line:
INFILE DCB ddname=INPUTDD,MACRF=GL,DSORG=PS,RECFM=F,LRECL=80
For a particular execution of this program, you want to use as your input file a CMS file on your A-disk that is named MYINPUT FILE. You must issue a FILEDEF like this before executing the program:
FILEDEF INPUTDD DISK MYINPUT FILE A1
CMS FILEDEF command information for RELOAD processing should be identical to the information in the FILEDEF command used when the file was created by the package's UNLOAD command processing.
If the input data file was created by DATAUNLOAD processing, then the CMS FILEDEF command that defines the DATALOAD input data file should be identical to the information in the FILEDEF command used when the file was created by DATAUNLOAD processing.
For input files, the device type you enter on the FILEDEF command indicates the device from which you want records read. It can be DISK, TERMINAL, READER (for input from real cards or virtual cards), or TAPn (for tape). Using the above example, if your input file is to be read from your virtual card reader, the FILEDEF command might be as follows:
FILEDEF INPUTDD READER
Or, if you were reading from a tape attached to your virtual machine at virtual address 181 (TAP1):
FILEDEF INPUTDD TAP1
For output files, the device you specify can be DISK, PRINTER, TAPn (tape), or TERMINAL.
If you are using a CMS disk file for your input or output, specify:
FILEDEF ddname DISK filename filetype filemode
Note: | If an asterisk (*) is used for the file mode of an output file, the results are unpredictable. The file mode field is optional; your A-disk is the default assumed. |
If you want an output file to be constructed in OS simulated data set format, you must specify the file mode number as 4. For example, a program contains a dbspace for an output file with the ddname OUTPUTDD, and you are using it to create a CMS file named DTABSE OUTPUT on your B-disk:
FILEDEF OUTPUTDD DISK DTABSE OUTPUT B4
If you enter only the ddname and device type on the FILEDEF command, such as:
FILEDEF ddname DISK
where ddname is the name of the output file you assigned as the parameter of the FILEDEF command, you have then created a file on your A-disk. For example, if you assign a ddname of OSCAR to an output file and do not issue a FILEDEF command before you execute the program, the CMS file FILE OSCAR A1 is created when you execute the program.
You can use the label operands on the FILEDEF command to indicate that CMS tape label processing is not desired. (This is the default.) If CMS tape label processing is desired, you can use the label operands on the FILEDEF command to indicate the types of labels on your tape.
The FILEDEF command has many options; those mentioned below are a sampling only. For complete descriptions of all the options of the FILEDEF command, see the VM/ESA: CMS Command Reference.
Note: | If a SET ERRORMODE CONTINUE command is in effect during Database Services Utility command processing, which requires tape file operation involving multifile volume, the use of the LEAVE option in the FILEDEF may cause a tape positioning error. If a Database Services Utility command processing involving tape file operation fails, the subsequent command processing requiring access to the same tape will get a tape file open error. This error results from the wrong tape positioning caused by the use of the LEAVE option in the FILEDEF. |
If you are using the FILEDEF command to relate a data control block (DCB) in a program to an input or output file, you need to supply some of the file format information, such as the record length and block size, on the FILEDEF command line. For example, you have coded a DCB macro for an output file as follows:
OUTFILE DCB ddname=OUT,MACRF=PM,DSORG=PS
When you are issuing a FILEDEF for this ddname, you must specify the format of the file. To create an output file on disk, blocked in OS-simulated data set format, you could issue:
FILEDEF OUT DISK fn ft A (RECFM FB LRECL 80 BLOCK 1600
Note the following command-specific information for the RECFM, BLOCK, and LRECL parameters:
|When you are running DATALOAD under CMS 14 or earlier, and the |DATALOAD input data file contains records with more than 32,760 positions of |data, you must use variable-length, spanned records (RECFM=VS or VBS). |Specify as options only the RECFM and block size (BLOCK or BLKSIZE) parameters |in the FILEDEF command defining the data file. (The LRECL specification |does not apply and would be overridden if specified.) For spanned |record segments, use a maximum length of BLKSIZE-4.
|When you are running DATALOAD under CMS 15 or later, and the |DATALOAD input data file contains records with more than 32,760 and less than |65,536 positions of data, you can use fixed length, unblocked records (RECFM |F).
You should always specify a record format of variable-length spanned, blocked (VBS) for UNLOAD processing. UNLOAD processing changes the record format to variable-length, |spanned (VS).
A block size greater than 8 244 is recommended for tape output files created by UNLOAD processing.
The record format used for RELOAD processing is variable-length blocked, spanned (VBS). If a RECFM value other than VBS or an LRECL value is specified, it is ignored. A maximum length of BLKSIZE-4 is used for the spanned record segments.
If you specify a RECFM other than FB, or specify an LRECL value, the value is ignored.
If you specify a RECFM other than FB, or specify an LRECL value, the value is ignored.
Usually, when you execute one of the language processors, all existing file definitions are cleared. If the development of a program requires you to recompile and reexecute it frequently, you might want to use the PERM option when you issue file definitions for your input and output files. For example:
CP SPOOL PUNCH TO * FILEDEF INDD DISK TEST FILE A1 (LRECL 80 PERM FILEDEF OUTDD PUNCH (LRECL 80 PERM
In this example, because you spooled your virtual punch to your own virtual card reader, output files are placed in your virtual reader. You can either read or delete them.
All file definitions issued with the PERM option stay in effect until you log off; therefore, specifically clear those definitions or redefine them:
FILEDEF INDD CLEAR FILEDEF OUTDD TAP1 (LRECL 80
In the above example, the definition for INDD is cleared; OUTDD is redefined as a tape file.
When you issue the command:
FILEDEF * CLEAR
all file definitions are cleared, except those you enter with the PERM option.
Note: | When a program ends abnormally, or when you issue the HX immediate command, all file definitions are cleared, including those entered with the PERM option. |
Suppose you issue a FILEDEF command for an output file and assign it a CMS file identifier that is identical to that of an existing CMS file; then, when anything is written to that ddname, the existing file is replaced by the new output file. If you want, instead, to have new records added to the end of the existing file, you can use the DISP MOD option as follows:
FILEDEF ddname DISK fn ft fm (DISP MOD
Note: | To see the file characteristics used in the Database Services Utility's processing, look at message ARI08681 in the message file. |