View previous topic :: View next topic
|
Author |
Message |
geek_mohit
New User
Joined: 19 May 2006 Posts: 23
|
|
|
|
Hi All,
A Small problem I have is I need to Sort a free form file based on last name and the last name does not always start from the same position in that sequential File.
Please let me know if and how could I do it using DFSORT.
Thanks !! |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Let's say you are going to read this file by a COBOL program. How is this program going to tell where is the "last name" field?
O. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
geek_mohit,
You need to show an example of the records in the input file and what you expect for output. Also, give the RECFM and LRECL of the input file. |
|
Back to top |
|
|
geek_mohit
New User
Joined: 19 May 2006 Posts: 23
|
|
|
|
Hi Frank,
This might be the information you require
Recfm VB
Lrecl 133
And the file is something of the Following Sort:-
Toronto,Steve Garamond
Char Hill,Orlando
605 - Madox Street,Arthur Charner
The Woodlands,Charity Thomas
I need to Extract the last names as :-
Garamond
Hill
Charner
Thomas
Thanks !! |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
What are the 'rules' for determining exactly what a 'last name' is? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
What are the 'rules' for determining exactly what a 'last name' is? |
Psychic powers?
geek_mohit,
Seriously, I can't find a pattern in your example data that would reveal how to write logic to extract the last name. In records 1, 3 and 4, it's the last non-blank "word" in the record, but record 2 doesn't fit that pattern. You have to be able to describe the "rules" for finding the last name you want before anybody can help you write logic for finding it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
From what has been posted, there do not seem to be any rules. It appears to be "free" text that may or may not contain the same collection of data fields. We're only seeing a small part of the data and what little has been posted is a coding nightmare.
What if the second entry was for a person with the first name of Orlando and the last name of "Char Hill"? What if there was a person named Madox Street? And on and on. . . .
For my $.02, i'd be interested in what created the file. Possibly that could be improved to create some kind of delimited format that accounted for all of the fields in a record - in the same order in each record. |
|
Back to top |
|
|
|