DELETE - Delete Selected Lines

Syntax


DELETE


DUP

[ line-control-range ]


DELETE

{ NOTE | xNOTE | ZNOTE }

[ line-control-range ]


DELETE

[ string [ PREFIX | SUFFIX | WORD | CHAR ] ]

[ start-column [ end-column ] ]

[ line-control-range ]

[ color-selection-criteria ]

[ X | NX ]

[ U | NU ]

[ ALL | FIRST | LAST | NEXT | PREV ]

[ TOP ]


Operands


There are three basic modes of DELETE operation.   DEL DUP is single purposed to delete adjacent duplicate lines.   DEL NOTE is used to delete NOTE lines within a specified range while the third provides a more general use delete function that can delete data lines that match a wide range of matching capabilities.


Note that DELETE DUP and DELETE NOTE do not permit other DELETE keywords to be used.  In particular, you cannot issue a command like DELETE DUP ALL or DELETE NOTE ALL.  Within the specified line-control range, or within the entire edit file, all duplicates or all notes are deleted; the "ALL" is implied but cannot be used on these commands.


Note that to distinguish these special command modes, if the words DUP or NOTE are to be used as strings in the general purpose delete function, they must be enclosed in quotes to prevent them being treated as keywords.


DUP

Specifies this command is to delete adjacent duplicate lines from the line range.  The keyword DUP is reserved, and may not be specified as DUPS, DUPLICATE or DUPLICATES.  When determining if two lines are duplicates of each other, SPFLite checks that they are of identical length and are byte-for-byte identical for the entire length of the lines, including any leading and trailing blanks that may exist.  


Note that the duplicate-removal processing of SORT UNIQ is not the same as DELETE DUP.  Refer to the SORT command for more information.


NOTE

xNOTE

ZNOTE


NOTE specifies this command is to delete all =NOTE>  lines from the line range.

xNOTE specifies this command is to delete all extended xNOTE>  lines from the line range, where 'x' is any letter from A to Y.  To delete all extended notes of type A, issue DELETE ANOTE.


ZNOTE specifies this command is to delete all extended xNOTE>  lines of all types from the line range, where 'x' is any letter from A to Y.  DELETE ZNOTE will not delete "plain" =NOTE> lines.  As a reminder, you cannot create extended xNOTE lines of type Z; that is, ZNOTE is not allowed as a line command.


The keyword NOTE and the forms ANOTE through ZNOTE are reserved. NOTE may not be specified as NOTES.


string

If string is present, a string-based delete is requested; only lines containing string are eligible for deletion within the selected line range.  If neither ALL, FIRST, LAST, PREV or NEXT is specified on a string-based DELETE, NEXT is assumed.  Note that a “string-based delete” means the entire line having the string is deleted; it does not mean to delete the string alone from the line.  The string may be unquoted, or simply quoted, or may be any of the standard string types C, T, X, P or R.


If string is omitted, a line-based delete is requested; lines within the selected line range are deleted.  If neither ALL, FIRST, LAST, PREV or NEXT is specified on a non-string-based DELETE, ALL is assumed.


CHARS |

WORD |

PREFIX |

SUFFIX

These options are allowed only for string-based deletes; they describe the “string context” in the same way that a FIND or CHANGE command does.  


If omitted for a string-based delete, the string will be searched for in WORD mode if C W or T W appears in the middle of the status line, and in CHARS mode if C or W appears in the middle of the status line.  WORD mode or CHARS mode can be set by FIND WORD or FIND CHARS, respectively.


ALL

For line-based deletes, ALL is allowed mainly for compatibility with prior releases. ALL is assumed if not specified, except for string-based deletes which assume NEXT. Note that to delete the entire file, DELETE ALL is permitted.  When deleting the entire file, the command DELETE must be fully spelled out and cannot be abbreviated as DEL, and the ALL keyword is not assumed but must be explicitly specified.  These rules help prevent accidental deletion of the file.  A lone DELETE with no other options is illegal.


line-control-range

The range of lines which are to be processed by the command.  Line control ranges provide a powerful tool to customize the range of lines to be processed.   The full syntax and allowable operands which make up a line control range are discussed in "Line Control Range Specification".  Refer to that section of the documentation for details.


start-column


Left column of a range (with end-column) within which the search-string value must be found. If no end-column operand, then the search-string operand must be found starting in start-col.

