View previous topic :: View next topic |
Author |
Message |
JOHNCWL Beginner
Joined: 25 Feb 2004 Posts: 31 Topics: 16
|
Posted: Wed Feb 25, 2004 8:56 am Post subject: Parsing through a dataset content |
|
|
Hi,
I want to parse through a file and change all the
SET CURRENT SQLID= |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Wed Feb 25, 2004 2:49 pm Post subject: |
|
|
You can use Edit-Macro. Here is some example:
Code: | /* REXX */
ADDRESS ISREDIT "MACRO PROCESS"
STRING1 = "SQLID=?XXXXXXX?"
STRING2 = "SQLID=?XXXYYY?"
STRING3 = "SQLID=?JOHN?"
ADDRESS ISREDIT "C ALL "STRING1 STRING3
ADDRESS ISREDIT "C ALL "STRING2 STRING3
ADDRESS ISREDIT "SAVE"
EXIT
|
O.
________
SDR 200
Last edited by ofer71 on Sat Feb 05, 2011 11:16 am; edited 1 time in total |
|
Back to top |
|
 |
JOHNCWL Beginner
Joined: 25 Feb 2004 Posts: 31 Topics: 16
|
Posted: Thu Feb 26, 2004 5:31 am Post subject: |
|
|
HI,
Sorry I was not clear of the requirment. Now the requirement is as follows:
I ahve a dataset as:
SET CURRENT SQLID = 'XXXXXX';
CREATE DATABASE ...........
COMMIT;
SET CURRENT SQLID = 'XXXYYY';
CREATE TABLESPACE .............
COMMIT;
So there are my lines in between SIMILAR to SET CURRENT SQLID.
First I want to delete this all SET CURRENT SQLID through out the file and then put a SET CURRENT SQLID only at the top, i.e first line.
So how to write the macro for this and also is I need to call this macro on a dataset(JOHN.DDLs) how to invoke it??
Pls help me...  |
|
Back to top |
|
 |
JOHNCWL Beginner
Joined: 25 Feb 2004 Posts: 31 Topics: 16
|
Posted: Thu Feb 26, 2004 5:38 am Post subject: |
|
|
SET CURRENT SQLID = '???????' is not fixed length, Max is 8 characters...
So irrespective of what it is .. i need to change it to JOHN only. |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Thu Feb 26, 2004 5:50 am Post subject: |
|
|
Here is your solution, again - Edit-Macro:
Code: | /* REXX */
ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "X ALL 'SET CURRENT SQLID'"
ADDRESS ISREDIT "DELETE X ALL"
NEWLINE = "SET CURRENT SQLID='JOHN'"
ADDRESS ISREDIT "LINE_BEFORE 1 = (NEWLINE)"
ADDRESS ISREDIT "END"
EXIT |
You can run this macro through all members of PDS using the following REXX:
Code: | /* REXX */
MAC = 'CHGSQLID'
PDS = "your.pds"
X = OUTTRAP("LIBMEM.")
ADDRESS TSO "LISTDS '"PDS"' M"
X = OUTTRAP("OFF")
DO I = 7 TO LIBMEM.0
LIBMEM.I = STRIP(LIBMEM.I)
ADDRESS ISPEXEC "EDIT DATASET ('"PDS"("LIBMEM.I")') MACRO ("MAC")"
END
EXIT
|
O.
________
Ford XR Falcon history
Last edited by ofer71 on Sat Feb 05, 2011 11:16 am; edited 1 time in total |
|
Back to top |
|
 |
JOHNCWL Beginner
Joined: 25 Feb 2004 Posts: 31 Topics: 16
|
Posted: Thu Feb 26, 2004 9:03 am Post subject: |
|
|
Thanks !! it worked!! |
|
Back to top |
|
 |
|
|