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
 

 

DFSORT - FIND AND REPLACE Other Field in a Same record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DFSORT - FIND AND REPLACE Other Field in a Same record
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Feb 12, 2016 2:01 pm    Post subject: Reply to: DFSORT - FIND AND REPLACE Other Field in a Same record
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Feb 12, 2016 3:34 pm    Post subject: Reply to: DFSORT - FIND AND REPLACE Other Field in a Same record
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Feb 12, 2016 4:41 pm    Post subject: Reply to: DFSORT - FIND AND REPLACE Other Field in a Same record
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    Post subject:
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    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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am


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