IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to delete a blank line in Dataset


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rulerofera

New User


Joined: 03 Jun 2008
Posts: 30
Location: India

PostPosted: Tue Dec 22, 2009 8:36 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Dec 22, 2009 8:44 pm
Reply with quote

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
View user's profile Send private message
rulerofera

New User


Joined: 03 Jun 2008
Posts: 30
Location: India

PostPosted: Tue Dec 22, 2009 8:56 pm
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Tue Dec 22, 2009 11:05 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Dec 23, 2009 8:28 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Dec 23, 2009 10:14 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Dec 23, 2009 10:59 am
Reply with quote

Hi Dick,

you never cease to amaze me, you can still spell CLIST ho ho ho icon_lol.gif


Gerry
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top