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

Need to replace values using INREC condition


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

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Wed May 20, 2009 6:20 pm
Reply with quote

my input file has the value NLN in 346th position and 01Q in 369th position.
i want to check from the 346th position, if the value is NLN then I have to change it to NLQ.
and i have to check the column 369th position,if the value is 01Q then I have to change it to 01D.

I written below sort condition

Code:

  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=(346,3,CH,EQ,C'NLN',OR,346,3,CH,EQ,C'NLD',
       OR,346,3,CH,EQ,C'NLQ'),BUILD=(1,345,346:C'NLQ',349,206)),
      IFTHEN=(WHEN=(369,3,CH,EQ,C'01N',OR,369,3,CH,EQ,C'01D',
      OR,369,3,CH,EQ,C'01Q'),BUILD=(1,345,369:C'01D',372,206)),


But i am getting the result only for the column 346,it is not replacing the values to 369th position,

Need help from anyone.

Thanks in advance.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 20, 2009 6:42 pm
Reply with quote

Search for use of HIT=NEXT in IFTHEN
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Wed May 20, 2009 6:45 pm
Reply with quote

thanks a lot for your reply..could you please give me an example.
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Wed May 20, 2009 6:55 pm
Reply with quote

my code is

Code:

  IFTHEN=(WHEN=(346,3,CH,EQ,C'NLN',OR,346,3,CH,EQ,C'NLD',
   OR,346,3,CH,EQ,C'NLQ'),BUILD=(1,345,346:C'NLQ',349,206)),
  IFTHEN=(WHEN=(346,3,CH,EQ,C'01N',OR,346,3,CH,EQ,C'01D',
   OR,346,3,CH,EQ,C'01Q'),BUILD=(1,345,346:C'01D',349,206)),
  IFTHEN=(WHEN=(346,3,CH,EQ,C'02N',OR,346,3,CH,EQ,C'02D',
   OR,346,3,CH,EQ,C'02Q'),BUILD=(1,345,346:C'02D',349,206)),
  IFTHEN=(WHEN=(346,3,CH,EQ,C'04N',OR,346,3,CH,EQ,C'04D',
   OR,346,3,CH,EQ,C'04Q'),BUILD=(1,345,346:C'04D',349,206)),


the above values I have to replace to the positions 369 and 395,415

If possible could you please provide a piece of code.
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: Wed May 20, 2009 8:38 pm
Reply with quote

I don't think your control statements are what you actually want based on your statement "the above values I have to replace to the positions 369 and 395,415". All of your WHEN conditions have 346,3 but I assume they should have 369,3, 395,3 and 415,3 as well. At any rate, if you do have different positions in different clauses, then you can use HIT=NEXT for all but the last IFTHEN clause:

Code:

  INREC IFTHEN=(WHEN=(346,3,CH,EQ,C'NLN',OR,346,3,CH,EQ,C'NLD',         
   OR,346,3,CH,EQ,C'NLQ'),BUILD=(1,345,346:C'NLQ',349,206),HIT=NEXT),   
  IFTHEN=(WHEN=(346,3,CH,EQ,C'01N',OR,346,3,CH,EQ,C'01D',               
   OR,346,3,CH,EQ,C'01Q'),BUILD=(1,345,346:C'01D',349,206),HIT=NEXT),   
  IFTHEN=(WHEN=(346,3,CH,EQ,C'02N',OR,346,3,CH,EQ,C'02D',               
   OR,346,3,CH,EQ,C'02Q'),BUILD=(1,345,346:C'02D',349,206),HIT=NEXT),   
  IFTHEN=(WHEN=(346,3,CH,EQ,C'04N',OR,346,3,CH,EQ,C'04D',               
   OR,346,3,CH,EQ,C'04Q'),BUILD=(1,345,346:C'04D',349,206))             
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Wed May 20, 2009 10:37 pm
Reply with quote

Thanks Frank, really great help!!
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top