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 SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am


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