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

Find and Replace with AND condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Thu Apr 23, 2009 10:53 pm
Reply with quote

Hi all,

I have a requirement, in which If there is "40" at posistion 10 AND "09" at position 12 i need to replace the "09" to "90" and write the entire record

if the AND condition is not statisfied i need to write the entire record of the file unaltered to the output file.

hope i have explained the rq clearly ...please write back if not.

could some one please explain me how to do this .. using Sort

Thanks !!
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: Thu Apr 23, 2009 11:07 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
R01      4009
R02      4010
R03      4109
R04      4009
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
   OPTION COPY
   INREC IFTHEN=(WHEN=(10,2,CH,EQ,C'40',AND,12,2,CH,EQ,C'09'),
      OVERLAY=(12:C'90'))
/*


SORTOUT will have:

Code:

R01      4090 
R02      4010 
R03      4109 
R04      4090 
Back to top
View user's profile Send private message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Thu Apr 23, 2009 11:20 pm
Reply with quote

Thanks Frank,
you people have never let me down icon_smile.gif
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top