View previous topic :: View next topic
|
Author |
Message |
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
Hi,
I have written a program to read from flat file and write to KSDS file and I see the records in KSDS file is not in sorted order.
Any reason for this ?
Regards,
Ravi |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Why would you expect them to be? They are accessed through the index. |
|
Back to top |
|
|
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
I want the records in KSDS to be in sorted order.
After writing every record it should be in sorted order |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The records on a KSDS are in the order established by the primary key.
If they are not, then you are not looking at the primary key, or you are not looking at a KSDS.
Any other data outside the primary key is irrelevant to the order of the records.
This doesn't relate to your earlier questions does it? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
What do you intend to do that requires the data to be in a certain order? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
To guarantee a proper sorted-order, SORT the flat file by the designated primary-key (which you have defined in the VSAM Base Cluster), then REPRO directly into the KSDS.
Is this an option? |
|
Back to top |
|
|
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
The records in flat file is as below
Key length is 65
Code: |
02 XXXXXXXXXXX20200201304012014040101201481293930
03 PX XX 2013040100 XXXX XXXXXX XXXXXXXXXXX:
03 TY XXX2013011400 XX47 YY XXX >15 < YYYK
12AC0000 Jen: XXX XXXXX
12AS0000 98
12SI0000 01110 YYYYY40
45 0001 0320120130401120130401 0000 |
After writing to KSDS its like
Code: |
02 XXXXXXXXXXX20200201304012014040101201481293930
45 0001 0320120130401120130401 0000
12AC0000 Jen: XXX XXXXX
12AS0000 98
03 PX XX 2013040100 XXXX XXXXXX XXXXXXXXXXX:
12SI0000 01110 YYYYY40
03 TY XXX2013011400 XX47 YY XXX >15 < 100K |
Code'd |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I want the records in KSDS to be in sorted order. |
Then sort them before writing them to the vsam file . . .
As Akatsukami asked - what requires them be physically "in order"? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
What's the record-position in the flat-file where the primary-key can be found? This is the sorted order you need and invoking SORT to sort these records, allows you to REPRO the records directly into the VSAM KSDS in the proper order.
Am I missing something? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Please use Code tags when posting your records and show us the IDCAMS listcat showing the Relative Key Position (RKP) and key length. Remember that the RKP is relative to zero, not one. |
|
Back to top |
|
|
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
Ok let me ask this way..
After writing records to KSDS file does the records will be in sorted order ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Not if you do not sort them before writing/loading them into the file. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Addon . . .
You still have not explained WHY you think this is needed . . . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It is a KSDS. It will be in primary key order. It is always best when adding records to a KSDS to have them sorted in key order, but it will make no difference.
A KSDS, assuming successfully written, will be in key order, no matter the order of the input.
You must show a LISTCAT for your (alleged) KSDS.
It is beginning to smell of Troll. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Bill,
Quote: |
It is beginning to smell of Troll. |
Or TS must hear "it" in his terms - even thought they are not the proper terms . . .
And Still will not post Why this is "needed" . . .
Quite disappointing start for a new year
d |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
raviprabhu,
Somewhere, there is a 'DEFINE' for that KSDS to which you are writing. In that DEFINE, there is a KEYS parameter.
Can you tell us what that KEYS parameter looks like?
I'm asking because when you load a KSDS, the records will get sorted based on the contents of the record that is pointed to by the KEYS parameter.
It sounds a lot like you have two different definitions of the 'key' for this file. One is your SORT key, and one is your KSDS key. |
|
Back to top |
|
|
|