View previous topic :: View next topic
|
Author |
Message |
Sikkandhar
New User
Joined: 03 Dec 2007 Posts: 61 Location: Bangalore
|
|
|
|
Hi,
I have a requirement to code a REXX tool to add/paste lines on the place where i have placed the cursor in the code
Assume the cursor is in line 390. I have to add few pre-defined lines (which i would be reading from a file and store it into a Stem Varaiable).
Code: |
000390 MOVE 'A' TO WS-VARA
000391 MOVE '2013-07-08' TO WS-DATE
000392 SET WS-FLAG1 TO TRUE |
Is it possible to move the values in Stem variables to Clip Board? If so can you please help me with the command to push it to Clip Board.
Is it possible to add the lines directly onto the code (the program could be either opened in View mode or Edit mode) where i have placed the cursor instead of writing into a separate file? If so, can you please help me with the commands to do so
Thanks
Sikkandhar |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
It is possible to edit the clipboard and our forum member Prino has provided a macro to do so. Search for it if you are interested. However, IMHO, copying stem variables to clipboard will be a convoluted way to achieve what you are trying to do.
I think ISREDIT LINE_BEFORE/AFTER will suit perfectly for your requirement.
Suppse VAR1 is your variable then-
"ISREDIT LINE_BEFORE .zcsr = (VAR1)" should do the trick. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
which i would be reading from a file and store it into a Stem Varaiable |
Assuming that you are not modifying the records from the file, you can skip the stem variable by using the COPY statement.
Quote: |
Is it possible to add the lines directly onto the code |
For example:
Code: |
Address ISREDIT
"COPY 'my.dsn' AFTER .zcsr"
|
|
|
Back to top |
|
|
Sikkandhar
New User
Joined: 03 Dec 2007 Posts: 61 Location: Bangalore
|
|
|
|
Thank agkshirsagar
Will the statement hold good for Stem Variable?
"ISREDIT LINE_BEFORE .zcsr = (VAR1)"
VAR1 is a Stem Variable
Pedro,
I need to do some modifications to the content i read. Hence i cannot directly copy to Clip Board. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Pedro wrote: |
Assuming that you are not modifying the records from the file, you can skip the stem variable by using the COPY statement. |
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Sikkandhar wrote: |
Thank agkshirsagar
Will the statement hold good for Stem Variable?
"ISREDIT LINE_BEFORE .zcsr = (VAR1)" |
You might be better off using LINE_AFTER in a loop with VAR1.i. |
|
Back to top |
|
|
Sikkandhar
New User
Joined: 03 Dec 2007 Posts: 61 Location: Bangalore
|
|
|
|
Quote: |
I need to do some modifications to the content i read. Hence i cannot directly copy to Clip Board. |
I Apologise, if i had offended anyone.
I have loaded the Stem Variable with the content. Assume that the stem variable is VAR1. Coded the below lines
Code: |
000150 "ISREDIT MACRO"
000151 "ISREDIT LINE_BEFORE .ZCSR = (VAR1.)"
000152 ADDRESS ISREDIT "END"
000153 EXIT |
When i execute the REXX from the program (opened in View Mode) where i intended to insert the lines, no insertions were done.
Could anyone please help me on the above?
The Stem variable is loaded with right content. Verified by displaying them.
Thanks
Sikkandhar |
|
Back to top |
|
|
Sikkandhar
New User
Joined: 03 Dec 2007 Posts: 61 Location: Bangalore
|
|
|
|
Just saw your post Akatsukami
Quote: |
You might be better off using LINE_AFTER in a loop with VAR1.i. |
Tried with VAR1.1 (just wanted to check whether atleast 1 line is getting inserted), but no insertion was done
Code: |
ADDRESS ISPEXEC
"ISREDIT MACRO"
"ISREDIT LINE_AFTER .ZCSR = (VAR1.1)"
ADDRESS ISREDIT "END"
EXIT |
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
I would check the edit macro manual and see what the syntax says - it probably does not allow a stem so you would have to do your insert inside a loop in which your stem variables would be assigned to a static name that ISREDIT can use. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Sikkandhar wrote: |
Just saw your post Akatsukami
Quote: |
You might be better off using LINE_AFTER in a loop with VAR1.i. |
Tried with VAR1.1 (just wanted to check whether atleast 1 line is getting inserted), but no insertion was done
Code: |
ADDRESS ISPEXEC
"ISREDIT MACRO"
"ISREDIT LINE_AFTER .ZCSR = (VAR1.1)"
ADDRESS ISREDIT "END"
EXIT |
|
Most peculiar. This code works for me; give it a try:
Code: |
/* Rexx */
/*********************************************************************/
/* */
/* Written Heisei 25.07.09 by Akatsukami-sama. */
/* */
/*********************************************************************/
ADDRESS ISREDIT "MACRO (DSN)"
trace o
sig = x2c("E69989A3A3859540C88589A2858940F2F54BF0F74BF0F940")
sig = sig || x2c("82A840C19281A3A2A49281948960A2819481")
"ALLOC FI(FO) DA('"dsn"') SHR"
"EXECIO * DISKR FO (STEM STEM. FINIS"
"FREE FI(FO)"
address isredit "(L1) = CURSOR"
do i = 1 to stem.0
address isredit "LINE_AFTER &L1 = '"stem.i"'"
l1 = l1 + 1
end
exit |
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Code: |
"ISREDIT LINE_AFTER .ZCSR = (VAR1.1)" |
Explanation: everything between the quotes is passed to the ISPF command processor, which does not know anything about stem variables.
Akatsukami-san's code works because the variable name is outside of the quotes. It is resolved by the rexx processor before sending it to the ISPF command processor. |
|
Back to top |
|
|
|