MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help in SORT jcl

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
sunilsai
Beginner


Joined: 20 Oct 2015
Posts: 2
Topics: 2

PostPosted: Sat Oct 31, 2015 11:04 am    Post subject: Need help in SORT jcl Reply with quote

Hi All,

I have two flat file having reclords like this

file 1
Code:

batch running  30-12-15
last batch     29-12-15

file2
Code:

changed memo 15-12-15
changed bill 16-12-15


I want to sort this files into single Dataset having records like
Code:

date1 29-12-15
date2 30-12-15
date3 15-12-15
date4 16-12-15

*these date1, date2...are constants. But the dates are changing daily in that files. these to be append at the end of constants.

please help in this regard.

Thanks
sunilsai
_________________
Thanks
Sunilsai
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Sun Nov 01, 2015 12:02 pm    Post subject: Reply with quote

Sunilsai,

Your description does not match output. when you sort the data, you should have 15 and 16 dates much before 29 and 30.

It seems to me that you need to sort individual files and then merge them together into a single file.

Here is an untested DFSORT job that would give you the desired results

I assumed that the date is in the format dd-mm-yy and in the first file it is at position 16 and then in the second file it is at position 14. I used the string "changed" in your second file to re-arrange the date.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DISP=SHR,DSN=YOUR INPUT FILE1
//         DD DISP=SHR,DSN=YOUR INPUT FILE2
//SYSIN    DD *
  OPTION STOPAFT=4
  INREC IFTHEN=(WHEN=(1,7,CH,EQ,C'CHANGED'),
         BUILD=(20,2,17,2,14,2,C'1')),
  IFTHEN=(WHEN=NONE,
         BUILD=(22,2,19,2,16,2,C'0'))

  SORT FIELDS=(1,6,Y2T,A,
               7,1,CH,A),EQUALS

  OUTREC BUILD=(c'DATE',SEQNUM,1,ZD,X,5,2,C'-',3,2,C'-',1,2)
//*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group