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 

Sorting A File having Groups of records

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


Joined: 07 Sep 2007
Posts: 1
Topics: 1

PostPosted: Thu Apr 02, 2009 1:34 am    Post subject: Sorting A File having Groups of records Reply with quote

Hi,

I have a file in the following format:
Code:

USERAL    012CD  ABDC
          00B1    XYZ
          012D7  PQRS
USERTT    00MN   WER
          00KB   KRISHNA
          00BS   RAM   


USERAL and USERTT are aligned
Requirement:
If the following record is inserted in the file at the end
Code:

USERAL    1214  VISWA 

On sorting the file, the file should look like this:
Code:

USERAL    012CD  ABDC
          00B1    XYZ
          012D7  PQRS
USERAL    1214  VISWA
USERTT    00MN   WER
          00KB   KRISHNA
          00BS   RAM

Kindly let me know if this can be possible through DFSORT? Any solutions will be really helpful

Thanks
Viswanathan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Apr 02, 2009 10:18 am    Post subject: Reply with quote

vishysblue,

Concatenate the last record that you want to append to your SORTIN. You can very easily push the header using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

I assumed your input to be FB and LRECL 80
Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
USERAL    012CD  ABDC                                           
          00B1    XYZ                                           
          012D7  PQRS                                           
USERTT    00MN   WER                                           
          00KB   KRISHNA                                       
          00BS   RAM                                           
//         DD *                                                 
USERAL    1214  VISWA                                           
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  OPTION EQUALS                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,NE,C' '),PUSH=(81:1,6))
  SORT FIELDS=(81,6,CH,A)                                       
  OUTREC BUILD=(1,80)                                           
/*


If you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).

For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
Kolusu
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 -> 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