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

To Get The line Number where the Cursor is at


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

New User


Joined: 29 May 2007
Posts: 16
Location: bangalore

PostPosted: Wed Aug 08, 2007 5:27 pm
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Aug 08, 2007 5:49 pm
Reply with quote

Remove the '&' from the SAY. REXX considers '&' as a logical "and", and therefor it looks for a logical value.

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

New User


Joined: 07 Aug 2005
Posts: 33

PostPosted: Thu Aug 09, 2007 4:43 am
Reply with quote

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
Code:

Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Aug 09, 2007 12:18 pm
Reply with quote

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
View user's profile Send private message
rakesh pattanayak

New User


Joined: 29 May 2007
Posts: 16
Location: bangalore

PostPosted: Thu Aug 09, 2007 5:07 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Aug 09, 2007 7:54 pm
Reply with quote

Why are you using CLIST language in a REXX
Back to top
View user's profile Send private message
ironmike

New User


Joined: 07 Aug 2005
Posts: 33

PostPosted: Thu Aug 09, 2007 7:57 pm
Reply with quote

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
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top