CFOG's PIP, March 1989, Volume 8 No. 1, Whole No. 69, page 7

The 'Tilde' Problem in PC-File-80: A Solution

by Benjamin H. Cohen

PC- File 80 offers a 'flip data' character, the tilde (~), which allows you to enter data in 'reverse order' so that it will sort correctly, but also print the later part of the record first. Perhaps the most obvious use for this is a name field where PC-File 80 allows you to enter Cohen~Ben so that all the names will sort correctly but in reports and on labels it will print Ben Cohen. The advantages of using this are: (1) you have one field instead of two, reducing the index size by two bytes for every record and (2) you generally need fewer bytes for the combined name field than you would need for separate first name and last fields, since folks with long last names generally have shorter first names, and vice versa.

But some folks don't anticipate all the uses of their databases and wind up wanting later to print a list that has all the last names lined up so they can scan the alphabetical list easily. They want it to look like this:

Ben Cohen
Jonathan Harrison Smith
Sam Smith

rather than:

Ben Cohen
Jonathan Harrison Smith
Sam Smith

Unfortunately, PC-File won't let you have it both ways. But you can change from one to the other.

If your file has last_name~first_name, the solution is to export the file to a MailMerge or comma-delimited format. On export PC-File 80 will NOT reverse the order of the names and will export the tilde. So each record will look like this:

"Cohen~Ben","Box 1674","Chicago","IL","60690"

Now, all you have to do is to edit the file with any ASCII editor: WordStar in non-document mode or VDE in non-document or ASCII mode will do fine. Do a global replace, taking out the tilde and replacing it with "," [that's quote, comma, quote]. Now your record will look like this:

"Cohen","Ben","Box 1674","Chicago","IL","60690"

Go back to PC-File 80. Define a new database. The definition will be exactly the same as the old one EXCEPT that instead of a single NAME field you will have a LAST NAME field and a FIRST NAME field. Select field lengths appropriate to your data.

When the new database is ready, go to the UTILITIES menu and select the import a database option. Complete instructions are in the manual. Now your database has first and last names separately laid out

To combine last and first name fields with a flip data character, you again export the database. This time you replace the "," between the last and first names with a tilde and define a new database with ONE name field. This is best done with a macro (WordStar shorthand) that goes to the beginning of the line and replaces the first "," only, goes down one line, to the beginning of the line, and repeats. When this is done, import the data file.

There's actually a second way to get the kind of report you want, without changing your database, IF you have WordStar, Magic Series, or word processing program or formatter that lets you set fixed tab locations or overprint the next line. You still have to export the database and replace the tilde with ",". Then you use the WordStar "Overprint next line" command, CTRL PM, to format the report so that each record prints on one line in a separate column. Magic Series for daisy wheel printers can go back a line to print the last name where you want it and the laser printer version can set fixed tabs.

The article above was written in response to a query by a PC-File 80 user. I got a letter back from him with another, simpler method. He simply used the old shareware version 8.6 of PC-File. That version doesn't recoginize the tilde as a flip-data character, so it prints the list "Lname~Fname".