Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SORT sequence VS Release Sequence while generating report.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SORT sequence VS Release Sequence while generating report.
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    Post subject:
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 Moderator


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

PostPosted: Sun Mar 23, 2008 8:50 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Release quantity that was allocated v... Auryn JCL & VSAM 5 Thu May 18, 2017 6:02 pm
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us