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

How to remove consecutive blank lines in a PS Dataset


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

New User


Joined: 27 Nov 2010
Posts: 7
Location: Chennai

PostPosted: Sat Nov 27, 2010 5:48 pm
Reply with quote

I'm completely new to CLIST and REXX.

My requirement is to remove the consecutive blank lines in a PS dataset.

I tried using the above logic with little modification.

the code is as follows..

ISREDIT MACRO
CONTROL NOLIST NOCONLIST NOSYMLIST NOPROMPT NOMSG NOFLUSH ASIS END(ENDO)
ISREDIT RESET
ISREDIT (TOTLIN) = LINENUM .ZL
ISREDIT (CURLIN) = LINENUM .ZF
WRITE &DATASET.
SET LASTLINE = &STR()
SET THISLINE = &STR()
SET &STCOL = 1
SET &ENDCOL = 80
SET &TOTLINE = &TOTLIN + 1
DO WHILE &CURLIN < &TOTLINE
ISREDIT (THISLINE) = LINE &CURLIN
WRITE &THISLINE.
SET THISLINE = &SUBSTR(&STCOL:&ENDCOL,&STR(&THISLINE))
IF &STR(&THISLINE) = &STR( ) AND -
&STR(&THISLINE) = &STR(&LASTLINE) THEN +
DO
ISREDIT CURSOR = &CURLIN
ISREDIT EXCLUDE ALL .ZCSR .ZCSR
END
SET LASTLINE = &STR(&THISLINE)
SET &LSTLIN = &CURLIN
SET &CURLIN = &CURLIN + 1
END
ISREDIT DELETE ALL X
EXIT


When i debug this Clist with CONLIST and SYMLIST, the result look same for both CONLIST and SYMLIST. No symbolic conversion took place.


Below are the statements i got while debuging.
-----------------------------------------------------------------------------------
ISREDIT (DATASET) = DATASET
ISREDIT (DATASET) = DATASET
ISREDIT (TOTLIN) = LINENUM .ZL
ISREDIT (TOTLIN) = LINENUM .ZL
ISREDIT (CURLIN) = LINENUM .ZF
ISREDIT (CURLIN) = LINENUM .ZF
SET LASTLINE = &STR()
SET LASTLINE =
SET THISLINE = &STR()
SET THISLINE =
SET &STCOL = 1
SET &STCOL = 1
SET &ENDCOL = 80
SET &ENDCOL = 80
SET &TOTLINE = &TOTLIN + 1
SET &TOTLINE = + 1
DO WHILE &CURLIN < &TOTLINE
DO WHILE < 1
ISREDIT (THISLINE) = LINE &CURLIN
ISREDIT (THISLINE) = LINE
SET THISLINE = &SUBSTR(&STCOL:&ENDCOL,&STR(&THISLINE))
SET THISLINE = &SUBSTR(1:80,)
THIS STATEMENT HAS AN INVALID &SUBSTR RANGE OR EXIT CODE EXPRESSION
----------------------------------------------------------------------------------

Could someone please help me out to get rid of these errors?

