View previous topic :: View next topic |
Author |
Message |
Sarangadhar Beginner
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
|
Posted: Tue May 06, 2008 3:43 pm Post subject: edit datasets |
|
|
Hi,
I have a requirement:
there are lots of datasets like this:
HLQ1.HLQ2.HLQ3.HLQ4.HLQ5 with varying HLQ3 for each dataset. HLQ3 is Axxxxxxx, where xxxxxxx is varying.
I would need to open all those datasets and replace the first row of the dataset with a given value.
If it is not possible to replace the first row, then I have an alternative requirement: there are two words in the first row, these two words will never appear in the dataset anywhere else, so it is enough if we replace those two words with the 4 given words.
Can somebody help me in doing so?
I believe this will be possible using REXX or a JCL/PROC call with all the file names. _________________ Thanks |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue May 06, 2008 4:15 pm Post subject: |
|
|
see either the LMDLIST service (Google for examples or see the manual) or modify 'SYS1.SAMPLIB(IGGCSIRX)' to get the data set names. Then either call the ISPF editor with an initial macro, or call another utility to do the changes you need (sort, fileaid, etc).
With LMDLIST, the search and replace should probably be about 50 lines of Rexx (half of which are DO and END ) including very rudimentary error checking. One thing you will need to check for is if the given data sets are in use (the editor will fail or you won't be able to allocate the data set OLD because some other job/user has it already allocated). _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
Back to top |
|
|
Sarangadhar Beginner
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
|
Posted: Tue May 06, 2008 4:51 pm Post subject: |
|
|
I am trying to edit my PS datasets as below: Code: |
DS=HLQ1.HLQ2.Z||"*"||.HLQ4.HLQ5
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("DS")"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0
THEN SAY 'EDITING:' DSVAR
"EDIT DATASET("DSVAR") MACRO(MACRO1)"
ELSE
LEAVE
END
|
I get below error: Code: |
EDITING: HLQ1.HLQ2.Z1111111.HLQ4.HLQ5
INVALID DATA SET NAME, DATASET(HLQ1.HLQ2.Z1111111.HLQ4.HLQ5) |
_________________ Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue May 06, 2008 4:55 pm Post subject: |
|
|
Sarangadhar,
You need to enclose the DSVAR variable in single Quotes. Change this line to
Code: |
"EDIT DATASET("DSVAR") MACRO(MACRO1)"
|
to
Code: |
"EDIT DATASET('"DSVAR"') MACRO(MACRO1)" |
Hope this helps...
Cheers
Kolusu |
|
Back to top |
|
|
Sarangadhar Beginner
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
|
Posted: Tue May 06, 2008 5:40 pm Post subject: |
|
|
After editing the dataset, my control stops at the edited dataset. doesn't close, come back adn open another one. here is the code:
main program: Code: |
/* REXX */
TRACE I
/*DS=TSUA7BP.RKLIB.||"*" */
ADDRESS ISPEXEC
DS=TSUA7BP.D6744DBC.Z||"*"||.D080303.CTL
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("DS")"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0
THEN SAY 'EDITING:' DSVAR
"EDIT DATASET('"DSVAR"') MACRO(MACRO1)"
ELSE
LEAVE
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
MACRO program:
/*REXX*/
TRACE I
ADDRESS ISREDIT
/*"MACRO"*/
"MACRO"
/*ADDRESS ISPEXEC "CONTROL ERRORS RETURN"*/
"C ALL 'LOG NO' 'LOG NO REPLACE NOCOPYPEND' "
"RES"
"SAVE"
/*RETURN*/ |
_________________ Thanks |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed May 07, 2008 3:23 am Post subject: |
|
|
you need an 'END' command in macro1 _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
|
|