View previous topic :: View next topic
|
Author |
Message |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
Hi,
I am new to clist. Tried to execute the below code it gives the error shown .
Code: |
ISREDIT MACRO (DEBUG)
IF &DEBUG = &STR() +
THEN CONTROL MSG NOLIST NOCONLIST NOSYMLIST
ELSE CONTROL MSG LIST CONLIST SYMLIST
ISPEXEC CONTROL ERRORS RETURN |
Code: |
ISPF Edit Macro Error
Command ===>
******************************************************************************
* *
* Command in error . : MACRO DEBUG *
* *
* Invalid macro command *
* Parameter found outside parentheses and is not PROCESS/NOPROCESS. *
* *
* Error message ID . : ISRE747 *
* *
* Last return code . : 12 *
* *
* Macro executing . : SELECT *
* *
* Press ENTER key to terminate the macro. *
* *
* *
* *
******************************************************************************
|
Can someone please help me resolving this
Regards
Amar |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
Can someone please help me resolving this
|
Throw the code in the trash bin.
Do not waste another minute of your time learning clist.
Learn REXX instead
I have written nothing but Rexx for twenty years.
There is no reason for you to learn clist.
That is the best help you will receive. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
Agree that Rexx is a far better way to go.
And this is coming from a former CLIST bigot. |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
OK can you please help me in designing the REXX for the below requirement. I am new to REXX also
Need to write a CLIST/REXX to go to a paragraph or a variable in working storage section if my cursor is placed at a PERFORM or the variable name in the procedure division and return to the position where it is started.
I talked about COBOL program.
Regards
Amar |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1316 Location: Vilnius, Lithuania
|
|
|
|
V S Amarendra Reddy wrote: |
Need to write a CLIST/REXX to go to a paragraph or a variable in working storage section if my cursor is placed at a PERFORM or the variable name in the procedure division and return to the position where it is started. |
Why do you need to write this? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Amar,
While this is a 'help' forum not a 'do it for me' forum, below are two Edit Macros (Rexx based). One is for GO and one is for Back.
Do not mention the word clist ever again. Nobody here cares about it.
It is very old technology (I haven't used it in twenty years).
The term 'clist/rexx' is not a valid one. It tells people you do not know what you are talking about. Get my point?
Use this code to help you learn and help yourself. Use the manuals and search function on this forum. Get my point?
Code: |
/* REXX EXEC TO FIND A PARAGRAPH FROM A PERFORM STATEMENT */
"ISREDIT MACRO NOPROCESS"
/*--------------------------------------------------------*/
/* THIS EXEC ALLOWS YOU TO GO TO A PARAGRAPH NAME IN A */
/* PROGRAM FROM THE PERFORM STATEMENT. TO USE, TYPE GO */
/* ON THE COMMAND LINE, PUT THE CURSOR ON THE LINE THAT */
/* HAS THE PARAGRAPH NAME WHERE YOU WANT TO GO TO. */
/*--------------------------------------------------------*/
/*-----------------------------------------------------*/
/* FIND THE LINE NUMBER WHERE THE CURSOR IS LOCATED. */
/* THEN PUT THE INFORMATION ON THAT LINE INTO */
/* VARIABLE HOLD1. ALSO PUT A LABEL ON THAT LINE SO */
/* THAT YOU CAN FIND YOUR WAY BACK. */
/*-----------------------------------------------------*/
"ISREDIT (LINE1,COL1) = CURSOR"
"ISREDIT (HOLD1) = LINE "LINE1
FROM1 = '.BACK'
"ISREDIT LABEL " LINE1 " = "FROM1 " 0"
/*-----------------------------------------------------*/
/* PARSE HOLD1 TO FIND THE PARAGRAPH NAME */
/*-----------------------------------------------------*/
PARSE VAR HOLD1 WITH PART1 'PERFORM' PAR1 ' ' REST1
PAR1 = WORD(REST1,1)
PAR1 = TRANSLATE(PAR1,' ','.')
PAR1 = STRIP(PAR1)
/*--------------------------------*/
/* MAKE SURE SOMETHING WAS FOUND */
/*--------------------------------*/
IF PAR1 = '' THEN DO
ZEDSMSG = 'PARAGRAPH NAME NOT FOUND'
ZEDLMSG = 'MAKE SURE PERFORM STATEMENT IS CORRECT'
"ISPEXEC SETMSG MSG(ISRZ001)"
SIGNAL EXIT99
END
/*--------------------------------*/
/* FIND THE PARAGRAPH NAME NOW */
/*--------------------------------*/
"ISREDIT FIND " PAR1 " 8 FIRST WORD"
RCODE = RC
IF RCODE ¬= 0 THEN DO
ZEDSMSG = 'PARAGRAPH NOT FOUND'
ZEDLMSG = 'PARAGRAPH 'PAR1' WAS NOT FOUND'
"ISPEXEC SETMSG MSG(ISRZ001)"
END
EXIT99: EXIT |
Code: |
/* REXX EXEC TO GO BACK FROM THE GO COMMAND */
/* TYPE BACK ON THE COMMAND TO USE THIS */
"ISREDIT MACRO NOPROCESS"
WHERE1 = '.BACK'
"ISREDIT (LINE1) = LINENUM "WHERE1
IF LINE1 > 0 THEN DO
"ISREDIT CURSOR = "LINE1",1"
END
ELSE DO
ZEDSMSG = "CAN NOT GO BACK"
ZEDLMSG = "THERE IS NOWHERE TO GO BACK TO"
"ISPEXEC SETMSG MSG(ISRZ001)"
END
EXIT99: EXIT |
|
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
Hi daveporcelan,
I will never use the word CLIST again. Thanks a lot for the help. I will learn and understand the whole code by myself by rading manuals.
As suggested by you, I will use the search function and manulas of this forum. Actually the forum is named as CLIST & REXX. So I have posted it like that.
From now my path is thru Rexx. I do not know CLIST.
Thanks a lot for myour quick response.
Regards
Amar |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
Actually the forum is named as CLIST & REXX. |
I never noticed that as the name.
My mind must block out the first word.
Have fun working on this. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1316 Location: Vilnius, Lithuania
|
|
|
|
@Dave
Two macros?
Why not add a parameter to GO (like
Code: |
"ISREDIT MACRO (BACK) NOPROCESS" |
and put everything in one? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Two macros means less typing.
Less typing means easier to use.
Type GO
Type BACK
or Type GO BACK
In my opinion two seperate macros is more user friendly.
My users have never complained, they must be happy. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
the following two REXX Macro do the same as Dave's GO and BACK accomplish,
but using the VARIABLE POOL provides additional functionality:- being able to deal with more than one program
- able to 'link' thru multiple performs, instead of just one
it does require NUM STD COBOL
and paragraph/section names in column 8.
LINK in command line,
cursor on line containing PERFORM
Code: |
/* REXX */
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISREDIT
"MACRO"
/* */
/* "(VAR1, VAR2) = NUMBER" */
/* "NUMBER = ON STD COBOL" */
/* */
ADDRESS ISPEXEC "VGET (LINKLIST) SHARED"
IF RC > 0 THEN
DO
LINKLIST = ''
END
RETURN = 0
"(MEMNAME) = MEMBER"
IF LENGTH(MEMNAME) < 8 THEN
DO
MEMFILL = '@@@@@@@@'
MEMNAME = MEMNAME!!SUBSTR(MEMFILL,1,8 -(LENGTH(MEMNAME)))
END
"(WRKDATA) = LINE .ZCSR"
"(RETURN) = LINENUM .ZCSR"
"(TOP,BOT) = DISPLAY_LINES"
"(CRSRLINE,CRSRCOL) = CURSOR"
IF LENGTH(TOP) > 6 THEN
DO
TOP = SUBSTR(TOP,-1 * (5 -(LENGTH(TOP))))
END
IF LENGTH(RETURN) > 6 THEN
DO
RETURN = SUBSTR(RETURN,-1 * (5 -(LENGTH(RETURN))))
END
LINKLIST = MEMNAME!!TOP!!RETURN!!LINKLIST
ADDRESS ISPEXEC "VPUT (LINKLIST) SHARED"
ADDRESS ISREDIT
/* TRACE ?R */
WRKDATA_LEN = LENGTH(WRKDATA)
PERFORM_POS = INDEX(WRKDATA,'PERFORM')
RIGHT_LEN = WRKDATA_LEN - (PERFORM_POS + 7)
WRKDATA = RIGHT(WRKDATA,RIGHT_LEN)
RIGHT_LEN = INDEX(WRKDATA, '.')
IF RIGHT_LEN > 1 THEN
TARGET = LEFT(WRKDATA,RIGHT_LEN - 1)
ELSE
PARSE VAR WRKDATA TARGET MULL
"FIND "TARGET" 8 FIRST"
"DOWN CURSOR"
/* */
/* "NUMBER = (VAR1,VAR2)" */
/* */
EXIT
|
RELINK in command line
Code: |
/* REXX */
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISREDIT
"MACRO"
ADDRESS ISPEXEC "VGET (LINKLIST) SHARED"
IF RC > 0 THEN
DO
SAY KEINE LINKS ZU RELINK IN TABLE
EXIT
END
ADDRESS ISREDIT
"(MEMNAME) = MEMBER"
IF LENGTH(MEMNAME) < 8 THEN
DO
MEMFILL = '@@@@@@@@'
MEMNAME = MEMNAME!!SUBSTR(MEMFILL,1,8 -(LENGTH(MEMNAME)))
END
IF MEMNAME <> LEFT(LINKLIST,8) THEN
DO
"CLRLINK"
SAY KEINE LINKS ZU RELINK FUER MODUL MEMNAME
EXIT
END
TOP = SUBSTR(LINKLIST,9,6)
RETURN = SUBSTR(LINKLIST,15,6)
IF LENGTH(LINKLIST) = 20 THEN
DO
"CLRLINK"
LINKLIST = ''
END
ELSE
DO
LINKLIST = RIGHT(LINKLIST,LENGTH(LINKLIST)-20)
ADDRESS ISPEXEC "VPUT (LINKLIST) SHARED"
END
"LOCATE "TOP
"CURSOR = "RETURN 10
EXIT
|
and here is CLRLINK,
which is called in the LINK.
This could be incorporated in the above macros, but I have it separate,
because other macros use it.
Code: |
/* REXX */
ISREDIT MACRO
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISPEXEC "VERASE (LINKLIST) SHARED"
ADDRESS ISREDIT
EXIT
|
|
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
Hi Dick,
The CLRLINK is not allowing to go back to the PERFORM. Do I have to do some specific setting for this? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why are you executing CLRLINK?
explain exactly what you did.
the variable pool is different for each session that you have.
in one session I can link to a paragraph,
view/edit another module, link and relink in the second.
then end the view/edit session in the second module
and then relink in the original of the first.
so, tell me what you have done, and I will beable to explain it to you.
by the way, here is a macro to display the linklist, incase you are having questions.
(and no, there is no real need to save the bottom line number of the return display for link/relink,
but I use it in other macros.
shwlink
Code: |
/* REXX */
ISREDIT MACRO
ADDRESS ISPEXEC "VGET (LINKLIST) SHARED"
IF RC > 0 THEN
DO
SAY KEINE LINKS IN RELINK TABLE
EXIT
END
ADDRESS ISREDIT
SAY 'LENGTH OF LINKLIST: ' LENGTH(LINKLIST)
SAY 'NUMBER OF ITEMS: ' LENGTH(LINKLIST)/20
DO I=1 TO LENGTH(LINKLIST) BY 20
SAY SUBSTR(LINKLIST,I,20)
END
EXIT
|
|
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
Hi Dick,
I have put my cursor on a PERFORM statement and executed LINK, it has successfully gone to the paragraph. Now to go back to original position what should I do? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
RELINK |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
I am getting the below message when I execute the RELINK.
KEINE LINKS ZU RELINK IN TABLE |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
this is a help forum, nota provide me some tool and the relative guidance!
the samples posted are just snippets that have proved to be useful in some environment for specific tasks
it' s up to You to verify their applicability to Your environment,
understand the coding and modify it according to Your needs
the rexx script posted are not that long to prevent You from reading and understanding them
and translate the messages to any other language of Your choice!
the people who provided the snippet have no further obligations ! |
|
Back to top |
|
|
|