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 

Can I only sort parts of the input file with DFSORT?

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


Joined: 13 Feb 2006
Posts: 31
Topics: 17

PostPosted: Mon Jul 02, 2007 4:44 am    Post subject: Can I only sort parts of the input file with DFSORT? Reply with quote

hello,

I am trying to sort a file with the first character for all the rows in the file but only want to sort the other fields when the first character equals to 'D'.

e.g. the input file is like this

Code:
----+----1----+----
B1
T2
DAAA
T1
T4
B3
E9
DCCC
DBBB



What I want to do is -

1. Sort by the 1st character.
2. Sort the other fields (col 2-4) when the 1st char is 'D'

So the expect output file is -

Code:
----+----1----+----
B1
B3
DAAA
DBBB
DCCC
E9
T2
T1
T4



Can this be implemented by DFSORT?

Thank you!!
_________________
Dragon
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jul 02, 2007 6:17 am    Post subject: Reply with quote

Try this job

Code:

//STEP0100 EXEC PGM=SORT               
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD *                       
B1                                     
T2                                     
DAAA                                   
T1                                     
T4                                     
B3                                     
E9                                     
DCCC                                   
DBBB                                   
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                       
  SORT FIELDS=(01,01,CH,A,             
               81,03,CH,A)             
  INREC IFTHEN=(WHEN=INIT,             
       OVERLAY=(81:3X)),               
        IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),
       OVERLAY=(81:2,3))               
                                       
  OUTREC FIELDS=(01,80)               
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Maximus
Beginner


Joined: 17 Nov 2005
Posts: 21
Topics: 11

PostPosted: Mon Jul 02, 2007 7:17 am    Post subject: Reply with quote

Hi kolusu,,

I tried the above job, but the out is same as input, No change.

cheers
Maximus
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jul 02, 2007 7:30 am    Post subject: Reply with quote

Quote:

Hi kolusu,,
I tried the above job, but the out is same as input, No change.


Maximus,

Show me your sysout messages. Just for clarification , I ran the job as is and I got the following output.
Code:

B1   
B3   
DAAA 
DBBB 
DCCC 
E9   
T2   
T1   
T4   


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Mon Jul 02, 2007 10:30 am    Post subject: Reply with quote

Kolusu's job works correctly except that you might need to add the EQUALS option.

Here's a slightly simplified version of the DFSORT job. Note that we're assuming the input file has RECFM=FB.

Code:

//S1 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
B1                                                     
T2                                                     
DAAA                                                   
T1                                                     
T4                                                     
B3                                                     
E9                                                     
DCCC                                                   
DBBB                                                   
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),                 
       OVERLAY=(81:2,3))                               
  OPTION EQUALS                                       
  SORT FIELDS=(1,1,CH,A,                               
               81,3,CH,A)                             
  OUTREC FIELDS=(1,80)                                 

_________________
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
Maximus
Beginner


Joined: 17 Nov 2005
Posts: 21
Topics: 11

PostPosted: Tue Jul 03, 2007 3:54 am    Post subject: Reply with quote

Hi kolusu,

I am absolutely sorry,

It my mistake your sort card is working fine.

Maximus
Back to top
View user's profile Send private message
Dragon_Lee
Beginner


Joined: 13 Feb 2006
Posts: 31
Topics: 17

PostPosted: Tue Jul 03, 2007 8:36 am    Post subject: Reply with quote

Thank you all!!!

The SORT card working fine 8)
_________________
Dragon
Back to top
View user's profile Send private message
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