View previous topic :: View next topic
|
Author |
Message |
sangeetha_vama
New User
Joined: 13 Dec 2006 Posts: 3 Location: Chennai
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Why can't you use the CHANGE command?
O. |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
sangeetha_vama
New User
Joined: 13 Dec 2006 Posts: 3 Location: Chennai
|
|
|
|
i want the changed one to a new file |
|
Back to top |
|
|
sangeetha_vama
New User
Joined: 13 Dec 2006 Posts: 3 Location: Chennai
|
|
|
|
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 |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
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 |
|
|
|