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
 
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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 0 Thu Dec 14, 2017 8:13 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am

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