View previous topic :: View next topic
|
Author |
Message |
sathyak
New User
Joined: 06 Oct 2012 Posts: 2 Location: india
|
|
|
|
Hi All,
I am new to REXX. Please help me,
example:
STM.PARM(PSFILE) [my ps file]
&sathya [string in ps file occurs many times]
I need to replace all this &sathya with new string am getting as a input from user through REXX.
I dont know about MACROS in REXX. Need example code.
[/b] |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
I won't have access to a mainframe until Monday, so I'll be doing some handwaving, and any code I offer until then will be untested. Having said so much, are you looking for a Rexx script, to be run from the TSO READY prompt or the ISPF command line, or an edit macro written in Rexx? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
I dont know about MACROS in REXX. Need example code. |
what happened when You searched the forum for examples ? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
What happened when you read the "ISPF Edit and Edit Macros"? Did your eyes glaze over (like mine do with the DFSort manual!)? |
|
Back to top |
|
|
sathyak
New User
Joined: 06 Oct 2012 Posts: 2 Location: india
|
|
|
|
I have found Some code to replace string in ps. USING STEM
===================================================
/*REXX*/
INFILE = STR.REP.TEST
ADDRESS TSO
"ALLOC FI(INFIL) DA('"INFILE"') SHR REUSE"
"EXECIO * DISKR INFIL (STEM OUT. FINIS"
"FREE FI(INFIL)"
DO I=1 TO OUT.0
A=OUT.I
A=STRRPL(A,'&TEXT','NEWTEXT')
REP.I=A
"ALLOC FI(OUTFI) DA('"INFILE"') SHR REUSE"
"EXECIO * DISKR OUTFI (STEM REP. FINIS"
"FREE FI(OUTFI)"
END
STRRPL:
ORIG=ARG(1)
OLD=ARG(2)
NEW=ARG(3)
NEWSTR = ORIG
DO WHILE POS(OLD,NEWSTR)-1) || ,
NEW || SUBSTR(NEWSTR,POS(OLD,NEWSTR) + LENGTH(OLD))
END
RETURN NEWSTR
=============================================
Its working with PS files. but not with PDS MEMBER.
Other then MACRO is there any possiblities to do this for PDS MEMBER. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
- In the future, enclose your code (and anything else where alignment can be significant) in Code tags. Both the Quick and ordinary reply screen have a Code button, which places an open Code tag at the cursor position; you can then paste after it and click on the Close Tags link.
Code: |
Code text looks like this |
Note that extra spaces are preserved.
In the future, do not merely post, "It didn't work!"; we can deduce that from the fact that you are posting here. Give us the information that we need to diagnose the problem and recommend to you how to correct it: message numbers and text, and return and abend codes.
Apropos of the last, a sine qua non for debug Rexx scripts is a trace. Place either TRACE I (which shows intermediate results for your statements) or TRACE R (which shows only final results) immediately before the point where you wish to begin tracing; place TRACE O if you wish to turn off the trace before the end of the script.
The code you show is very obviously for a physical sequential (PS) data set; we need to see what changes you made attempting to adapt it to work with a PDS.
|
|
Back to top |
|
|
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
For a PDS you will need your main REXX script which will call another rexx macro to edit your PDS members..
Here I have written one..But I can't test it until Monday.
CHANGSTR
Code: |
/******************REXX*******************/
ISREDIT "MACRO PROCESS"
MDSN = 'YOUR.PDS.NAME'
INPUT1 = 'STRING1'
INPUT2 = 'STRING2'
IF INPUT1 \= ' ' THEN
DO
IF INPUT2 \= ' ' THEN
DO
IF SYSDSN(MDSN) = "OK" THEN
"ISPEXEC VPUT (INPUT1) SHARED"
"ISPEXEC VPUT (INPUT2) SHARED"
X=OUTTRAP('N.')
SAY MDSN
"LISTDS" MDSN "MEMBER"
X=OUTTRAP('OFF')
SAY "TOTAL" N.0-6 "MEMBERS OF",
MDSN "TO BE PROCESSED.........."
DO I=7 TO N.0
MEM=STRIP(N.I,B)
MYFILE=MDSN || '(' || MEM || ')'
ADDRESS ISPEXEC "EDIT DATASET("MYFILE") MACRO(IM001)"
END
DROP N.
END
END
|
Macro IM001
Code: |
/*REXX*/
ISREDIT "MACRO PROCESS"
"ISPEXEC VGET (ENDEXEC) SHARED"
"ISPEXEC VGET (INPUT2) SHARED"
"ISPEXEC VGET (INPUT1) SHARED"
ISREDIT "C ALL " INPUT1 INPUT2
ISREDIT "RESET "
ISREDIT "END"
EXIT
|
|
|
Back to top |
|
|
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
I'm too drunk to realize that I'm replying to a dead post :-) |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
I'm too drunk to realize that I'm replying to a dead post :-) |
well still pretty warm...
I' ve seen people replying to five years old posts
and before I split it somebody tailgating to a seven years old post |
|
Back to top |
|
|
|