View previous topic :: View next topic
|
Author |
Message |
rakesh pattanayak
New User
Joined: 29 May 2007 Posts: 16 Location: bangalore
|
|
|
|
Hi All,
i have written the following code to obtain the Line no. where the Cursor is at.
Code: |
/*+--------------------------REXX------------------------------------+*/
/*| This EDIT macro will find at which line the cursor is |*/
/*+------------------------------------------------------------------+*/
ADDRESS ISREDIT
"MACRO PROCESS"
/* TRACE R */
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ISREDIT (WHERE) = CURSOR
SAY 'CUSRSOR IS AT' &WHERE
|
but i am geting following error
Code: |
12 +++ SAY 'CUSRSOR IS AT' &WHERE
IRX0034I Error running BEGIN, line 12: Logical value not 0 or 1
***
|
Begin is the Command I am giving. Its a Memebr of a PDS that PDS i have concatenated with the SYSPROC library.
Please help me |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Remove the '&' from the SAY. REXX considers '&' as a logical "and", and therefor it looks for a logical value.
O. |
|
Back to top |
|
|
ironmike
New User
Joined: 07 Aug 2005 Posts: 33
|
|
|
|
I changed yours a little; you are using 'SAY' to write the output, which switches from TSO fullscreen mode to line mode, then you have to hit ENTER to remove the '***' that is displayed and get back to the ISPF EDIT screen. The version below uses an ISPF SETMSG service call instead of a REXX SAY to display the line number on the ISPF message line, and eliminates leading zeros from the line number also.
Code: |
/*REXX*/
Address ISREDIT
"MACRO PROCESS"
Address ISPEXEC "CONTROL ERRORS RETURN"
"ISREDIT (WHERE) = CURSOR"
zedsmsg = ''
zedlmsg = 'Cursor is on line 'Strip(where,'L',0)
Address ISPEXEC "SETMSG MSG(ISRZ000)"
Exit 0
|
|
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
You can change
Code: |
zedlmsg = 'Cursor is on line 'Strip(where,'L',0) |
to
Code: |
zedlmsg = 'Cursor is on line 'where+0 |
O. |
|
Back to top |
|
|
rakesh pattanayak
New User
Joined: 29 May 2007 Posts: 16 Location: bangalore
|
|
|
|
In Connection to this i have one requirement .
it is like when i will give a command in command line and i will put my cursor
in a line.then following line should be added after that line where the cursor was
****<today's date(MM/DD/YY) > <My Name> Begin****
. for that i wrote this but its not workING
Code: |
/*REXX*/
Address ISREDIT
"MACRO PROCESS"
Address ISPEXEC "CONTROL ERRORS RETURN"
"ISREDIT (WHERE) = CURSOR"
SET LINE = (WHERE)
ISREDIT (SRCLIB) = DATASET
SET SRC = &STR(')&SRCLIB&STR(')
SET OUTSTR = &STR(+
****DATE('U') RAKESH BEGIN****)
ISREDIT LINE_AFTER &LINE = (OUTSTR)
SET LINE = &LINE + 1
|
please help me. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Why are you using CLIST language in a REXX |
|
Back to top |
|
|
ironmike
New User
Joined: 07 Aug 2005 Posts: 33
|
|
|
|
OK, several things:
You are using & as a prefix on your REXX variables. CLIST language variables use & as a prefix, REXX variables DON'T. Get rid of the '&' prefix on your REXX variable names
You don't need ISPEXEC CONTROL ERRORS RETURN on an edit macro, unless you are doing something critical, which you are not.
I redid the macro, it now does what you asked for above.
Code: |
/*REXX*/
Address ISREDIT
"MACRO PROCESS"
"ISREDIT (WHERE) = CURSOR"
LINEDATA = '**** '||Date('U')||' Rakesh '
"LINE_AFTER "WHERE" = DATALINE (LINEDATA)" |
|
|
Back to top |
|
|
|