List Command [L]

Qedit 5.7 for HP-UX

Home Previous Next


List Command [L]

Prints lines of the current workfile or an external file either on your screen or to a printer device.

LIST [$option...] [ rangelist ]

(Default: rangelist = *)

LIST [$option...] filename[,UNN] [ rangelist ]

(Default: rangelist = ALL)

(Q=no linenums, T=template, J=jumping)

If you do not specify a filename, List displays lines of the current workfile. If you do specify a filename, List displays lines from that file without Shutting your current workfile. You can refer to the "previous" file by a shorthand method, a "$".

If you specify a single line number as a rangelist and that line does not exist in the current file, Qedit's action depends on the Set List Nearest setting. If the option is Off, the default, Qedit displays a No Line warning. If the option is On, Qedit displays the nearest line. For example, if lines 100 to 120 are missing from a file, here is what would happen:

/List 100
Warning: No Line
/Set List Nearest On
/List 100
   121    This is line #121.

If you are trying to do something similar on an external file, Qedit does not display anything.

Specify filename,UNN when listing a data file which has numeric characters in the last 8 column positions and they are not valid sequence numbers.

When you list lines of your current workfile, Qedit shows only the columns within the current left and right margins, and the default rangelist is the current line (e.g., List = List *). When you List an external filename, margins are ignored and the default rangelist is ALL.

Examples

/list 5              {display line 5 only}
/listq 5/            {List-Quiet from 5 to Last}
/list "customer"     {all lines containing "customer"}
/list -5/+5          {display current vicinity}
/l report.cob        {display entire source file}
/l report.cob ]-10/  {print last 11 lines of file}
/l $ "$page"(1/5)    {"$page" in column 1 of previous file}
/set left 55;set right 132  {set margins in wide file}
/listt all           {show template above columns}
/list "bob"  (upshift)      {"bob","BOB","Bob",etc.}
/list "@UPD@MAST@" (pat)  {strings UPD and MAST both in line}
                             {pattern matching}

$-Options

You can configure permanent options for the List command using Set List; you can also select temporary options within a specific List command. The temporary options are preceded by a dollar sign.

LIST [ $option ... ] [ filename[,UNN] ] [ rangelist ]

The temporary $-options come after the command name and before the external filename and rangelist.

Here are the $-options accepted in the List command:

[$DEVice device ] The $device option sends output to a specified device. The device must be a valid printer name or class. The following command sends lines 1 through 30 in the current file to the device printer:
/list $device printer 1/30
[$lp | $lpa | $lpb | $record ] $lp, $lpa and $lpb send output to a device associated with an environment variable of the same name. For example, to print to the device called Laser with the $lpa option, you must set the LPA environment variable to Laser, as in export lpa=laser. If the LP environment variable is not set, Qedit will attempt to send the output to the default system printer. But if the LPA or LPB environment variables are not set with a valid device name, an error will occur. $Record sends output to LPCRT=stdlist via Record mode.
[$HEX | $OCTAL | $DECIMAL] Numeric dump
$CHAR Remove garbage; combines with Hex/Octal/Dec
$PCL code LaserJet fonts and orientation
$DUPLEX Double-sided printing on certain LaserJets
$EVEN | $ODD Outputs even or odd number of pages
[$COLUMNS (range, ...)] Lists only certain columns
The $columns option allows you to list only the contents of certain columns. You can specify up to four column ranges. The ranges have to be enclosed in parentheses and can be separated by commas or spaces.
A range must have a start column and, optionally, an end column. If only a start column is specified, the end column is assumed to be the same. In this case, Qedit lists only one column. For example
/List $columns (5) {lists only the contents of column 5}
/List $columns (5/10) {lists the contents of columns 5 to 10}
/List $columns (5 20/30) {lists column 5 and 20 to 30}

Column numbers must be valid for the Language of the file. For most files, the first column is 1. For COBOL-type files, the first column is 7. Column numbers must also be within the current left and right margins. The column numbers do not have to be entered in a particular order. For example, the column numbers in the first range can be greater than the column numbers in the second range. The text appears in range order (i.e., range1, range2, range3 and range4). The same column can be included in multiple column ranges. The total number of columns listed cannot exceed the absolute line length maximum (8,172 characters).
Although a template Listing is allowed with $columns, the output might not be very helpful. For example,
/LT $column (15/20)
+....2
1 O
2 pp
3 QQQ
4 rrrr