end-column

Right column of a range (with start-column) within which the search-string value must be found.


color-selection-criteria

A request for selection based on the highlight color of the search-string. Color requests provide another powerful tool to control search selection.   The full syntax and allowable operands which make up a color-selection-criteria  are discussed in "Color Selection Criteria Specification".   Refer to that section of the documentation for details.


X | NX

Specifies a subset of the line range to be processed.   X requests only excluded lines are to be deleted, NX requests only non-excluded lines are to be deleted.   If neither X or NX are specified, all lines in the range will be eligible to be deleted.


U | NU

Specifies a subset of the line range to be processed.   U requests only User lines are to be processed, NU requests only non-User lines are to be processed.   If neither U or NU are specified, all lines in the range will be processed.


FIRST or NEXT

Starts at the top of the specified range and searches ahead to find the first occurrence in the specified line-control-range and delete that line.  NEXT is assumed for string based deletes.


LAST or PREV

Starts at the bottom of the specified range and searches backward to find the last occurrence in the specified line-control-range and delete that line.

TOP

Normally, at the completion of the command, the first, or only, line processed is highlighted (if it is on the current screen) or the screen is scrolled to the 2nd screen line (as ISPF does) if the line is not on the current screen.  If TOP is coded, then the line is always positioned as the top line of the screen, regardless of its current location.


Abbreviations and Aliases


DELETE can also be spelled as DEL

PREFIX can also be spelled as PRE or PFX

SUFFIX can also be spelled as SUF or SFX

WORDS can also be spelled as WORD

CHARS can also be spelled as CHAR

Description


DELETE removes lines from an edit session.


Specifying the Data to Delete


Two methods of specifying the data are possible.




Note carefully:




Depending on whether the X or NX operands are specified, the data deleted will be the entire contents of the specified line range if these operands are omitted, or the specified subset (X or NX) if the operands are specified.  


When performing a string-based delete, the options ALL, FIRST, LAST, PREV and NEXT are all available.


When performing a line-based delete, the ALL option is assumed if none of ALL, FIRST, LAST, PREV or NEXT are specified.  However, to perform a list-based delete using FIRST, LAST, PREV or NEXT, some type of ‘line qualification' must also be used.  For example, you cannot just say DELETE FIRST, otherwise you will get the message, “No search string, but no ALL specified”.  What you need for a valid line qualification to do a line-based delete using FIRST, LAST, PREV or NEXT is one of the following:



Repeatable DELETE


Just as FIND and CHANGE can be selectively repeated using RFIND (or RLOCFIND) and RCHANGE, so can the string-based version of DELETE.   You can issue a command like DELETE 'ABC'  and use RFIND/RCHANGE to selectively find and delete lines.


RFIND, RLOCFIND and RCHANGE now have support to allow this action to be performed following an initial DELETE command, when the DELETE has a find-string operand.  As a reminder, RFIND (or RLOCFIND) is typically mapped to the F5 key, and RCHANGE to the F6 key.


For example, if you place  DELETE 'ABC' on the command line, then press F5 instead of Enter, DELETE will locate the next line containing ABC, but will not delete it.  To actually "follow through" and delete that line, press F6.  If you don't want to delete that line, you can press F5 to find the next line with ABC, or simply do something else.



Other examples of the DELETE command


To delete all excluded lines:


DELETE X

or

DELETE ALL X


To delete all non-excluded lines:


DELETE NX

or

DELETE ALL NX


To delete a range of lines using line numbers:


DELETE 20 30

or

DELETE ALL 20 30


To delete a range of lines using line labels:


DELETE .HERE .THERE

or

DELETE ALL .HERE .THERE


To delete only excluded lines within a range of lines using line numbers:


DELETE X 25 35

or

DELETE ALL X 25 35


To delete lines tagged with an :AB line tag:


DELETE :AB

or

DELETE ALL :AB


To delete all lines containing the “ABC”:


DELETE ALL ABC


To delete all lines containing the “DEF” highlighted in RED:


DELETE ALL "DEF" RED


To delete all unexcluded lines containing the text “abc” as a prefix:


DELETE ALL T'abc' PREFIX NX



Note:  DELETE cannot be used to delete zero-length blank lines based on a string.  See  NDELETE  for an example of how to do this.


Created with the Personal Edition of HelpNDoc: Easily create Help documents