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

DFSORT - FIND AND REPLACE Other Field in a Same record


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

New User


Joined: 27 Nov 2015
Posts: 5
Location: INDIA

PostPosted: Fri Feb 12, 2016 1:52 pm
Reply with quote

Hi,
I want to find a string in a record(same position always) and Replace the other field in a same record without omitting other records.

Is that possible without using INTHEN and OVERLAY function in DFSORT.?
Ex:
......ABC....
................

IN above record I want to find a record with string "ABC' and include '1' in a field 0.Then the Output would be

1.....ABC....
.................

Please guide me to solve this .


Thanks in advance
arun
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 12, 2016 2:01 pm
Reply with quote

Yes, look at field-type SS in your documentation.
Back to top
View user's profile Send private message
Arunraj Murugaiyan

New User


Joined: 27 Nov 2015
Posts: 5
Location: INDIA

PostPosted: Fri Feb 12, 2016 2:41 pm
Reply with quote

Thanks for the reply Bill.

But I didn't get you. Both fields are CHAR.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 12, 2016 3:34 pm
Reply with quote

Did you do what I suggested?

You're confusing the issue by using FIND AND REPLACE in your post-subject, when FINDREP (Find and Replace) is a DFSORT function which you have no way to use for this.

You want a simple IFTHEN=(WHEN=(logicalexpression) which allows you to look for your characters at any starting position in a range that you specify, then change something with OVERLAY (note, if you are inserting something you'd have to use BUILD).

Do you know what a field-type of CH means? Do you know what any field-type means? Do you know, in the data, where the field-type is stored (hint: nowhere)? What relevance is one field-type over another, given the foregoing? So why do you think that "CH" would prevent you using SS instead, given that SS will give you what you want and "CH" will not?

Code:
IFTHEN=(WHEN=(1,80,SS,EQ,C'ABCD')...


will be "true" if ABCD appears anywhere between positions one and 77.
Back to top
View user's profile Send private message
Arunraj Murugaiyan

New User


Joined: 27 Nov 2015
Posts: 5
Location: INDIA

PostPosted: Fri Feb 12, 2016 4:13 pm
Reply with quote

Yes, Now I understood the field-type SS. Thanks for the explanation.icon_smile.gif

But actually I know the ABC(search string) position like (100,3). and It will work fine IF we use IFTHEN and OVERLAY(I tried).

But My requirement is to achieve this without using IFTHEN and OVERLAY function. Will this Possible?.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 12, 2016 4:41 pm
Reply with quote

Where did that funny requirement come from?

You can do it with BUILD, but OVERLAY would be better

Code:
 OPTION COPY
 INREC BUILD=(100,3,CHANGE=(1,C'ABC',C'1'),NOMATCH=(1,1),2,len)



Code:
 OPTION COPY
 INREC OVERLAY=(1:100,3,CHANGE=(1,C'ABC',C'1'),NOMATCH=(1,1))


For the BUILD you'd need to change "len" appropriate for your record-length. Code is slightly different (to include RDW, and change starting position, and how the variable-length data is copied) for variable-length records.

In the above cases, the relevant part of the code says "take the three bytes at position 100, and CHANGE them, with an output length of one, so that ABC is "1" and everything else stays at the original value of position 1. Place that one-byte result in the record at position one".
Back to top
View user's profile Send private message
Arunraj Murugaiyan

New User


Joined: 27 Nov 2015
Posts: 5
Location: INDIA

PostPosted: Fri Feb 12, 2016 5:40 pm
Reply with quote

Thanks Bill...Your Great 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 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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top