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
 

 

Select greater of the two fields and replace another with it

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Raymond Sachs

New User


Joined: 13 Dec 2007
Posts: 45
Location: USA

PostPosted: Fri May 13, 2011 5:12 am    Post subject: Select greater of the two fields and replace another with it
Reply with quote

Dear Listers,

How do I select greater of the two date fields and replace a third field with the selected value(i.e. greater of the two date fields).

LRECL = 53. Date field 1 -> 6 to 15; Date field 2 -> 25 to 34. We use SYNCSORT 1.3.2

Code:


EDIT       TEST.INPUT                               
Command ===>                                               
=COLS> ----+----1----+----2----+----3----+----4----+----5---
****** ***************************** Top of Data ***********
000001 AAAA 2001-10-01 BBBB CC 2006-06-03 HHHHHH0001-01-01B6
000002 ADDA 2006-11-21 BBBB CC 0001-01-01 HHHHHH0001-01-01B7
****** **************************** Bottom of Data *********


Output:
Code:

EDIT       TEST.OUTPUT                             
Command ===>                                               
=COLS> ----+----1----+----2----+----3----+----4----+----5---
****** ***************************** Top of Data ***********
000001 AAAA 2001-10-01 BBBB CC 2006-06-03 HHHHHH2006-06-03C4
000002 ADDA 2006-11-21 BBBB CC 0001-01-01 HHHHHH2006-11-21B4
****** **************************** Bottom of Data *********
Back to top
View user's profile Send private message

gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri May 13, 2011 3:52 pm    Post subject:
Reply with quote

Hi,

The below sort will work as per your requirement.

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
AAAA 2001-10-01 BBBB CC 2006-06-03 HHHHHH0001-01-01B6 
ADDA 2006-11-21 BBBB CC 0001-01-01 HHHHHH0001-01-01B7 
/*                                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
  OPTION COPY                                         
  INREC IFTHEN=(WHEN=(06,10,CH,GE,25,10,CH),           
              OVERLAY=(42:06,10)),                     
        IFTHEN=(WHEN=(06,10,CH,LT,25,10,CH),           
              OVERLAY=(42:25,10))     
/*               


OUTPUT
Code:

AAAA 2001-10-01 BBBB CC 2006-06-03 HHHHHH2006-06-03B6
ADDA 2006-11-21 BBBB CC 0001-01-01 HHHHHH2006-11-21B7
Back to top
View user's profile Send private message
Raymond Sachs

New User


Joined: 13 Dec 2007
Posts: 45
Location: USA

PostPosted: Tue May 17, 2011 2:55 am    Post subject:
Reply with quote

Thanks mate. It did.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


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