View previous topic :: View next topic
|
Author |
Message |
Pollyannaish
New User
Joined: 09 Jul 2005 Posts: 31 Location: Pune, India
|
|
|
|
Hi guys
I am trying to copy a PDS member to another member using rexx..( Very poor in rexx)
what i need to do is to chnage a specific word into another like "new" to "OLD"
I tried writting this rexx but it does not work..
Please help me..
Code: |
"ALLOC DA('XX.XX.REXX(TESTEXP)') F(DATAIN) SHR REUSE"
"ALLOC DA('XX.XX.REXX(W1GCS7EF)') F(DATAOUT) MOD"
"EXECIO * DISKR DATAIN (STEM LINE. FINIS"
DO I = 1 TO LINE.0
SAY LINE.1
TRANSLATE(LINE.I,'NEW','OLD')
"EXECIO 1 DISKW DATAOUT"
SAY 'LINE.I'
END
"EXECIO 0 DISKW DATAOUT (FINIS"
EXIT 0
|
Can suomeone please explain me the fault and help me in writting the new one.. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
You're missing an assignment, and you're using the 'TRANSLATE' function incorrectly (It's TRANSLATE variable,new-value,old-value). You also neglected to PUSH the updated variable into the stack:
Code: |
DO I = 1 TO LINE.0
SAY LINE.1
LINE.I = TRANSLATE(LINE.I,'OLD','NEW') <== change this
PUSH LINE.I <== add this
"EXECIO 1 DISKW DATAOUT"
SAY 'LINE.I'
END
|
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Also, on an unrelated issue, last I knew of, DISP=MOD processing is not valid for a PDS member:
Code: |
"ALLOC DA('XX.XX.REXX(W1GCS7EF)') F(DATAOUT) MOD"
|
If I recall, PDS members are allocated as either SHR or OLD only. |
|
Back to top |
|
|
Pollyannaish
New User
Joined: 09 Jul 2005 Posts: 31 Location: Pune, India
|
|
|
|
Thanks Superk
But now the trouble is translate chnages the string unsing characters but i want to change the words only.
Do we have specific command or function using which we can change
specific word to another..??? not the character..
Thanks
Prem |
|
Back to top |
|
|
Sathishk
New User
Joined: 16 Feb 2006 Posts: 8
|
|
|
|
Hi,
You can use an edit macro with a CHANGE command in it.
Sathish |
|
Back to top |
|
|
|