Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Help for writing MACRO

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
nehrujee

New User


Joined: 25 Oct 2007
Posts: 8
Location: Kolkata

PostPosted: Fri Oct 31, 2008 8:30 pm    Post subject: Help for writing MACRO
Reply with quote

Hi all,

I need a small favour for writing 1 macro

MY requirement:

Code:
EDIT       XXXXXX.PL1.CODE(PGM1 ) - 01.04               Columns 00001 00072
Command ===>                                                  Scroll ===> CSR
****** ***************************** Top of Data *****************************
000001 AAAAAA                                                               
000002 BBBBBBBB                                                       
000003 CCCCCCCCc
000004    DB2_SQL

If I keep cursor on DB2_SQL and write macro name on command line
the DB2_SQL has to replaced by
something like
DB2_SQL proc:
Select * from emp
END
how can i do this by rexx.

regards
N.Dewangan


Edited: Please use BBcode when You post some code, that's rather readable...Anuj
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Fri Oct 31, 2008 9:11 pm    Post subject: Reply to: Help for writing MACRO
Reply with quote

You can query which line the cursor is on with the CURSOR command:

"ISREDIT (lin,col) = CURSOR"

Then you can retrieve the contents of the line with the LINE command:

"ISREDIT (data) = LINE "lin

Check to make sure that it's the right line:

If Strip(data) = 'DB2_SQL' Then
Do
...
<insert the changes using the LINE and LINE_AFTER commands>
End
Back to top
View user's profile Send private message
nehrujee

New User


Joined: 25 Oct 2007
Posts: 8
Location: Kolkata

PostPosted: Tue Nov 04, 2008 2:44 pm    Post subject: Reply to: Help for writing MACRO
Reply with quote

Thanks for your help. I am trying your solution now.

N. Dewangan
Back to top
View user's profile Send private message
nehrujee

New User


Joined: 25 Oct 2007
Posts: 8
Location: Kolkata

PostPosted: Tue Nov 04, 2008 3:20 pm    Post subject: Reply to: Help for writing MACRO
Reply with quote

Hi Kevin,

I tried like

/*REXX*/
"ISREDIT MACRO"
"(LIN,COL) = CURSOR"
IF LIN = 0 ! COL = 0 THEN DO
ZEDSMSG = "CURSOR"
ZEDLMSG = "CURSOR HAS NOT BEEN POSITIONED ON A LINE"
ADDRESS "ISPEXEC" "SETMSG MSG(ISRZ001)"
RETURN 0
END
"(DATA) = LINE "LIN
IF STRIP(DATA) = 'DB2_SQL' THEN
DO
"LINE 0 = 'EXEC SQL'"
"LINE_AFTER .ZLAST = 'SELECT * FROM EMP'"

END

Its not working.. could you pls help me regards line commands, I am very new to REXX.
thanks
N,Dewangan
**************************** Bottom of Data ************
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2088
Location: Silicon Valley

PostPosted: Tue Nov 04, 2008 8:15 pm    Post subject: Reply to: Help for writing MACRO
Reply with quote

Quote:
Its not working..

We need more diagnostic information... messages, results??


You likely need a:
Code:
Address ISREDIT
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Tue Nov 04, 2008 8:37 pm    Post subject: Reply to: Help for writing MACRO
Reply with quote

Looks like you've changed what you want to insert slightly.

I had:

Code:

...
"ISREDIT (DATA) = LINE "LIN
IF STRIP(DATA) = 'DB2_SQL' THEN
  DO
    "ISREDIT LINE "LIN" = 'EXEC SQL'"
    "ISREDIT LINE_AFTER "LIN" = 'SELECT * FROM EMP'"
    LIN = LIN + 1
    "ISREDIT LINE_AFTER "LIN" = 'END'"
  END
...
Back to top
View user's profile Send private message
nehrujee

New User


Joined: 25 Oct 2007
Posts: 8
Location: Kolkata

PostPosted: Tue Nov 04, 2008 10:25 pm    Post subject: Reply to: Help for writing MACRO
Reply with quote

Many thanks.. its working.........
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 VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts exec macro in the end of edit anatol CLIST & REXX 8 Fri Sep 22, 2017 5:10 am
No new posts How to Run Rexx Macro? Kalaivignesh CLIST & REXX 5 Fri Sep 01, 2017 9:08 pm
No new posts ISREDIT MACRO NOT WORKING! :cry: kirank889 TSO/ISPF 3 Thu Aug 03, 2017 5:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us