Cobol internal SORT causes changes in fields
- From: ddd.best@xxxxxxxxx
- Date: 26 Mar 2006 08:23:14 -0800
Hi,
When i'm trying to sort a file with Cobol internal SORT function I have
the following problem:
My Records can have the same key, but last field in record has varying
length, and while sorting -the entry which has the longest value in it
is copied to other entries that has shorter values.
i.e:
Before sort I had: (the key here is: P100000000014125X)
P100000000014125X000026000000010100T3150
P100000000014125X000112000000030100P29091025
After sort:
P100000000014125X000112000000030100P29091025
P100000000014125X000026000000010100T31501025
The file is defined as:
SELECT S1-SORT-MATCH-FILE
ASSIGN TO dynamic WS03-FILE-NAME.
01 S1-MATCH-RECORD SYNC.
03 SORT-MATCH-RECORD-KEY .
05 SORT-MATCH-AD-ID PIC X(16) .
05 SORT-RECORD-TYPE PIC X(1) .
88 SORT-MATCH-DISPLAY-AD VALUE 'D'.
88 SORT-MATCH-ANCHOR-TO-DISPLAY-AD VALUE 'T'.
88 SORT-MATCH-HS-ANCHOR VALUE 'X'.
03 SORT-MATCH-RECORD-DATA .
05 SORT-MATCH-GALLEY-NUMBER PIC X(10) .
05 SORT-MATCH-PAGE-NUMBER PIC 9(4) .
05 SORT-MATCH-NUMBER-ANCHORED-ADS PIC 9(2) .
05 SORT-MATCH-ANCHORED-NUM-IMAGES PIC 9(2) .
05 SORT-MATCH-HS-NUMBER PIC X(16) .
and this is the way i'm doing the sort:
SORT S1-SORT-MATCH-FILE
ON ASCENDING KEY SORT-MATCH-AD-ID
SORT-RECORD-TYPE
WITH DUPLICATES IN ORDER
USING O1-MATCHING-FILE
GIVING O1-MATCHING-FILE.
So - do I have to add another field to the key in order for the sort to
work ?
Thanx !
.
- Follow-Ups:
- Re: Cobol internal SORT causes changes in fields
- From: Richard
- Re: Cobol internal SORT causes changes in fields
- From: Andreas Lerch
- Re: Cobol internal SORT causes changes in fields
- Prev by Date: Re: Any comments? (Deconstructing WBC)
- Next by Date: Re: Looking for IMS and Cobol mainframe consultant for a contract opportunity (working on IMS is complusory)
- Previous by thread: Looking for IMS and Cobol mainframe consultant for a contract opportunity (working on IMS is complusory)
- Next by thread: Re: Cobol internal SORT causes changes in fields
- Index(es):