Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6252859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:52:57+00:00 2026-05-24T13:52:57+00:00

Input file Layout: 01 to 10 – 10 Digit Acct# 53 to 01 –

  • 0

Input file Layout:
01 to 10 – 10 Digit Acct#
53 to 01 – An indicator with values ‘Y’ or ‘N’
71 to 10 – Time stamp
(Rest of the fields are insignificant for this sort)

While sorting the input file by splitting and eliminating duplicates in two ways result in different results. I wanna know why?

Casei: Splitting and Eliminating duplicates in the same step.

SORT FIELDS=(01,10,CH,A,53,01,CH,A)
SUM FIELDS=NONE
OUTFIL FILES=01,                                             
INCLUDE=(53,01,CH,C'Y',AND,71,10,CH,GT,&DATE2(-)),                            
OUTFIL FILES=02,                                             
INCLUDE=(53,01,CH,C'N',AND,71,10,CH,GT,&DATE2(-)),                            

Caseii: Splitting and eliminating duplicates in two different steps:

STEP:01
SORT FIELDS=(01,10,CH,A,53,01,CH,A)
SUM FIELDS=NONE

STEP:02
SORT FIELDS=COPY
OUTFIL FILES=01,                                             
INCLUDE=(53,01,CH,C'Y',AND,71,10,CH,GT,&DATE2(-)),                            
OUTFIL FILES=02,                                             
INCLUDE=(53,01,CH,C'N',AND,71,10,CH,GT,&DATE2(-)),                            

These two steps are resulting different output. Do u see any difference between both cases? Please clarify.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:52:58+00:00Added an answer on May 24, 2026 at 1:52 pm

    You are asking to sort on an Account Number (10 characters ascending) then on an Indicator (1 character ascending).
    These two fields alone determine the key of the record – Timestamp is not part of the sort key. Consequently if there
    are two or more records with the same key they could be placed in any (random) order by the sort. No telling
    what order the Timestamp values will appear.

    Keeping the above in mind, consider what happens when you have two records with the same key but different
    Timestamp values. One of these Timestamp values meets the given INCLUDE criteria and the other one doesn’t.
    The SUM FIELDS=NONE parameter is asking to remove duplicates based on the key. It does this by grouping
    all of the records with the same key together and then selecting the last one in the group. Since key
    does not include the Timestamp the choosen record is essentially a random event. Consequently it is unpredictable
    as to whether you get the record that meets the subsequent INCLUDE condition.

    There are a couple of ways to fix this:

    • Add Timestamp to the sort key. This might not work because it may leave multiple records for the same Account Number / Inidcator, that is it may break your duplicate removal requirement
    • Request a stable sort.

    A stable sort causes records having the same sort key to maintain their same relative positions after the sort.
    This will preserve the original order of the Timestamp values in your file given the same key. When the removal of duplicates occurs DFSORT will choose the last record from the set of duplicates. This should bring the predicability to the duplicate elimination process you are looking for. Specify
    a stable sort by adding an OPTIONS EQUALS control card before the SORT card.

    EDIT Comment: …picks the VERY FIRST record

    The book I based my original answer on clearly stated the last record in a group of records with the same
    key would be selected when SUM=NONE is specified. However, it is always
    best to consult the vendors own manuals. IBM’s DFSORT Application Programming Guide only states
    that one record with each key will be selected. However,
    it also has the following note:

    The FIRST operand of ICETOOL’s SELECT operator can be used to perform the same
    function as SUM FIELDS=NONE with OPTION EQUALS. Additionally, SELECT’s FIRSTDUP,
    ALLDUPS, NODUPS, HIGHER(x), LOWER(y), EQUAL(v), LASTDUP, and LAST operands can be
    used to select records based on other criteria related to duplicate and non-duplicate
    keys. SELECT’s DISCARD(savedd) operand can be used to save the records discarded by
    FIRST, FIRSTDUP, ALLDUPS, NODUPS, HIGHER(x), LOWER(y), EQUAL(v), LASTDUP, or
    LAST. See SELECT Operator for complete details on the SELECT operator.

    Based on this information I would suggest using ICETOOL’s SELECT operator to select the correct record.

    Sorry for the misinformation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input file that I want to sort based on timestamp which
This is one line of the input file: FOO BAR 0.40 0.20 0.40 0.50
I am trying to read values from an input file in Perl. Input file
This code (linke to playground: http://tinyurl.com/6ed9dyv ) var label = new qx.ui.basic.Label('<input type=file id=files
My input file's contents are: welcome welcome1 welcome2 My script is: for groupline in
Say I have an input file, and a target directory. How do I determine
I have an XML input file and I'm trying to output the result of
When reading data from the Input file I noticed that the ¥ symbom was
I need to delete my input file securely once I have finished with it,
I wanna stop the reading of my text input file when the word synonyms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.