List $include is supported with $columns, but included files are treated as if they are the same type as the main file. For example, if you include a COBOL file within a Data file, the COBOL file will start at column one.
You can specify a rangelist (e.g., a search string with $columns). Qedit first searches for the string, which can appear anywhere on the line, then applies the $columns specification.
$DOUBLE Double space the listing (or $DBL)
$SHIFT Shift the listing four spaces to the right
[$RIGHTBY spaces] Shift the listing to the right by the number of spaces
The $rightby option works like the $shift option. It allows you to shift the printed output to the right. The $shift option shifts the output by four spaces. The $rightby option allows you to specify the number of spaces by which the output is shifted. This number can be between 1 and 30.
/List $shift LP {shifts output by four spaces}
/List $rightby 4 LP {also shifts output by four spaces}
/List $rightby 20 LP {shifts output by 20 spaces}
$INCLUDE List/search $include files as well
$USE List/search usefiles as well
$PAGE [ ON|OFF ] Override Set List Page option
$LINES count Override Set List Lines (per page)
$LENGTH characters Specify the maximum line length

Here is an example that uses three of the $-options:

/list $lpa $double $shift all

This command would list all of the current file to the LPA with double spacing, and the listing would be shifted four spaces to the right. To send the output of the List command to the device called Laser, an environment variable must be set to a valid printer name before running Qedit (export LPA=laser).

When listing an external file, the $-options must come before the file name:

/list $hex $char filename     {hex-char dump of file}

Include Files

Normally, Qedit only searches the current file for a string. If you specify the $include keyword, however, Qedit will also search the $include files for the string.

/list $include "global_variable"

The lines that specify Include files must begin with either "$", "#", "!", or ".". In SPL programs, an exclamation point indicates that the rest of the line should be treated as a comment. So, if a line starts with an exclamation point followed by the word Include, Qedit also assumes this to be a comment and not an actual Include statement.

