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 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 Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am

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