View previous topic :: View next topic
|
Author |
Message |
rulerofera
New User
Joined: 03 Jun 2008 Posts: 30 Location: India
|
|
|
|
I have to delete one of two consecutive blank lines from dataset with record length 140, keeping everything else intact.
Can any of you help me with this, if not through ISPF can this be done through IEBGENER. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
OK, what are we not being told about here? Certainly you can easily edit the dataset and just use either a Delete or Exclude command for those two records? |
|
Back to top |
|
|
rulerofera
New User
Joined: 03 Jun 2008 Posts: 30 Location: India
|
|
|
|
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. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
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. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I cannot see how IEBGENER can achieve what you want, if DFSORT is an option, then you can try this
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input-dsn,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
OVERLAY=(141:SEQNUM,8,ZD,RESTART=(1,140)))
OUTFIL OMIT=(141,8,ZD,GT,+1,AND,
1,140,CH,EQ,C' '),
BUILD=(1,140)
/* |
Gerry |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
here is a clist edit macro which I have used to drop duplicate rows in an
editable ds/pds(mbr).
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.
Code: |
ISREDIT MACRO
CONTROL NOLIST NOCONLIST NOSYMLIST NOPROMPT NOMSG NOFLUSH ASIS END(ENDO)
ISREDIT RESET
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 +
DO
ISREDIT CURSOR = &CURLN
ISREDIT EXCLUDE ALL .ZCSR .ZCSR
ENDO
SET LASTLN = &STR(&THISLN)
SET LSTLN = &CURLN
SET CURLN = &CURLN + 1
ENDO
add a line here to find all char <> spaces which will 'show' excluded
lines that are not all spaces
then:
ISREDIT DELETE ALL X
EXIT
|
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. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Dick,
you never cease to amaze me, you can still spell CLIST ho ho ho
Gerry |
|
Back to top |
|
|
|