IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SORT sequence VS Release Sequence while generating report.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
morpheus007

New User


Joined: 27 Dec 2005
Posts: 58

PostPosted: Sun Mar 23, 2008 1:41 pm
Reply with quote

We have a requirement to generate a report that is sorted on a particular field FIELD1.

Following is the dummy format for data in the input file:

FIELD1 FIELD2---->OTHER FIELDS
aaaaa 12300
aaaaa 12301
aaaaa 12200
Suppose all 3 records are selected as per selection criteria.

What we would expect on the report is:

FIELD1 FIELD2 FIELD3 FIELD4 FIELD5
---------------------------------------------------
aaaaa 12300
aaaaa 12301
aaaaa 12200

What we are ending up getting for some sequences is:
FIELD1 FIELD2 FIELD3 FIELD4 FIELD5
---------------------------------------------------
aaaaa 12300
aaaaa 12200
aaaaa 12301
For other cases it does work as well.So its sort of random.

12300 and 12301 are in sequence in the file and also have aaaaa for FIELD1 and would be expected to be together yet on sorting another record with aaaaa for the sort field comes in between in some cases.This seems to differ from the order in which data was in the input file and was released to the SORT area.

I have used cobol sort and JCL SORT(for unsorted detail records without the report headers)+Program to write headers with SORTED data techniques and still find that the final SORT sequence does not necessarily seem to match with the sequence in which the Records get selected frmo the File.

Q>Please let me know if its normal to have SORT pick up at random ie if SORT has 3 records which have same values for the SORT field is it necessary or not that it writes them out in the same order as the came in or is there something wrong with the way I am coding.

This looks something like if SORT was to eliminate duplicates how does it decide which one to pick and which one to eliminate.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun Mar 23, 2008 8:18 pm
Reply with quote

Either your sort key is not defined properly or the that data is not as it is shown. Look at the data in hex and see if it is really what you think it is.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun Mar 23, 2008 8:50 pm
Reply with quote

The EQUALS or NOEQUALS option in effect determines the order of duplicate input records.

With EQUALS, the original order of duplicate records must be maintained.

With NOEQUALS, the order of duplicate records does not have to be maintained.

If you want the duplicate records in their original order, ensure that EQUALS is in effect, e.g.

Code:

//DFSPARM DD *
   OPTION EQUALS
/*


Quote:
if SORT was to eliminate duplicates how does it decide which one to pick and which one to eliminate


The first record of the duplicates is kept if EQUALS is in effect. Any one of the duplicate records can be kept if NOEQUALS is in effect.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top