Now, consider a situation where I have many such consecutive blank records in my dataset intersperse with data records.
So my requirement is wherever there are more than one consecutive blank records I have to keep just one of it and delete other blank (all spaces) records.
So which means in-between data records there can never be more than one blank record.
Infact, this was my orginal question, apologies if I was unclear the first time.
if this is a process you need to run frequently, the easiest way is a small rexx program that simply reads in records and rewrites them without writing duplicate blanks (compare current record to blanks and to last record and write accordingly).
Or if the data is small enough to fit in the editor, you can write an edit macro. see the ISPF edit and edit macros book or search for examples of programs containing ISREDIT.
Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne
here is a clist edit macro which I have used to drop duplicate rows in an
if two or more successive rows are equal, the second (and subsequent will be excluded) - thus leaving only one row from the original group.
this was written to find 'duplicates within column range' regardless of value.
you will have to add an edit macro command at the end to 'show' all lines that have any characters before deleting all excluded lines.
CONTROL NOLIST NOCONLIST NOSYMLIST NOPROMPT NOMSG NOFLUSH ASIS END(ENDO)
ISREDIT (NUMLNS) = LINENUM .ZL
ISREDIT (CURLN) = LINENUM .ZF
SET LASTLN = &STR()
SET THISLN = &STR()
SET &STCOL = 1
SET &ENDCOL = 140
DO WHILE &CURLN < &NUMLNS + 1
ISREDIT (THISLN) = LINE &CURLN
SET THISLN = &SUBSTR(&STCOL:&ENDCOL,&THISLN)
IF &STR(&THISLN) = &STR(&LASTLN) THEN +
ISREDIT CURSOR = &CURLN
ISREDIT EXCLUDE ALL .ZCSR .ZCSR
SET LASTLN = &STR(&THISLN)
SET LSTLN = &CURLN
SET CURLN = &CURLN + 1
add a line here to find all char <> spaces which will 'show' excluded
lines that are not all spaces
ISREDIT DELETE ALL X
this can be written in rexx, easily.
you can also modify it to ARG(starting_column, ending_column)
so that you can look for duplicates within a column range. it is hard coded to search 1 thru 140 in this example.