View previous topic :: View next topic
|
Author |
Message |
Harshavardhana
New User
Joined: 09 Mar 2007 Posts: 7 Location: India
|
|
|
|
Hi Friends,
I have a file contains many records. But I have some of the records in between other records.
Now, i want to SORT only required records - Say- if records contains 'DELETE' at some fixed position, then only these records should be sorted and written out into the output file. All other records should be written into the output file as it is without sorting.
Example: Input file
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPICRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIDRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIXRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIBRWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPILRWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIGRWD
After Cobol Internal Sort, The output file should be as follows:
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIBRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPICRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIDRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIXRWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPILRWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIGRWD
Could any one of you please help me with the COBOL coding.
Thank You. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What should happen when, after the AAAAAA set of records, there is a BBBBBB set of records. Is your requirement that all of the A's stay together or should all of the DELETEs be put together.
Please expand your input/output to include at least one more "set" of records.
The good news is that to do what you want will not be difficult once the rules are understood |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Other than the "BOLD"ing, is there a difference between the input file and the output file? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Yup, notice the sequence change in the DELETE records. . . |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
DANG! you must have the eyes of a young'n.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
IEBIBALL to the rescue. . . . |
|
Back to top |
|
|
Harshavardhana
New User
Joined: 09 Mar 2007 Posts: 7 Location: India
|
|
|
|
Hi dick scherrer,
Thank You for your response. In the example I have mentioned, there is no problem if I have another set of records as BBBBB.
Only I need is all steps that are having DELETE should be sorted for the datasets followed by DELETE. Rest of the records should be written to output file as it is without change. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Harsh,
I don't believe i follow your most recent post. This
Quote: |
I need is all steps that are having DELETE should be sorted for the datasets followed by DELETE |
has me confused. . .
Please post your original input data and a set of BBBBBBs as a new input file and the desired output from the expanded input sample. |
|
Back to top |
|
|
|