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 

Specific records to be sorted

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Temujin
Beginner


Joined: 19 Jun 2007
Posts: 13
Topics: 6

PostPosted: Wed Feb 25, 2009 9:57 am    Post subject: Specific records to be sorted Reply with quote

I am facing a problem can anybody please look into this and help me out, I tried searching but failed to get the answer.

Below is the test data of my input file:

0000ABCDEF
ACCEPTED
11110002000ADDICT
44420002000ADDICT
22211110002000ANOWHS
44420002000ADDICT


My requirement is to have the first two records as it is (order should be preserved) and the rest of the records to be sorted
on first 3 bytes. I could achieve this in 3 steps, can anybody help me in reducing the number of steps?

The output file should look like below:


0000ABCDEF
ACCEPTED
11110002000ADDICT
22211110002000ANOWHS
44420002000ADDICT
44420002000ADDICT


Thanks,
Temu.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Feb 25, 2009 10:28 am    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for in one pass/step.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB)
//OUT DD DSN=...  output file (FB)
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER(2) USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,3,CH,A)
/*


For complete details on the DATASORT function and the other new functions available with DFSORT PTF UK90013 (July, 2008), see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Thu Feb 26, 2009 10:18 am    Post subject: Reply with quote

Assuming the input file is FB/80, try this alternate solution:

Code:

//S1    EXEC PGM=SORT   
//SORTIN  DD DSN=input.file,...                 
//SORTOUT DD DSN=output.file,...
//SYSOUT  DD SYSOUT=*                         
//SYSIN   DD *                                                 
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),         
       IFTHEN=(WHEN=(81,8,ZD,GT,2),OVERLAY=(81:C'99999999'))
 SORT FIELDS=(81,8,CH,A,1,3,CH,A)                           
 OUTREC FIELDS=(1,80)                                       
/*                                                       

_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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