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

Moving values from Stem Variable to Clip Board thru REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Mon Jul 08, 2013 8:07 pm
Reply with quote

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

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Jul 08, 2013 9:17 pm
Reply with quote

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

Global Moderator


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

PostPosted: Mon Jul 08, 2013 10:45 pm
Reply with quote

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

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Tue Jul 09, 2013 12:32 pm
Reply with quote

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

Global Moderator


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

PostPosted: Tue Jul 09, 2013 1:04 pm
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jul 09, 2013 4:58 pm
Reply with quote

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

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Tue Jul 09, 2013 5:11 pm
Reply with quote

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

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Tue Jul 09, 2013 5:15 pm
Reply with quote

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

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Jul 09, 2013 5:31 pm
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jul 09, 2013 7:03 pm
Reply with quote

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

Global Moderator


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

PostPosted: Wed Jul 10, 2013 2:47 am
Reply with quote

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
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top