MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

edit datasets

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Tue May 06, 2008 3:43 pm    Post subject: edit datasets Reply with quote

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
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue May 06, 2008 4:15 pm    Post subject: Reply with quote

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 Smile ) 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
View user's profile Send private message Visit poster's website
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Tue May 06, 2008 4:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue May 06, 2008 4:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Tue May 06, 2008 5:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed May 07, 2008 3:23 am    Post subject: Reply with quote

you need an 'END' command in macro1
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group