View previous topic :: View next topic |
Author |
Message |
roger29 Beginner
Joined: 25 Nov 2004 Posts: 4 Topics: 2
|
Posted: Thu Nov 25, 2004 7:20 am Post subject: To Change data in members in a PDS |
|
|
Hi,
i have a PDS (say PDS1) with members having multiple lines.One of those lines have two parameter fields as &&AAA and &&BBB.
Also have a sequential file (say file1) with a single record having two date values
20010701 20010901
Now, i need to to copy all the members in PDS1 to an another PDS named to PDS2 and replace &&AAA with '2001-07-01' and and &&BBB with '2001-09-01' present in the file1.
think this could be accomplished in batch by executing a REXX routine through JCL.
Could anybody provide me a REXX routine to accomplish this? i am not very familiar with REXX.
Is there any other way perform the above without using rexx?
Thanks
-Roger |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Nov 25, 2004 10:16 am Post subject: |
|
|
Roger29,
U can achieve the desired result using 3 small macros.
Macro # 1: NAME: REPLMEM
Code: |
/* REXX */
CALL OUTTRAP "TRAP."
"LISTD" 'T.PDS1' "MEMBERS"
CALL OUTTRAP "OFF"
/* * * * * * * * * * * * * * * * * * * * */
/* POSITION THE POINTER TO THE */
/* BEGINNING OF MEMBER LIST */
/* * * * * * * * * * * * * * * * * * * * */
DO I = 1 TO TRAP.0
IF TRAP.I = "--MEMBERS--" THEN
LEAVE
END
MBR_COUNT = TRAP.0 - I
I = I + 1
DO J = I TO TRAP.0
PARSE VALUE TRAP.J WITH MEMBER_NAME
MEMBER_NAME = STRIP(MEMBER_NAME)
OLD_DSN = "'T.PDS1("||MEMBER_NAME||")'"
NEW_DSN = "'T.PDS2("||MEMBER_NAME||")'"
"ISPEXEC VIEW DATASET("||OLD_DSN||") MACRO(CUTCOPY)"
"ISPEXEC EDIT DATASET("||NEW_DSN||") MACRO(RPASTE)"
END
EXIT 0
|
MACRO # 2: NAME: CUTCOPY
Code: |
/* REXX */
"ISREDIT MACRO"
"ISREDIT CUT .ZF .ZL CLIPBRD REPLACE"
"ISREDIT BUILTIN CANCEL"
RETURN
|
MACRO # 3: NAME: RPASTE
Code: |
"ISREDIT MACRO"
"ISREDIT PASTE CLIPBRD AFTER .ZCSR DELETE"
"ISREDIT SCAN OFF"
"ISREDIT CHANGE ALL '&&AAA' '2001-07-01'"
"ISREDIT CHANGE ALL '&&BBB' '2001-09-01'"
"ISREDIT CHANGE ALL '&&2001' '2001'"
"ISREDIT END"
RETURN
|
All you need to do is to execute REPLMEM (TSO REPLMEM). It will invoke the other two macros. The new pds PDS2 must be created before invoking the REPLMEM macro. Just create a empty PDS. It will create the members.
Hope this helps,
Thanks,
Phantom |
|
Back to top |
|
 |
roger29 Beginner
Joined: 25 Nov 2004 Posts: 4 Topics: 2
|
Posted: Fri Nov 26, 2004 8:52 am Post subject: |
|
|
Thanks Phantom
-Roger |
|
Back to top |
|
 |
|
|