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

Question on IFTHEN and OVERLAY Statement in DFSORT


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

New User


Joined: 18 Apr 2014
Posts: 2
Location: USA

PostPosted: Tue Oct 21, 2014 11:03 pm
Reply with quote

Hi,
I have a requirement where i need to replace few characters at two different positions. But when try using below SORT Card, it replaces only the first OVERLAY statement(Position 72) and second OVERLAY statement(Position 82) was not executed. Will someone able to explain whether i need to change the SORT Card Parameters or we can do it in this method.

Sort Card :
OPTION COPY
OUTREC IFTHEN=(WHEN=(72,10,CH,EQ,C'9999-99-99'),
OVERLAY=(72:C'0001-01-01')),
IFTHEN=(WHEN=(82,10,CH,EQ,C'9999-99-99'),
OVERLAY=(82:C'0001-01-01'))
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Oct 21, 2014 11:46 pm
Reply with quote

Code:
HIT=NEXT
?
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: Wed Oct 22, 2014 3:40 am
Reply with quote

Spot on Nic.

narein207,

Once an IFTHEN=(WHEN=(logical-expression) is true for the current record, IFTHEN processing stops unless , when you want to make another test for an unrelated condition on the same record, then you have to specify HIT=NEXT, which will cause processing to continue until another IFTHEN=(WHEN=(logical-expression) is satisfied, or until there are no more IFTHEN tests.

And please use the Code tags.

Code:
OPTION COPY
 INREC IFTHEN=(WHEN=(72,10,CH,EQ,C'9999-99-99'),
                     OVERLAY=(72:C'0001-01-01'),HIT=NEXT),
       IFTHEN=(WHEN=(82,10,CH,EQ,C'9999-99-99'),
                     OVERLAY=(82:C'0001-01-01'))


You might also want to look at using CHANGE. Consult the manual and see what you think.
Back to top
View user's profile Send private message
narein207

New User


Joined: 18 Apr 2014
Posts: 2
Location: USA

PostPosted: Wed Oct 22, 2014 11:04 pm
Reply with quote

Thanks a lot Nic and Bill. Let me test and will also look at using CHANGE.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Question for file manager IBM Tools 7
Search our Forums:

Back to Top