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

change of variable in Procedure division


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

New User


Joined: 13 Dec 2006
Posts: 3
Location: Chennai

PostPosted: Wed Aug 01, 2007 10:13 am
Reply with quote

Hi Friends, I am facing a problem in my REXX program.I have to change a variable name with a new variable name wherever it is found in my program.

FOR ex-my requirement is to change a variable:ws-emp-no(old variable) to ws-emp-number(new variable).It has to change in the working storage section,and as well as in procedure division also.i.e if a stmt like-
IF ws-emp-no is greater than 1000 ........ has to be changed to
IF ws-emp-number is greater than 1000 ..so on conditions where ever it is found
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Aug 01, 2007 11:49 am
Reply with quote

Why can't you use the CHANGE command?

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

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed Aug 01, 2007 11:57 am
Reply with quote

Hi Sangeetha,

Can you show the code in which your are getting error.Do you want to make the changes in the same file itself or do you want to write the changed one in the new file

Thanks
Sai
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Aug 01, 2007 2:23 pm
Reply with quote

If you are changing multiple members then you will need to get the member names of the PDS and then use an ISPF edit macro on each member.

These have been discussed before in the forums.
Back to top
View user's profile Send private message
sangeetha_vama

New User


Joined: 13 Dec 2006
Posts: 3
Location: Chennai

PostPosted: Wed Aug 01, 2007 3:03 pm
Reply with quote

i want the changed one to a new file
Back to top
View user's profile Send private message
sangeetha_vama

New User


Joined: 13 Dec 2006
Posts: 3
Location: Chennai

PostPosted: Wed Aug 01, 2007 3:17 pm
Reply with quote

here is my code

/*REXX*/
TRACE O
SAY 'ENTER THE VARIABLE TO BE CHANGED'
/* PARSE UPPER PULL VAR1 */
PULL VAR1
DSNIN = 'NBDT2GU.TEST.SCRLIB(TESTFPG)'
DSNOU = 'NBDT2GU.TEST.REXX(NEW1)'
INSER = ' WS-EMP-NO1'
'ALLOC FI($FIL1) DA('DSNIN') SHR REUSE'
ADDRESS MVS 'EXECIO * DISKR $FIL1 (STEM PRO. FINIS'
'FREE FI($FIL1)'
DO I = 1 TO PRO.0
SEARCH = FIND(PRO.I,VAR1)
IF SEARCH = 0
THEN
QUEUE PRO.I
ELSE
DO
QUEUE PRO.I
QUEUE INSER
END
END
'ALLOC FI($FIL2) DA('DSNOU') SHR REUSE'
ADDRESS MVS 'EXECIO * DISKW $FIL2 ( FINIS'
'FREE FI($FIL2)'
DELSTACK
EXIT
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed Aug 01, 2007 4:24 pm
Reply with quote

Hi Sangeetha,

Use the below code in your Do loop
Code:
DO I = 1 TO PRO.0
     IF INDEX(PRO.I,VAR1,1) > 0 THEN   
         DO                                         
            POSN = POS(VAR1,PRO.I)           
            POSN = POSN - 1                           
            TEST = INSERT(INSER,PRO.I,POSN)
            POS2 = POS(VAR1,TEST)                 
           OUT.I = DELSTR(TEST,POS2,8)           
         END                                         
   ELSE                                         
      OUT.I = PRO.I
END   
"EXECIO * DISKW $FIL2 (STEM OUT. FINIS"   


Thanks
Sai
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
No new posts SELECT from data change table DB2 5
No new posts Trying to change copybook in online c... CICS 4
Search our Forums:

Back to Top