Page 1 of 2

SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 6:13 pm
by tivrfoa
Hi, happy new year everyone.

I'm following DFSORT tutorial. I have this dataset:
COMPUTER LANGUAGES MURRAY ROBERT FERN COMP 561
LIVING WELL ON A SMALL BUDGET DEWAN FRANK COR 108
...

The problem is that SEQNUM is get "aleatory" occurrence and not the first occurrence.
Like, the first occurence for COMP should be 00000001, but I'm getting 00000009 instead.

//SYSIN    DD *

  INREC FIELDS=(01:57,05,X,63,04,UFF,EDIT=(TTTTT),SEQNUM,8,ZD)
  SORT  FIELDS=(01,05,CH,A)
  SUM   FIELDS=(08,04,ZD)

/*


Thanks folks.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 7:05 pm
by BillyBoyo
You are adding a sequence number to the unsorted data. The record which appears first, is that which has the lowest "collating" value for columns one to five (57,5 on your input). If that happens to be the ninth record on your input file, then you will get nine as your first sequence number.

If you want sequence numbers on the output, in number order, change INREC to OUTREC, which will also only process records after the SUM has operated and removed any duplicates.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 8:54 pm
by NicC
Why do you think that there is a section of the forum entitled Syncsort/Synctool? Just so that you could ignore it? Both topics moved.

Also note that DFSort is NOT the same as Syncsort although there is a high degree of compatability.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 8:59 pm
by tivrfoa
ops xD sorry NicC. I didn't even look, because I was reading a topic in DFSORT and the question was about Syncsort and the moderator replied to post Syncsort questions in the JCL forum ...
BillyBoyo wrote:You are adding a sequence number to the unsorted data. The record which appears first, is that which has the lowest "collating" value for columns one to five (57,5 on your input). If that happens to be the ninth record on your input file, then you will get nine as your first sequence number.

Hi. Lowest "collating"? I don't understand, because this is the field that I'm using to group by the sum and sorting, so the value in the first and ninth records are the same:
First: 000001 COMPUTER LANGUAGES MURRAY ROBERT FERN COMP 561
Ninth: 000009 NUMBERING SYSTEMS BAYLESS WILLIAM FERN COMP 486

Thank you.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 9:15 pm
by Akatsukami
tivrfoa wrote:Hi. Lowest "collating"? I don't understand

Collation.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 9:25 pm
by tivrfoa
Akatsukami wrote:
tivrfoa wrote:Hi. Lowest "collating"? I don't understand

Collation.

Hi, thanks, but did you stop reading in the word "understand"? How does the link help here?

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 9:46 pm
by BillyBoyo
tivrfoa,

Sit down with a SyncSort manual. Find the place where it shows a diagram of how the different parts (ie INREC, SORT, SUM, OUTREC, OUTFIL) relate to each other.

What did you not understand? You are putting the sequence numbers on the unsorted data. Then SORTing the data. Then you SUM the data, which will consolidate records with equal keys, using the first record of that key from the output of the SORT.

Now, what were you expecting? Sequence number one for the first output record? Well, if the data has the lowest key in the collating sequence as the first record, and that particular key is not duplicate, then your first output record will be one. The second will likely not be two, however.

Also look at EQUALS and NOEQUALS to with regards to how SUM works.

If you don't give enough information to give a definitive answer, then you have little expectation to be able to quibble about what any comment that anyone makes.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 10:07 pm
by tivrfoa
BillyBoyo wrote:What did you not understand? You are putting the sequence numbers on the unsorted data.

The first record in the input dataset is:
000001 COMPUTER LANGUAGES MURRAY ROBERT FERN COMP 561
But it is giving a sequence number of the second occurence, which in this case is line nine:
000009 NUMBERING SYSTEMS BAYLESS WILLIAM FERN COMP 486
BillyBoyo wrote: Now, what were you expecting? Sequence number one for the first output record?

I was expecting the sequence number for COMP to be 00000001 instead of 00000009.
I understand that the first output record will have a sequence number that corresponds to its first occurence in the input dataset.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 10:15 pm
by BillyBoyo
You are not putting a sequence number on the output data.

KEY1 00000001
KEY2 00000002
KEY1 00000003
KEY3 00000001


When you SORT, with equal keys, the order of your output depends on EQUALS/NOEQUALS. You have SUM, which also will give potentially different results depending on EQUALS/NOEQUALS.

Unless you are specific about what you want, that's about it. You are numbering on the input, sorting, and then wondering why you don't get your output in number sequence. You have put the sequence numbers on the unsorted data, then SORT it - how would you expect the sequence numbers to be in order? Then, within the same key, you have not bothered to look up EQUALS/NOEQUALS.

If you're not going to explain what you want, clearly and fully, and you're not going to take advice, then I'm not sure how we can help.

Re: SyncSort - Inserting Sequence Number

PostPosted: Wed Jan 02, 2013 10:28 pm
by dick scherrer
Hello,

Suggesst you post the first 15 records (using the Code tag andleaving out the "bold" and the "first: / ninth:" designation and the output you want when the process is run (again with the Code tag). Use the Preview function to see your post as it will appear to the forum and when it looks as you wish, Submit.