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 

SORT does not really sorting...

 
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
arshadh
Beginner


Joined: 10 Jan 2007
Posts: 33
Topics: 12

PostPosted: Thu Jun 21, 2007 9:49 am    Post subject: SORT does not really sorting... Reply with quote

The following is my input file....

Code:
******************
001  053000196
001  053100025
005  053200064
005  053900377
808  073000176
808  073900865
808  073918598
808  073920748
318  121000358
319  122000661
722  081000032
722  081500875
722  081514146
722  081918030
722  086500087
722  101000035
722  101200929
722  101901655



I use the following control card
Code:

//STEP05   EXEC PGM=SORT
--
--
//SYSIN    DD *           
    SORT FIELDS=(8,9,BI,A)
    SUM FIELDS=NONE       
/*                         


But still i dont get items sorted... I get the same file as output(ouput GDG).

My desired output is


Code:

001  053000196
001  053100025
005  053200064
005  053900377
808  073000176
808  073900865
808  073918598
808  073920748
722  081000032
722  081500875
722  081514146
722  081918030
722  086500087
722  101000035
722  101200929
722  101901655
318  121000358
319  122000661



Help me getting it sorted...
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jun 21, 2007 10:00 am    Post subject: Reply with quote

arshadh,

I use the following control card
Code:
Quote:

//STEP05 EXEC PGM=SORT
-- <<<<<what is here????
--
//SYSIN DD *
SORT FIELDS=(8,9,BI,A)
SUM FIELDS=NONE
/*


what is the missing JCL, especially the DD statements!!!!
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jun 21, 2007 10:21 am    Post subject: Reply with quote

Arshadh,

If this is your input file and it is of RECFM=FB, then I have a problem in your SORT statement.
Code:

******************
001  053000196
001  053100025
005  053200064
005  053900377


When you say (8,9,BI) - Col 8 starts with 300196bbb (3 blanks at the end). First of all this is not a valid Numeric Binary field (unless you are considering the spaces and any alpha as part of binary).

Tell us what your actual requirement is and what are the DCB parameters of your input file.

If your intention is to sort the second field (starting with 053000196) then you must be using SORT FIELDS=(6,9,ff,A). (ff = ZD / CH / BI) - Btw, if your second field is pure numeric then its better to use ZD (to avoid confusion).

Thanks,
Phantom


Last edited by Phantom on Thu Jun 21, 2007 10:27 am; edited 2 times in total
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: Thu Jun 21, 2007 10:24 am    Post subject: Reply with quote

arshadh,

The field you want to sort on appears to start in position 6, not position 8, so you need

Code:

   SORT FIELDS=(6,9,BI,A)
   SUM FIELDS=NONE


When I used that sort statement with the input data you showed, I got the output data you said you wanted.
_________________
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


Last edited by Frank Yaeger on Thu Jun 21, 2007 10:26 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jun 21, 2007 10:25 am    Post subject: Reply with quote

One more point - Please post your queries in the right forum. We have a dedicated forum for Utilities which includes SORT.

Thanks,
Phantom
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jun 21, 2007 10:32 am    Post subject: Reply with quote

Frank, Phantom,

even with the missed-declared sort keys, he would not get an output = input.

I believe his problem is
Quote:
I get the same file as output(ouputGDG).

_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
arshadh
Beginner


Joined: 10 Jan 2007
Posts: 33
Topics: 12

PostPosted: Thu Jun 21, 2007 10:53 am    Post subject: Reply with quote

Sorry all,
Code:

*****************************
  001  053000196             
  001  053100025             
  005  053200064             
  005  053900377             
  808  073000176             
  808  073900865             
  808  073918598             
  808  073920748             
  318  121000358             
  319  122000661             
  722  081000032             
  722  081500875             
  722  081514146             
  722  081918030             
  722  086500087             
  722  101000035             
  722  101200929             
  722  101901655             
  722  101918237             


The jcl
Code:

//STEP05   EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=NBK2P9G.ABART3S.OUTPUT.NODUPL(-2),DISP=SHR   
//SORTOUT  DD DSN=NBK2P9G.ABART3S.OUTPUT.NODUPL(+1),           
//            DISP=(,CATLG),                                   
//            DCB=(BLKSIZE=0,RECFM=VB,LRECL=20),               
//            SPACE=(CYL,(100,40,),RLSE)                       
//SYSIN    DD *                                               
    SORT FIELDS=(08,9,BI,A)                                   
/*                                                             


first 2 bytes are for record lengt.
next 3 bytes data
next 2 bytes is teh length part of varchar
next 9 bytes are teh test part of varchar.
Back to top
View user's profile Send private message
arshadh
Beginner


Joined: 10 Jan 2007
Posts: 33
Topics: 12

PostPosted: Thu Jun 21, 2007 10:54 am    Post subject: Reply with quote

sort in can be any previous file it can be 0 or -1 or -2
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jun 21, 2007 11:11 am    Post subject: Reply with quote

Arshad,

for VB files, the record length (so called - RDW - Record Descriptor Word) is 4 bytes and not 2. So, this makes the SORT position wrong again.

Thanks,
Phantom
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: Thu Jun 21, 2007 12:47 pm    Post subject: Reply with quote

Quote:
even with the missed-declared sort keys, he would not get an output = input.


Yes, I noticed that but I assumed he was just mistaken about what the bad output looked like. Maybe not a good assumption.

Quote:
for VB files, the record length (so called - RDW - Record Descriptor Word) is 4 bytes and not 2. So, this makes the SORT position wrong again.


Right. So if the position of the field to be sorted not counting the RDW is 8, then the actual position would be 12 (8+4 for the RDW):

Code:

    SORT FIELDS=(12,9,BI,A)

_________________
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
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jun 21, 2007 1:09 pm    Post subject: Reply with quote

Quote:
I believe his problem is:
Quote:

I get the same file as output(ouputGDG).


poor problem determination on my part!
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
arshadh
Beginner


Joined: 10 Jan 2007
Posts: 33
Topics: 12

PostPosted: Wed Jul 11, 2007 11:41 pm    Post subject: Reply with quote

Dear All,
The Problem is solved . I used +4 bytes logic (File type VB) and it worked well.Thnks for all who helped in this...
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 -> 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