<< I don't think this procedure (as written) is properly encapsulated.
This procedure was not a finished product. It is a work in progress. I am currently working on 3 major projects within the company using 3 - 4 different languages. All I was stuck on was determining the length of the data that I was interested in at the time. I was not asking anyone to analyze what I was trying to accomplish in the end. Please forgive me for forgetting about %size() at that particular moment. Both Adam and Scott reminded me with their first answers and I was able to continue creating the procedure and I do thank them. I do not have the privilege of having someone sitting beside me to look at my code and tell me what I've missed so I asked the list. I'm certainly glad that others on the list have never forgotten about some API that they don't use all the time and so don't need anyone to remind them.
This is not a stand alone program. It is a sub procedure in a larger service program. To use it the caller WILL have to know the file and/or data structure he is dealing with.
Understanding the procedure and what it does is part of the documentation that is written in the header portion of the procedure which I do write, I just didn't include this with my code sample. (As I stated above, I'm not finished writing the code)
I guess I could have named the variable something like ThisIsTheFieldFromTheDataFileThatWasDefinedInTheCallingProcedure... but this is just ridiculous. I feel that a varible named FieldToCheck would tell someone that this is the field that is being checked and not some obscure value that no one would ever be able to determine where it came from.
As far as maintaining this procedure, if it is tested and debugged properly and fully there should be no need to change it 6 months or 6 years down the road. When any API is written all you need to know is how to use it and what values to use, you do not maintain the code within the API. (All an API is after all is a procedure that is called by your program and you need to know what values to use as parameters)
<< I would use SQL to read through the file, and actually pass in the name of the column that you want to compare, along with the comparison value.
Well this is similar to what the SQL statement would DO. The SQL statement is itself only a call to a procedure. The code I'm writing is not the call to the procedure but the procedure that is called.
<< Sorry, your code does NOT pass the name of the field. If you think it does, then you don't even understand what your code does.
What it does is pass the ADDRESS of the field. That's what the %addr()
is for, it passes the address of the field. How the heck did you write
your code at all if you didn't understand this?
<<
I really didn't want to get into a discussion of what my code wanted to accomplish in the end. All I needed was a reminder of an API ( %size() ) that in the heat of the moment I'd forgotten about. I know that at times I am not able to explain things to others that make sense to me but if I could do that I would probably be writing books instead of programming. (Not to say book writers aren't programmers, just that I myself don't write books)
Insinuating that I have no idea as to how to write code was just being vicious.
It would be great if I could sit down and write code that is perfect from the start, but I am not in that category (I don't write code in my sleep) and I do miss something every once in a while.
I apologies to the list for taking up some of their time on something that seems so stupid to the rest of you and be assured that I won't bother the list again with such trivial matters.
******************************************
Don Wereschuk
ISD - Programmer/Analyst
Simcoe Parts Service Inc.
Phone: 705-435-7814 Ex: 302
Fax: 705-435-6746
mailto:dwereschuk@xxxxxxxxxxxxxxx
******************************************
"Save the Cheerleader - Save the world" - Hiro Nakamura
________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.