Type

From BR Wiki
Jump to navigation Jump to search

The Type (TY) command sends the contents of a specified file to the screen, a printer, or another file.

Comments and Examples

Text files appear in a legible format when displayed with the Type command. The presence of non-alphabetic or non-numeric characters in other files, such as object program files, may make these files illegible.

however wildcard characters are not allowed in the file name that specifies the TYPE command.

The following example displays, one screen at a time, the contents of the file SAMPLE.ONE:

TYPE B:SAMPLE.ONE -P

The next command sends the same contents to a printer:

TYPE B:SAMPLE.ONE PRINT

Syntax

TYPE <file name> [{[>[>]<output file>|PRINT}][-P]

Defaults

  1. Display the information on the screen.
  2. Scroll entire contents of file without pausing.

Parameters

The TYPE command requires the file name parameter, which specifies which file the system should display on the screen or send to a printer or file.

The optional >redirected output file parameter indicates the file or device to which the contents of the specified file should be sent. One redirection arrow causes the information to be written over any data that previously existed in the file. Two redirection arrows >> causes the information to be appended to the end of the file.

PRINT, which operates the same as >PRN:, sends the contents of the specified file to a printer rather than to the screen.

Note that TYPE PRINT does not utilize printer substitutions, but Ctrl-P does.

The -P option causes scrolling to pause after the typed contents of the file fills one screen.

Other Considerations

  1. TYPE works on locked files.
  2. TYPE PRINT no longer inserts carriage returns in long print lines, unless they are going to the screen. This was fixed earlier for files. Now it is fixed for typing to printers as well.

Note that TYPE skips the header portion of Internal files)

Printer Escape Sequences

As of 4.2, TYPE translates printer escape sequences.

With the following syntax:

TYPE filename >destination [PRINTER_TYPE= HP3]

Printer translation is done in accordance with the destination printer name matching that is done at OPEN time for printer files (same as NAME=PRN:/printer etc). The optional PRINTER_TYPE= specification is valid only if the destination is a display file. It is matched against the second parameter of configuration file PRINTER statements.

TYPE PRT\report-file   >PREVIEW:/HP4

This will translate HP4 printer escape sequences embedded in report-file.

TYPE PRT\report-file1  >report-file2   PRINTER_TYPE=HP4

This will copy file1 to file 2 interpreting HP4 printer escape sequences.

In contrast, COPY supports copying a print file unaltered to a printer. The following example will copy one to the other unaltered:

COPY PRT\EDITLIST.255  DIRECT:/HP4