Computer Store
store.prestwood.com
-Collapse +Expand
Tech
Search Tech Group:

Advanced
-Collapse +Expand Tech Store
PRESTWOODSTORE

Prestwood eMagazine

July Edition
Subscribe now! It's Free!
Enter your email:

   ► KBComputer TechSoftware   Print This    All Groups  
 
Tech Software:
The US Government DO NOT CALL Download Files Should Be Structured Better
 
Posted 15 months ago on 4/20/2019
Take Away:

This article discusses why I think the US government’s DO NOT CALL download data files should be structured better so most people can import them into commonly used database programs.

KB103858

One of the things I do for my custom software design business is telemarketing. In this day and age, one must be compliant with The US government’s DO NOT CALL registry. Once every 31 days, you as a telemarketer, are supposed to download the DO NOT CALL list telephone number data files segmented by telephone area code.

The phone number lists I download are actually quite simple. It is just the area code and the phone number. The problem is with the way the data is structured. It is just contiguous data with no delimiters, line feeds or carriage returns separating each phone number. Most database programs, i.e. Access, Foxpro, Paradox, etc. are not able to import a format like that. They are designed to import text files with line feeds and carriage returns that are delimited with tabs, double quotes or something that the importing utility can recognize. Obviously, they also import database files and excel spreadsheets, but for purposes of this discussion we will keep the topic confined to text files.

Now, if you are a coder like me, then you can easily create an application in VB, C#, C++ or some other programming platform that will restructure the data file format into a delimited TXT or CSV file that most database programs can recognize and import. This is how I do it in C Sharp to restructure the DO NOT CALL area code segmented text file into a compatible format for importing:

                // if it exits, remove the new delimited text file name we are about to recreate.

                if (File.Exists(currdir + "216areacode_new.txt"))

                {

                    File.Delete(currdir + "216areacode_new.txt");

                }

                // open a file stream to the new delimited text file we will write.

                FileStream fstreamobj216 = new FileStream(currdir + "216areacode_new.txt", FileMode.Append);

                StreamWriter writerobj216 = new StreamWriter(fstreamobj216);

                // get the size of the DO NOT CALL text file.

                FileInfo datafileinfo216 = new FileInfo(currdir + "216areacode.txt");

                sizeofdatafile = datafileinfo216.Length;

                if (sizeofdatafile > 0)

                {

                    // open a file stream to read from the DO NOT CALL text file.

                    FileStream fileStream = new FileStream(currdir + "216areacode.txt", FileMode.Open);

                    BinaryReader br = new BinaryReader(fileStream, new ASCIIEncoding());

                    // initialize the character array to hold each phone number.

                    for (a = 0; a < AREACODELEN - 2; a++) recordatavar_areacode[a] = (char)32;

                    datafileoffset = 0;

                    do

                    {

                                

                        // grab 12 bytes and then convert for storage to a string variable.

                                               

                        br.BaseStream.Seek(datafileoffset, SeekOrigin.Begin);

                        chunk = br.ReadBytes(12);

                        str = System.Text.Encoding.Default.GetString(chunk);

                        if (str.Length == 12)

                        {

                                        

                            // convert the string variable to a character array and insert double quotes and commas

                            // so it will become a double quote, delimited text file record as it is written to the file stream

                            // of the new data file to be imported later on.                                       

                                        

                            char_for = str.ToCharArray(0, 12);

                            recordatavar_areacode[0] = (char)34;

                            recordatavar_areacode[1] = char_for[0];

                            recordatavar_areacode[2] = char_for[1];

                            recordatavar_areacode[3] = char_for[2];

                            recordatavar_areacode[4] = (char)34;

                            recordatavar_areacode[5] = (char)44;

                            recordatavar_areacode[6] = (char)34;

                            recordatavar_areacode[7] = char_for[4];

                            recordatavar_areacode[8] = char_for[5];

                            recordatavar_areacode[9] = char_for[6];

                            recordatavar_areacode[10] = char_for[7];

                            recordatavar_areacode[11] = char_for[8];

                            recordatavar_areacode[12] = char_for[9];

                            recordatavar_areacode[13] = char_for[10];

                            recordatavar_areacode[14] = (char)34;

                            writerobj216.WriteLine(recordatavar_areacode);

                        }

                        // circle around until all the phone numbers in the DO NOT CALL input data file have been processed.                          

                                           

                        datafileoffset = datafileoffset + 12;

                    } while (datafileoffset < sizeofdatafile);

                    // close up everything, we are done!

                    br.Close();

                    fileStream.Close();

                    writerobj216.Close();

                    fstreamobj216.Close();

                }

This code processes the DO NOT CALL data file from the US government for area code 216. The input file name, "216areacode.txt", was renamed from the actual downloaded input file, but that is minor stuff. So that is my way of handling it and it works very well.

But what if you are not a coder? It can add up to MAJOR $$$ from having to pay someone like me to do this for you every 31 days! And that leads me to my point. The US government should have already formatted their DO NOT CALL download files into a CSV, delimited text file, DBF, XLS or some format that can easily be imported into a software package. This is quite easy for them to do and they know it.

So I can only speculate as to why they did not do it. Maybe they are trying to make it hard for people, which is understandable, since the Federal government is known for bureaucracy and making things harder for folks to get things done. Or perhaps this was their idea of creating more billable hours for coding geeks like me. Whatever the case, this is a difficulty that could otherwise be easily overcome so you as an end user of the DO NOT CALL data files would and should have an easier time of it.


Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P136A1
Enter key:
Article Contributed By Douglas.M:

Please visit my software developer website for more information about my services. I offer application development as well as Android app coding services. My developer skills are best suited to dealing with custom software projects. I can perform programming for Corel Paradox as well as C# Sharp and PHP.

In my local area of northeast Ohio, I can cater to computer repair and "fix my computer" issues.

Use my contact web page today to reach me about any software design ideas you have.

Visit Profile

 KB Article #103858 Counter
214
Since 4/20/2019


©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech