Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to remove consecutive blank lines in a PS Dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Sat Nov 27, 2010 6:38 pm    Post subject: Reply to: How to remove consecutive blank lines in a PS Data
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
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/ISPZPM70
TSO ( rexx/clist)
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BK90

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

or for any other level of zOS software You might start from
http://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: 1018
Location: Oostende, Belgium

PostPosted: Sun Nov 28, 2010 3:54 am    Post subject:
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: 2360
Location: Israel

PostPosted: Sun Nov 28, 2010 10:58 am    Post subject:
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    Post subject:
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: 1755
Location: Bloomington, IL

PostPosted: Mon Dec 06, 2010 11:24 pm    Post subject:
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: 662
Location: Pennsylvania

PostPosted: Tue Dec 07, 2010 12:12 am    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Tue Dec 07, 2010 4:33 pm    Post subject:
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: 1755
Location: Bloomington, IL

PostPosted: Tue Dec 07, 2010 4:57 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts LISTCAT on a dataset with symbolic pa... shreya19 JCL & VSAM 5 Fri Apr 07, 2017 5:43 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us