The $include command must be spelled out in full, and it can be indented from the prefix character ($, #, etc.).

The prefix character can be in any column as long as it is preceded by spaces only. Even though Qedit allows prefix indentation, other programs such as compilers might require prefixes to be in specific columns e.g. column 1.

So, as far as Qedit is concerned, the following examples are valid Include source lines:

$include 'globals.source'
    $include constant.srcinc
    $    include headers
#include <strings.h>
#include "parser/bnf.c"
!   include somefile
.include    chapter1.book

You cannot combine the $use and $include options.

Listing C Include Files

Qedit/UX assumes that any include statement such as

#include <stdio.h>

is a C include file. If the file name starts with a letter, it is qualified with /usr/include/. This is where the standard C include files are located. C file names that start with "../h" are ignored because they indicate Include files for rebuilding the HP-UX kernel.

Usefiles

The $use option is very similar to the $include option. If you specify the $use keyword, Qedit will also search any usefiles for a string. Usefiles are commonly used in PowerHouse source code, Qedit and Suprtool command files, and jobs streams that run Qedit and Suprtool.

/list $use "data.def"

The lines that contain the "use" directive must have the word "use" as the first word in the line. Leading blanks are allowed. Everything after the word "use" is assumed to be a file name.

You cannot combine the $use and $include options.

$Device Option

The List command now has an option to specify the HP-UX print device. For example:

list $device printer 1/10

The above command prints lines 1 through 10 of the current file to the printer name or class called Printer. The name specified after the $device keyword must be a valid printer name or class. If both the $device and $lp keywords are used, the $device takes precedence.

Configuring Printers

By using environment variables before running Qedit, you can define LP, LPA and LPB in your .profile as three different printers on your system.

$LP;export LP
$LPA=serialp;export LPA
$LPB=shipping;export LPB

Merging Options

The $-options in the List command are merged with the Set List options, except that Set List Record ON applies only to the file LP, not LPA and LPB. The $-options can be combined wherever they make sense; they can be used with Jumping, Quiet and Template, and can work on the current workfile or an external file. $-Options may be shortened (e.g., $h = $hex).

Interrupting a Listing

Press the Control-S key to "pause" the listing for review. Then, press Control-Q to resume the listing. On newer HP terminals, the Stop key pauses a listing until you press Stop again. To stop the List command, press the Control-Y key.

Listing External Files

With the List command, you can look at any file on a system to which you have read access security.

/list /etc/profile

Qedit studies the file and determines whether it has sequence numbers or not. If you ask for a rangelist of lines, Qedit implicitly numbers a file without numbers. It starts at line 1.0 and adds the current Set Increment value. If the file has sequence numbers, Qedit uses them, unless it finds illegal numbers or numbers out of sequence. It then prints the following message:

Error: line number out of sequence (001200) - renumbering the rest

The string in parentheses is the incorrect line number. You should make sure it contains numeric digits only and that it is greater than the number on the previous line. To check this information, you should text the file using the Unnumbered option.

After reporting the information, Qedit then assigns new numbers to the lines, starting with the last valid number and adding the current increment.

Qedit uses this shorthand character to refer to the most recent external file name: "$". For example,

/list report.cob "$page"(1/5)
/list $ 500/600

Template Listing

The LT command prints a column-number template before the first line of the listing.

/lqt 5
....+....10...+....20...+....30...+....40...+....50..
    training of Qedit users is so easy that you will

Remember that the first column number in a standard COBOL source file is column 7, not column 1. For a COBFREE file, the first column is 1. In addition, if you have done Set Left and Set Right to define margins for your file, the template starts with the Left margin column and ends with the Right margin column.

/set left 20;set right 41
/lqt 5
20...+....30...+....40
it users is so easy th

Browsing or "List-Jumping"

When you add "J" to "List" it means list-jumping. This lists the lines specified, but stops every 23 lines (this pause is handy at 19.2K baud). Browse quickly throughout a file, viewing as much or as little of each section as you like. The default rangelist for ListJ is */Last, and ListJ linenum means start jumping at linenum. You can go into Browse mode quickly from Line mode by using the function keys. Press F6 to start browsing at the current line, press F5 to browse starting back a page, and press F2 to roll the screen forward a few lines before starting to browse.

At the end of each screen, ListJ prompts you for "what to do next?" and waits for your reply. If the user presses Return or F6, or types "yes", Qedit displays the next screen. If the user presses F8 or Control-Y, or types "no", Qedit stops the listing. If the user types a line number, a string, or a relative line count (e.g., -50, +5), or presses F2, F3, F4, or F5, Qedit moves to a new location within the file. When you enter any command, Qedit stops the listing, returns to Command mode, and executes the command. When you are on an HP terminal, ListJ enhances and erases the line with the "what to do next?" prompt.

You can combine ListJ with the $include option to browse through the specified files as well as their $include files. You can combine with ListJ with "Q" to display the lines without sequence numbers. Also, you can combine "ListJ" with "T" to print a column template at the top of each screen. In fact, you can combine all three options into "ListJQT" to List-Jump without line numbers, but with a column template.

The screensize can be changed from 23 lines to another number with Set List LJ nn (where nn is some number of lines from 5 to 100). If you put the command Set List QJ On in your Qeditmgr file, you can avoid seeing sequence numbers when you browse.

When List-Jumping reaches the last line of your file, it prints "End! Are you DONE? [yes]" and waits for your answer. "Yes" ends the listing, and "No" starts listing again from the beginning. Set List Endstop On disables this question; List-Jumping just prints the last line of the file and ends the LJ command.

Controlling Printer Listings

When you specify "$lp" (or "$lpa" or "$lpb") in a List command, Qedit looks for an LP environment variable, retrieves the value, and uses this as the device name. The lines that would have been printed on the terminal are written to the printer file instead. At the end of the command, Qedit closes the file, which releases it for printing.

The default Qedit listing to the printer is a raw dump of your lines, with or without line numbers. It has no page breaks, no headings, no title, and no page numbers. However, you can override this default with the Set List command.

Listing to Attached Printer

To list to a printer that is attached to your terminal, use List $record. If you want all listings to $lp to go to the attached printer, do Set List Record On and then List $lp. Qedit will use Record mode on your terminal or PC to print on the attached printer. This option opens a file named LPCRT instead of LP. If you are listing to an attached printer from a terminal, your terminal may remain locked after the printout is completed. This generally happens when you have handshaking enabled. (G-H straps set to No). You can do a soft reset to unlock your terminal.

If handshaking is disabled (G-H straps set to Yes), the List command works and returns control to the terminal, but two "S" characters are printed on the terminal. There is currently no known workaround to these problems.

If you have a LaserJet connected to your PC and are using Reflection, you will want to Set Printer-Passthru-Conv No in Reflection. Otherwise you will find that some characters are printing oddly, such as the square block printing as a plus-minus sign. If you are using Reflection for Windows, the above option may be called "Disable Printer Translation" or "Use Host Character Set." As well, you have to select "Bypass Windows Printing" and disable "Auto Form Feed."

You can combine this option with other listing options such as $PCL or $duplex. You cannot interrupt Record mode with Control-Y, but you can do a soft Reset. This unlocks the keyboard and causes the rest of the output to appear on the screen. You can then stop it with Control-Y.

LP Listings with Headings

To have Qedit do a page break every 60 lines and put a heading with a page number on each page, do List $page On $lp (or $record, $lpa, $lpb). To configure "paging" as the default, do Set List Page On. Two lines at the top of each page are used as a heading. The first line contains the page number, the file name (or the last Text file name in the case of Qeditscr), and the time of the listing, and the second line is blank.

In this mode, Qedit also looks for $title, $page, #pragma page, and #pragma title commands in your file and uses them to create page breaks. The optional string parameter of these commands replaces the date and time in the page heading (e.g., $page "Monthly Staff Review"). A $page or $title command without a string clears the title area of the heading.

To vary the number of lines per page, do List $lines nn, or use Set List Lines nn for a permanent override, where nn is a value between 1 and 256. (Assumes Set List Page On.).

/set list page on lines 59

To print the heading only on the first page, use $lines 0. This causes continuous printing with no page ejects.

/list $lp $lines 0 all     {ignores $page too}

To perform continuous printing with no automatic page ejects but skip to a new page on $Page directives, use $lines 999.

/list $lp $lines 999 all     {skips to a new page on $page only}

To drop the file name from the page heading, do Set List Name Off. (Assumes Set List Page On.)

/set list page on name off

To drop the page numbers from each page, do Set List Num Off. (Assumes Set List Page On.)

/set list page on name off num off

To drop the title from the heading, do Set List Title Off. (Assumes Set List Page On.)

/set list page on title off

To drop the two-line heading from each page while still doing page breaks, use Set List to disable the three components of the heading:

/set list page on name off num off title off

Getting an Even or Odd Number of Pages

There are times when the number of printed pages is important. For example, you could have a printer that is always loaded with pre-printed forms that come in pairs (e.g., Page 1 of 2 and Page 2 of 2) or the paper is folded in certain ways so that a report is easier to tear up and insert into a binder. In both examples, sending a report with an odd number of pages would cause the next output to be on a wrong page.

To prevent this from happening, you can now use the $even or $odd options on the List command and ask Qedit to "round up" the number of pages. The $even option ensures that the output has an even number of pages. Similarly, the $odd option ensures there is an odd number of pages by sending an extra page eject sequence before closing the output file.

These even and odd options are mutually exclusive (i.e., they cannot be both enabled at the same time). If you try use them both on the same command, Qedit uses the last one in the sequence. For example, you can type

/List $even $odd $lpa myfile

Qedit does not see this as an error and uses the $odd option, ignoring $even.

These options only make sense if you are sending the list to a printer, either attached or spooled. They have no effect when listing the file to the screen. For this reason, you have to specify a destination printer using $lp, $lpa, $lpb, $record or $device.

You can also use one of these options as the default by using the Set List command. Specifying a $-option on the List command overrides the Set value. There is currently no way to completely ignore the Set options. If you want both options to be disabled, you have to issue

/Set List Even Off Odd Off

prior to the List command.

Double-Spaced Listings

When listing to LP, you can force the result to be double spaced with List $double. This feature can be combined with most of the other features of List, including LT, LQ, and Set List Page On. To make all printer listings double spaced, do Set List Dbl On. LQ on a CCTL file disables the Double option because the CCTL codes in the file control the spacing on the listing.

LaserJet Listings

Qedit has two special options for HP LaserJets: $duplex and $PCL. Duplex means double-sided printing, and PCL means Printer Command Language, which is used to select fonts, spacing, and orientation.

$Duplex for Two-Sided Printing. Some LaserJets can print on both sides of the paper; use List $duplex to enable this option.

/list $lp $duplex all

PCL = Printer Command Language. All LaserJets have several sizes of character fonts and can print in either landscape or portrait orientation. To help you take advantage of these features, Qedit has a number of PCL codes that can do all the work for you. PCL stands for Printer Command Language, which is the HP standard for printers. To specify a LaserJet option for a single listing, use List $PCL; to configure all listings, use Set List PCL. To disable the special PCL option, use PCL 0. Get a quick on-line listing of the PCL options with

/hq set,list

Changing Fonts and Orientation

Landscape-Tiny: PCL 1. To list to the LaserJet in the tiny font that prints across the paper sideways (i.e., 16.67 pitch, landscape), use PCL 1.

/list $device printer $pcl 1 all

Landscape-Regular: PCL 2. To list with the regular Courier font in landscape orientation, use PCL 2.

The Standard: PCL 3. The normal default for LaserJet output is portrait orientation (across the narrow side) with the Courier font. However, once you insert a font cartridge into your LaserJet, it may select one of the cartridge fonts as the default instead of Courier. PCL 3 allows you to select the standard Courier font, even if another font cartridge is installed.

Portrait-Tiny: PCL 4. Some LaserJets provide the tiny "Line printer" font in portrait orientation as well as landscape orientation. PCL 4 selects this option.

A4 Special: PCL 5. To print 80 columns, instead of 77, across A4 paper using the standard Courier typeface, try PCL 5. This tightens the spacing between characters.

Legal-Landscape-Tiny: PCL 6. To print tiny letters in landscape orientation on legal-size paper, use PCL 6.

You can combine PCL 1, 2, 3, 4, 5, and 6 with Page On and Off, with Lines 0, with LQ, with $DBL, with $record, and with $duplex.

Two-Column Listings

If your LaserJet supports "Line printer" font in landscape orientation, you can print listings across the page with two columns of text side by side.

/list $lp $pcl 10 all  {two-column listing format}
/lq $rec $pcl 10 1/200

If you have a legal-size paper tray, you can use PCL 11 to print two wide columns of 110 characters each on a single piece of paper.

A4-Size Paper

Most of the PCL options, with the exception of PCL 5, were designed and tested with North American letter-size paper. PCL 5 is especially for A4 paper; it reduces the horizontal spacing between characters so that 80 columns of Courier output can fit on a single line. In addition, if you add 2000 to a PCL code, Qedit adjusts the number of rows and columns for that option to match A4 paper. For example, to print two-up landscape on A4 paper, use PCL 2010 instead of PCL 10.

In general, selecting A4 paper gives you more space along the long dimension of the paper and less space along the short dimension. If you are happy with the way letter-size rows and columns work on A4 paper, simply do not add 2000 to the PCL code.

Summary of Qedit PCL Codes

PCL L/P Font A4 Rows A4 Columns Letter Rows Letter Columns Notes
1 L lp 58 188 60 175  
2 L courier 43 110 45 100  
3 P courier 64 77 60 80 "standard"
4 P lp 85 128 80 132  
5 P courier 64 80 60 80 A4-squeeze
6 L lp 60 223 60 223 legal-size*
10 L lp 58 95 60 87 two columns
11 L lp 60 110 60 110 2-up legal*

L/P mean landscape or portrait orientation.

* Note: PCL 6 and 11 were designed to print on North American legal-size paper and will select that size. However, you can see what happens with A4 paper by using 2006 and 2011. Some people have found this useful.

Roman-8 vs. ASCII

The PCL option requests a Roman-8 character set, but some combination font cartridges only supply the ASCII character set (half as many characters means twice as many fonts in a single cartridge). If you ask for landscape Line printer and get landscape Courier instead, your Line printer font probably has the ASCII character set instead of the Roman-8 character set. To request an ASCII font, add 1,000 to the PCL code. For example, if you have a Super Cartridge (55 fonts in one!), use PCL 1001, 1004, 1006, 1010 and 1011. To select both ASCII and A4 paper, add 3000.

Folding Wide Lines

Qedit/UX might have difficulty handling files without Newline delimiters at the end of each line or files with lines longer than 8,172 characters. To be able to access these files, you can use the $length option to specify the maximum number of characters you want on each line.


Home Previous Next