Also please tell me where should i execute this macro from.(i.e How does this Clist know on which dataset the duplicate removal is performed?, We haven't provided the dataset name anywhere in the clist?).

Sorry for the big one.. please help me out...

Thanks..
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sat Nov 27, 2010 6:38 pm
Reply with quote

depending on the dataset size(number of records) a REXX script or and edit macro might not be the best choice!

anyway for Your doubt it would help to review the manuals for the ISPF MACROs concepts

depending on the version/release/level of Your system You might look at

zOS 1.10
ISPF
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/ISPZPM70
TSO ( rexx/clist)
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BK90

zOZ 1.11
ISPF
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/ISPZPM80
TSO ( rexx/clist)
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BKA1

or for any other level of zOS software You might start from
www-03.ibm.com/systems/z/os/zos/bkserv/index.html
and search yourself
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sun Nov 28, 2010 3:54 am
Reply with quote

Ramesh_165 wrote:
I'm completely new to CLIST and REXX.


Then please do not use CLIST, it works, has been working for the past umpteen years and will continue to work for centuries hence, but you really should not touch it.

Use REXX and REXX alone!
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Sun Nov 28, 2010 10:58 am
Reply with quote

Here's my method of deleting blank lines using ISPF Edit Macro (written in REXX):
Code:
/*------------------------------- REXX ------------------------------- 
 * PROGRAM   : DELBLANK                                                 
 * FUNCTION  : Delete blanks lines.                                     
 * AUTHOR    : OFER                                                     
 * DATE      : 13/03/03                                                 
 * HOW TO USE: From within editor, type DELBLANK.                       
 *------------------------------------------------------------------*/ 
                                                                       
ADDRESS ISREDIT "MACRO PROCESS"                                         
                                                                       
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"                                 
ADDRESS ISREDIT "(RECLEN) = LRECL"                                     
                                                                       
VAR = COPIES(' ',RECLEN)                                               
                                                                       
ADDRESS ISREDIT "EXCLUDE '"VAR"' 1 "RECLEN" ALL"                       
IF RC = 4 THEN DO                                                       
  ZEDLMSG = 'No blank lines in data.'                                   
  ADDRESS ISPEXEC "SETMSG MSG(ISRZ000)"                                 
  EXIT                                                                 
END                                                                     
                                                                       
ADDRESS ISREDIT "DEL X ALL"                                             
                                                                       
EXIT


O.
Back to top
View user's profile Send private message
Ramesh_165

New User


Joined: 27 Nov 2010
Posts: 7
Location: Chennai

PostPosted: Mon Dec 06, 2010 9:29 pm
Reply with quote

My main doubt is, where to run the tso command for the above mentioned CLIST by me.
Supposing I have a DS like this.

VIEW TEST.PROGRAM.COBOL(DUPLICAT) - 01.00 Columns 00007 00078
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
THIS CLIST TO REMOVE TWO OR MORE EMPTY CONSECUTIVE LINES.
THIS CLIST TO REMOVE TWO OR MORE EMPTY CONSECUTIVE LINES.
THIS CLIST TO REMOVE TWO OR MORE EMPTY CONSECUTIVE LINES.




THIS CLIST TO REMOVE TWO OR MORE EMPTY CONSECUTIVE LINES.
THIS CLIST TO REMOVE TWO OR MORE EMPTY CONSECUTIVE LINES.


THIS CLIST TO REMOVE TWO OR MORE EMPTY CONSECUTIVE LINES.
THIS CLIST TO REMOVE TWO OR MORE EMPTY CONSECUTIVE LINES.
**************************** Bottom of Data ****************************

Can i just execute the CLIST from the above command line to remove the blank lines?

Please let me know.. Thanks for you help!!

Regards,
Ramesh
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Dec 06, 2010 11:24 pm
Reply with quote

From an edit (not view) panel command line you must execute an edit macro...like the one given to you by ofer71. As Mr. Prins says, don't go near CLIST; there is no reason to use it in preference to Rexx.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Dec 07, 2010 12:12 am
Reply with quote

Like everyone has said... Throw that clist away.

Learn REXX forget about clist.

Here is an edit macro (written with REXX) that will do what you ask for.

Never ask me or anyone else on this board about a clist.

Code:

/* REXX EXEC TO DELETE TWO OR MORE CONSECUTIVE BLANK LINES */

"ISREDIT MACRO"
"ISREDIT RESET"

"ISREDIT (LASTLINE) = LINENUM .ZLAST"
BLANK_CTR = 0
DO I = 1 TO LASTLINE

  "ISREDIT (HOLD1) = LINE "I
  HOLD1 = STRIP(HOLD1)
  IF HOLD1 = '' THEN DO
    BLANK_CTR = BLANK_CTR + 1
    IF BLANK_CTR = 1 THEN "ISREDIT LABEL " I " = .AA 0"
    IF BLANK_CTR > 1 THEN "ISREDIT LABEL " I " = .BB 0"
  END
  ELSE DO
    IF BLANK_CTR > 1 THEN "ISREDIT X .AA .BB ALL"
    BLANK_CTR = 0
  END

END

"ISREDIT DELETE ALL X"
"ISREDIT RESET"

EXIT


See how much easier to code and to read it is?

To invoke, just type the name of the edit macro on the command line while in edit (if you want to save the data), view will work as well.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Dec 07, 2010 4:33 pm
Reply with quote

Akatsukami,
I know that you are not a dummy,
so I will just ask,
why did you make the following comment
when you know that EDIT macros will execute in VIEW mode?

Akatsukami wrote:
From an edit (not view) panel command line you must execute an edit macro
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Dec 07, 2010 4:57 pm
Reply with quote

dbzTHEdinosauer wrote:
Akatsukami,
I know that you are not a dummy,
so I will just ask,
why did you make the following comment
when you know that EDIT macros will execute in VIEW mode?

Akatsukami wrote:
From an edit (not view) panel command line you must execute an edit macro

Well, I'm going through a bad time right now. You are correct, though, in that I ought not to make comments or offer suggestions when the judgment may be clouded by other issues.
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
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
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top