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 

How to replace this ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Sat May 17, 2003 4:01 am    Post subject: How to replace this ? Reply with quote

I've a sequential 80 recl FB file which contains one record as:

Code:
FIELD1:CAN BE ANY VALUE


Now I want to replace this record with following record:

Code:
FIELD1:FIXED NEW VALUE


That means anaything can appear after
Quote:
FIELD1:
depending on the processing , but I want to replace it with a particular fixed string.

Sometimes the file may contain :
Code:
FIELD1:xxxxx

or at other times it may contain :
Code:
FIELD1:yyyyy

But everytime I want to replace it with :
Code:
FIELD1:fffff




How can we do this using batch file aid or sort ?
Back to top
View user's profile Send private message Send e-mail
savitri
Beginner


Joined: 27 Jan 2003
Posts: 1
Topics: 0

PostPosted: Sat May 17, 2003 5:15 am    Post subject: Reply with quote

Naveen,

This can be achieved by SORT utility.
Use the following sort card

Code:
 SORT FIELDS=COPY
 OUTREC FIELDS=(1:1,7,8:C'FFFFF') 



Thanks,
Savitri.
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat May 17, 2003 10:57 am    Post subject: Reply with quote

Actually, you should use the following so that the output file will have LRECL=80 like the input file:

Code:

  SORT FIELDS=COPY
  OUTREC FIELDS=(1:1,7,8:C'string',80:X)


If you use DFSORT, you can make this a little more easy to use with DFSORT symbols:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
* Replace string with constant you want
CON1,'string'
/*
//SORTIN DD ...  input
//SORTOUT DD ...  output
//SYSIN DD *
  OUTREC FIELDS=(1,7,CON1,80:X)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Mon May 19, 2003 12:44 am    Post subject: Reply with quote

Frank,
Your solution will work fine ,when :
Code:
FIELD1:xxxxx

always start at column 1. But for me it is not the case. Infact,
Code:
FIELD1:xxxxx

can start from any column from 1 to 68.

Thats why I was asking for some replace solution ...

Can we do this with sort ???
Or batch file-aid has some power to do this??
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Mon May 19, 2003 4:53 am    Post subject: Reply with quote

naveen,

The following JCL will give you the desired results.

Code:

//STEP010  EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//DD01     DD DSN=INPUT.DATASET,
//            DISP=SHR
//DD01O    DD DSN=OUTPUT.DATASET,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE),
//            DCB=(RECFM=FB,LRECL=ZZZ,BLKSIZE=0)
//SYSIN DD *
$$DD01 COPY EDITALL=(1,0,C'FIELD1',C'NEW CONSTANT VALUE')
/*


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Mon May 19, 2003 5:59 am    Post subject: Reply with quote

Kolusu,
It looks as if you haven't read(understood) my problem correctly. Please have a proper look at the problem.
The solution which you have suggested will just replace a particular string.
My problem is different.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Mon May 19, 2003 6:20 am    Post subject: Reply with quote

Naveen,

I am not sure as to what you are trying to do. But the JCL posted above does a scan of every record for 'FIELD1' irrespective of the position where it occurs and replaces it a 'NEW CONSTANT VALUE'. The new constant value can be your fixed string.This is what I assumed from your follow up post to frank who suggested the DFSORT solution. Now what am I missing in here?

Thanks

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Mon May 19, 2003 6:50 am    Post subject: Reply with quote

Kolusu,
Better you check my first post on this thread.
I don't want to replace 'FIELD1' with 'any other value'
I want to replace string next to 'FIELD1' with constant string.

FIELD1:xxxxx should be replaced by FIELD1:fffff

but xxxxx is not always xxxxx it could be yyyyy or anything. But I want this complete record FIELD1:xxxxx to be replaced with FIELD1:fffff

I hope I've made myself more clearer this time.
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon May 19, 2003 10:07 am    Post subject: Reply with quote

Naveen,

I've reread your original statement of your requirement and it is NOT clear. In the future, you might want to try to state your requirements more clearly, rather than fault people who are trying to help you.

Sort products do not have any built-in functions to do what you want, although it could be done using an E15 exit with the appropriate logic.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Mon May 19, 2003 10:55 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Mon May 19, 2003 10:23 am    Post subject: Reply with quote

Naveen,

I understood your problem and suggested the solution, but it seems you did not even try to execute it and see what it produces. I am using the scan area to be 'FIELD1' so that I can replace the string following it.Run the following jcl which would replace 'XXXXX' (irrespective of the position) to 'FFFFF' .Note that the value 'FIELD1' is not changed at all.

Code:

//STEP0100 EXEC PGM=FILEAID,REGION=0M                       
//*                                                         
//SYSLIST  DD SYSOUT=*                                       
//SYSPRINT DD SYSOUT=*                                       
//SYSUDUMP DD SYSOUT=*                                       
//DD01     DD *
FIELD1:XXXXXKOLUSU                         
              FIELD1:XXXXXDALALY           
                       FIELD1:XXXXXNAVEEN                                               
//DD01O    DD SYSOUT=*                                       
//SYSIN    DD *                                             
$$DD01 COPY REPLALL=(01,00,C'FIELD1:',C'FIELD1:FFFFF'),OUT=0
/*   



The out put of this job is :

Code:

FIELD1:FFFFFKOLUSU                             
              FIELD1:FFFFFDALALY               
                       FIELD1:FFFFFNAVEEN     


In my example I used EDITALL so that you can even have a larger string replace the shorter string.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Tue May 20, 2003 12:13 am    Post subject: Reply with quote

Kolusu ,
Your current solution
Code:
$$DD01 COPY REPLALL=(01,00,C'FIELD1:',C'FIELD1:FFFFF'),OUT=0

is really working great. But the solution which you posted earlier
Code:
$$DD01 COPY EDITALL=(1,0,C'FIELD1',C'NEW CONSTANT VALUE')

was just replacing 'FIELD1:' with 'NEW CONSTANT VALUE'.

Thanks for help .
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Tue May 20, 2003 5:53 am    Post subject: Reply with quote

naveeen,

I used EDITALL so that you can even have a larger string replace the shorter string.Remember REPLALL will overlap the next field if the string to be replaced is larger.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Mon Nov 14, 2005 5:01 am    Post subject: Reply with quote

Hi Kolusu,

you have mentioned FileAId in your post, but my shop dose not have a fileaid ,we have file master , is it possible to do this with FM or SORT utility?

thank you
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Nov 14, 2005 7:50 am    Post subject: Reply with quote

js01,

I haven't worked on File manager , so cannot give you an example. Check this link which talks about changing data in a dataset using file manager

http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/FMNU1G00/1.6?DT=20051109025552

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
taltyman
JCL Forum Moderator
JCL Forum Moderator


Joined: 02 Dec 2002
Posts: 310
Topics: 8
Location: Texas

PostPosted: Mon Nov 14, 2005 11:15 am    Post subject: Reply with quote

JS01
You could use this ISPF edit command

CHANGE P'FIELD1:=====' 'FIELD1:fffff' ALL
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
Goto page 1, 2  Next
Page 1 of 2

 
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