FILEDEF Command Under UNIX, Windows, IBM i, z/OS, and OpenVMS

In this section:

How to:

A logical name (or ddname) is a shorthand name that points to the physical file name as the operating system actually knows the file. Logical names simplify code by allowing short names to be used in place of the longer physical file name.

The FILEDEF command assigns a logical name (or ddname) to a physical file name and specifies file attributes. FILEDEF assignments are in effect for the duration of a connection (except when a server is running in Pool Mode). They are released when the connection to the server is closed or a FILEDEF CLEAR is issued.


Top of page

x
Syntax: How to Use the FILEDEF Command in UNIX, Windows, IBM i, z/OS, and OpenVMS
FILEDEF ddname devicetype fileid [([LRECL n] [RECFM fm] [APPEND]]
FILEDEF ddname CLEAR

where:

ddname

Is the logical name. It may contain 1 to 8 alphanumeric characters.

devicetype

Identifies the type of device with which to interact. Specifies DISK for a file that resides on disk. Other device types are PRINTER, TRMIN, and TRMOUT, which have special meanings and options. For more information, see Other FILEDEF Features.

CLEAR

Clears the specified ddname.

fileid

Is the physical name of the file as it is known on the particular operating system using the native style of the operating system. For instance, c:\mydir\myfile.dat (Windows), \\mymachine\\mydir\myfile.dat (Windows), /home/myhome/mydir/mtfile.dat (UNIX, z/OS, and IBM i IFS), DISK$MYDISK:[MYHOME.MYDIR]MYFILE.DAT (OpenVMS), and MYLIB/MYFILE(MYMEMB) (IBM i QSYS). UNIX, z/OS, and IBM i IFS are case-sensitive file systems where lower case file names are the norm, so appropriate names should be used when coding the fileid option of the FILEDEF. To support directory names with embedded blanks on Windows, the complete fileid needs to be enclosed in single quotation marks.

There is an additional mode of operation when APP ENABLE is active (the default as of 5.2.0). In this mode of operation UNIX like relative path name is used and the path refers to which application directory under the APPROOT directory. For instance, abc/mydata.ftm is the abc directory, which found under the directory pointed to by APPROOT.

Note: APP usage can handle any number of directories below APPROOT when nested applications are on (internal default or when edaserver.cfg has nested_app=y). APP usage is limited to one directory below APPROOT when nested applications are off (edaserver.cfg has nested_app=n).

LRECL n

Specifies the record length, n, in bytes. This parameter is optional. If you omit it, the default is 80 bytes. Note that the left parenthesis preceding the optional parameters is required.

RECFM fm

Describes the record format. Specifies F for fixed format, V for variable format. This parameter is optional. If you omit it, the default is fixed format. Note that the left parenthesis preceding the optional parameters is required.

APPEND

Enables you to open the specified file and add new material at the end of the file. This parameter is optional. If you omit it and the specified file exists, it will be overwritten. Note that the left parenthesis preceding the optional parameters is required.

Note that FOCUS data sources (files with the .foc extension) that do not conform to the default naming conventions are identified using the USE command, not FILEDEF.


Top of page

x
Other FILEDEF Features

PRINTER as a device type is used to change the default output file for the OFFLINE print file or set output destinations. For more information, see OFFLINE Printing.

FILEDEF TRMIN TERM LOWER is used to change the uppercasing behavior of an interactive session (edastart -t) into case sensitive mode. FILEDEF TRMIN TERM UP is used to restore default behavior. Interactive session mode is typically used for testing and is not considered a production feature for general use.

FILEDEF TRMOUT DISK fileid is used to capture session output into a file and is only valid during an interactive session (edastart -t).

FILEDEF TRMOUT TERM is used to restore default behavior. Interactive session mode is typically used for testing and is not considered a production feature for general use.


Top of page

x
OFFLINE Printing

In this section:

Server side printing of formatted reports is accomplished using the OFFLINE command, which sets up and issues a default OFFLINE FILEDEF to receive the formatted outputs after an OFFLINE CLOSE is issued.

There may be one or more outputs buffered to the same output file for printing, but they are not released to the file until an OFFLINE CLOSE is issued. If a system level variable for FOCPRINT is available at OFFLINE CLOSE time, it will be used to attempt printing of the actual file.

The FILEDEF OFFLINE feature has been improved as of release 5.2 to allow the specification of output destinations and, in some cases, additional operating system print command switches for features such as multiple copies.

Prior behavior was that if the operating system variable FOCPRINT was declared (with an operating system command and a $1) then it would be called to take an action on the file name which also replaced the $1 in the string.

The FILEDEF command has been improved to:

FILEDEF OFFLINE PRINTER [filename] [ ( PRINTER printername ]

The new printer name option is used with the standard print feature of a given platform. If no printer name is declared or is set to blank then the offline file is created, but the print feature is not called. Since printing is platform specific, each platform must be described here individually, however, there are still some common issues that are sometimes best resolved by creating a shell layer that acts as a proxy between the server and the print system.



x
UNIX and USS

The printer name is dropped in as the "-d" switch value in the "lp -c -d" command. The "-c" switch is used to avoid over-writing of the offline file before actual printing has occurred. If additional lp switches are desired (like multiple copies with -n switch) they may be stacked into the name by enclosing the string in single quotation marks:

FILEDEF OFFLINE PRINTER ( PRINTER '29d1 -n 2'

If a site uses lpr instead of l,p then an lp shell script can be created in the $PATH before the standard lp command and can act as a proxy to call lpr instead. The lp script could be as simple as "/usr/bin/lpr $*" to redirect lp to lpr.

Note: On USS, the file is spooled to the system and actual disposition will depend on the configuration of the printer spool.



x
OpenVMS

The printer name is dropped in as the "/QUEUE=" switch value in the "PRINT/QUEUE=" command. OpenVMS always makes a copy of the file to be printed so it does not have an over-writing the offline file problem. If additional PRINT switches are desired (like multiple copies with /COPIES= switch) they may be stacked into the name by enclosing the string in single quotation marks:

FILEDEF OFFLINE PRINTER ( PRINTER '29d1 /COPIES=2'

Sites rarely use anything but the standard PRINT command, but can be also proxied if necessary by creating an alternate printer command at the OS level or queue / symbiont that routes to the alternate method.



x
Windows

The printer name is a shared printer name and is used to set up (and later drop a NET USE for the LPT1device to a shared name (for example, \\nodename\myprinter), which is then used in a PRINT /D:LPT1 command to print the actual file. As such, additional switch options can not be done and use of a PRINT.BAT as a proxy is the only method for further manipulation of the output.



x
IBM i

Note: IBM i was formerly known as i5/OS.

The output is always spooled from the offline file to the print spool using the system QPRINT file (with whatever the standard values are) on the server's library list. If the spool is set to directly print, then output will always be routed as directed with no declaration of a printer name via FILEDEF. If output is not automatically routed and a printer name (via FILEDEF) is declared, then a CHGSPLFA command will be issued with the printer name as the OUTQ() value to direct the spool file to a destination. If additional CHGSPLFA parameters are desired (like multiple copies with COPIES() parameter) they may be stacked into the name by enclosing the string in single quotation marks:

FILEDEF OFFLINE PRINTER ( PRINTER '29d1 COPIES(2)'

If an alternate QPRINT file is desired to control some special aspect (like adjusting page size), this must be done by placing an alternate QPRINT in a library before the standard copy in QGPL. Note that the CRTPRTF command for creating printer attribute files does not create a default QPRINT that matches the IBM delivered standard default that is in QGPL. To create a QPRINT with standard IBM delivered default values use:

CRTPRTF FILE(*CURLIB/QPRINT) RPLUNPRT(*NO) CHRID(*CHRIDCTL)

Then make any site specific changes and change the owner attribute rights from *ALL to *CHANGE (to prevent over-writing) with:

EDTOBJAUT OBJ(*CURLIB/QPRINT) OBJTYPE(*FILE)

Also note that FOCUS 6.x allowed specifically named printer files and needed the CTLCHAR(*FCFC) option. The Server does not allow specific alternate names and uses the library path to locate and use the first found QPRINT file (standard IBM i library path behavior) and that use of a printer file with CTLCHAR(*FCFC) will cause page breaks to fail.

The use of an lp script on IBM i as a proxy is not effective because lp is not used. The use of alternate QPRINT files is the closest equivalent to an lp proxy.



x
FILEDEF OFFLINE to DISK versus PRINTER

The "( PRINTER printername" feature is only valid in reference to when the FILEDEF device is PRINTER. There is, however, a difference between the use of DISK versus PRINTER as a device in a FILEDEF for OFFLINE. When the device DISK is used, page breaks are represented by a 1 in the first column of a given line where a page break is to occur; this is the FORTRAN Carriage Control method of page control and is a vestige of the product's original mainframe roots. When the disk device is PRINTER, the more modern, Control L (^L / Decimal 12 / Hex 0C) form feed method is used.



x
Other Printing Issues

Very often sophisticated laser based printers are "hung" off networks and communicated with various print protocols. While these printers may come from many manufactures, a very common (but not standard) attribute of these types of printers is automatic sensing between a plain clear text file being sent to the printer and a postscript file that contains printer attribute commands as well as the text to print. OFFLINE files are plain text (vs. HOLD FORMAT PS which do not get spooled via OFFLINE and it is up to the user to direct to a printer). Very often these sophisticated printers can be set up or used improperly causing a printer to think a plain text file is postscript when it is not and yielding a page with a postscript error message. This has only been seen so far when printing from Windows, but is in theory possible from any platform.

This problem is not considered to be a Server issue because the software is not directly manipulating these printers and uses standard commands supplied by the OS vendor for printing. Generally, this problem can also be reproduced using standard print tools stand-alone from the Server environment. The systems administrator for these printers should be able to track down why this happens in any given environment and take corrective action. However, this may also be corrected by creating a proxy script to inject a leading character into the output that resets the printer. Generally, this is a control D, but printers may vary. Specific implementation of such proxy scripts is left to the customer since needs may vary greatly.


iWay Software