View previous topic :: View next topic
|
Author |
Message |
Ramesh_165
New User
Joined: 27 Nov 2010 Posts: 7 Location: Chennai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
Ramesh_165
New User
Joined: 27 Nov 2010 Posts: 7 Location: Chennai
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
|