Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort Condion using IF

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
harinair_kn
Warnings : 2

New User


Joined: 27 Feb 2006
Posts: 16
Location: India

PostPosted: Wed Mar 13, 2013 8:08 pm    Post subject: Sort Condion using IF
Reply with quote

I have a requiremnt to check for a specific character in position 40-42 and if its present, i need to replace the characters in position 1-3 with number 521.


Eg: Input File : 514 ...............................ADS12345678

If "ADS" is present in position 40-42, I need to replace "514" in position 1-3 with "521" and copy the entire string to the output file. Can somebody help me here?

Thanks,
hari
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 13, 2013 8:22 pm    Post subject:
Reply with quote

Have you tried INREC IFTHEN and OVERLAY? By the way, per your example the starting position is 36 and not 40-42:
Code:
----+----1----+----2----+----3----+----4----+-
514 ...............................ADS12345678
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 684
Location: Pennsylvania

PostPosted: Wed Mar 13, 2013 8:25 pm    Post subject:
Reply with quote

http://ibmmainframes.com/viewtopic.php?t=60582&highlight=overlay

This has what you need.

Loook at:
INREC
IFTHEN
OVERLAY

You should be able to take it from there.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Mar 13, 2013 10:44 pm    Post subject: Reply to: Sort Condion using IF
Reply with quote

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
----+----1----+----2----+----3----+----4----+----5----+----6---
514 ...................................ADS12345678             
514 ...................................BDS12345678             
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION COPY                                                 
  INREC OVERLAY=(1:40,3,CHANGE=(3,C'ADS',C'521'),NOMATCH=(1,3))
//*
Back to top
View user's profile Send private message
harinair_kn
Warnings : 2

New User


Joined: 27 Feb 2006
Posts: 16
Location: India

PostPosted: Thu Mar 14, 2013 2:09 am    Post subject: Reply to: Sort Condion using IF
Reply with quote

Thnaks a lot for all your suggestions.Let me just test it out..
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Mar 14, 2013 8:32 am    Post subject:
Reply with quote

Quote:
Have you tried INREC IFTHEN and OVERLAY?
Thank you for balling us out with CHANGE, SKolusu! 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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us