IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Search and replace a record having particular value


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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: 1287
Location: Chennai, India

PostPosted: Mon Jun 23, 2008 4:30 pm
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
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
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

Moderator Emeritus


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

PostPosted: Mon Jun 23, 2008 11:19 pm
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
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
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 Developer


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

PostPosted: Sat Aug 09, 2008 2:50 am
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:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top