Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Search and replace a record having particular value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
chiru_sh

New User


Joined: 21 Feb 2008
Posts: 18
Location: Mumbai

PostPosted: Mon Jun 23, 2008 11:37 am    Post subject: Search and replace a record having particular value
Reply with quote

Hi,

I am facing a problem in which i need to search a string in a file.

For eg. My file looks like this

FILE1 (FB 80)

Code:

CUSTOMER1  10100   
MNTHLY STMT   BALANCE   2000
CUSTOMER2  11100   
MNTHLY STMT REQUIRES MODIFICATION ACCT   BALANCE   5000
CUSTOMER3  11111   
YOUR INFO ENCLOSED
MNTHLY STMT REQUIRES MODIFICATION ACCT   BALANCE   7000


My file looks like above one. In which the records do not have any key and the information is embedded in the file randomly.

I want to check & replace all the values of balance.
i.e. I want to search the file for keyword 'BALANCE' and whatever value is there i need to change it.

I want to make it look like this through batch job.

FILE1 (FB 80)

Code:

CUSTOMER1  10100   
MNTHLY STMT   BALANCE   [b]1000[/b]
CUSTOMER2  11100   
MNTHLY STMT REQUIRES MODIFICATION ACCT   BALANCE   1000
CUSTOMER3  11111   
YOUR INFO ENCLOSED
MNTHLY STMT REQUIRES MODIFICATION ACCT   BALANCE   1000
Back to top
View user's profile Send private message

karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Jun 23, 2008 1:22 pm    Post subject: Reply to: Search and replace a record having particular valu
Reply with quote

Through REXX it is possible...
Back to top
View user's profile Send private message
ssk1711

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Mon Jun 23, 2008 3:00 pm    Post subject:
Reply with quote

Hi,

Assuming u know REXX.

you can invoke ISPF command " C 'str1' 'str2' all " using REXX that will do the required jbo for u.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Mon Jun 23, 2008 4:30 pm    Post subject: Reply to: Search and replace a record having particular valu
Reply with quote

ssk,

Quote:
you can invoke ISPF command " C 'str1' 'str2' all " using REXX that will do the required jbo for u.


I doubt if this would work as "str1" is not the same throughout the file.

If you are ok with rexx, All you will have to do is read the file into a stem variable, use "substr" to find the text "balance" and update the record with the value 1000 one space after balance.
Back to top
View user's profile Send private message
ssk1711

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Mon Jun 23, 2008 5:23 pm    Post subject:
Reply with quote

ho.. sorry.. using " c 'str1' 'str2' all" the requirement could not be met.

and we can use SUBSTR. Also one way is to use OVERLAY function.

logic could be like,

str ---> stem variable containig the lines of the dataset

loop:
pos = index(str,'BALANCE')
pos = pos + 8
overlay('1000',str,pos)
write to the dataset
loop-ends
Back to top
View user's profile Send private message
chiru_sh

New User


Joined: 21 Feb 2008
Posts: 18
Location: Mumbai

PostPosted: Mon Jun 23, 2008 7:27 pm    Post subject: Reply to: Search and replace a record having particular valu
Reply with quote

But the problem is I have to create a batch job for it. I have to schedule it in prod. I cannot use REXX. Is there any way,from which we can use SORT???
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jun 23, 2008 11:19 pm    Post subject:
Reply with quote

Hello,

Quote:
I cannot use REXX.
Why not? REXX works in batch. . .
Back to top
View user's profile Send private message
Vasukip
Currently Banned

New User


Joined: 17 Jun 2008
Posts: 48
Location: Chennai

PostPosted: Tue Jun 24, 2008 11:37 am    Post subject: Re: Reply to: Search and replace a record having particular
Reply with quote

chiru_sh wrote:
But the problem is I have to create a batch job for it. I have to schedule it in prod. I cannot use REXX. Is there any way,from which we can use SORT???


you can use ds !

Rexx is executed in batch using JCL

//TSOXXXX1 JOB (TEST),MSGCLASS=X
//JS01 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSEXEC DD DSN=T.TSOXXXX.REXX,DISP=SHR
//SYSTSIN DD *
Rexx1 parm1 parm2
/*
Back to top
View user's profile Send private message
chiru_sh

New User


Joined: 21 Feb 2008
Posts: 18
Location: Mumbai

PostPosted: Wed Jun 25, 2008 4:49 pm    Post subject: Reply to: Search and replace a record having particular valu
Reply with quote

Thanks for the JCL. I have to check the REXX to do it.

If possible can we do it by sort.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Aug 09, 2008 2:50 am    Post subject:
Reply with quote

Quote:
If possible can we do it by sort.


It is now possible with DFSORT if you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008) installed. Here's the DFSORT job:

Code:

//S1   EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
CUSTOMER1  10100
MNTHLY STMT   BALANCE   2000
CUSTOMER2  11100
MNTHLY STMT REQUIRES MODIFICATION ACCT   BALANCE   5000
CUSTOMER3  11111
YOUR INFO ENCLOSED
MNTHLY STMT REQUIRES MODIFICATION ACCT   BALANCE   7000
/*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC FINDREP=(IN=C'BALANCE',OUT=C'BALANCE   1000',SHIFT=NO)
/*


For complete details on the new FINDREP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us