Programming alternatives, Part 2

Python is capable of object oriented programming (and in fact it is designed around the paradigm that everything is an object) but don’t let that worry you; you can write purely functional or procedural programs in it and never worry about methods and abstractions. A Unix shell is just a command line interface and environment with some basic functions, similar to the DOS shell in Windows (except more powerful). If you open a Terminal on macOS, it is giving you a Unix shell (generally the ‘bash’ shell). There are also web-based graphical shells for Python like the Jupyter Notebook which can be quite useful, but it’s an additional thing you have to learn. The IPython shell (installed on macOS by default) is easy enough to start learning with.

I think that is supposed to be some kind of online interpreter that doesn’t seem to be working. Just cut and paste the text into an IPython shell (literally open a Terminal and type ‘ipython’) and the code should work fine. There are online live training options and code camps you can go to, but just following along with some tutorials should get you some familiarity. The fundamentals of Python are as easy to learn as BASIC, and the language is far more functional at even a very primitive level of comprehension.

Stranger

I haven’t used a DOS window since sometime in the '90s. (I had a video game that ran in DOS.) I don’t think I’ve ever opened a Terminal. I’ll need help even with that.

So… Are you recommending Python, or Perl? I know you don’t have the time to look at my sample Easytrieve, but the second piece I posted has the meat of it. Basically, the output parameter (as defined in the first piece) is either equal to a literal string, or it is equal to an input parameter (as defined in the first piece). It creates an output record in one format, and then makes another output file in a different format using literal strings, the output value from the other format, or the value of the input. It’s really, really simple. The only ‘complicated’ part is in the crossfoot calculations and in the subroutine (third piece) that changes the alphanumeric amounts to right-justified, numeric amounts with leading zeroes. (And the second part of the processing, which I didn’t post is just ‘If the account numbers match, then the output name equals the previous name, the output address equals the previous address, and so on; else write the record to a different file. If an account number exists in the previous file but not in the current file, then write the record to a third output file.’)

To open a Terminal on a macOS system, just hit Command-Spacebar and type “Terminal”. (You can open up any other application this way, too, or indeed, search for any file.) Terminal is a basic application on macOS so it is installed by default. Some people like more sophisticated shells but Terminal is really pretty good.

For what you are doing, I think Perl is the better tool, but you could do it in Python as well; it just has more to learn. Either are not that difficult to learn; even though the peculiar formatting and commands may seem intimidating at first, the fact that they are interpreted languages that you can use from the command line makes them very easy to play around with without having to learn how to use a compiler, create a namelist, or do any of the tedious administrivia of complied languages. So, just like with BASIC, you can write a few lines of code and have it give you a result.

However, if you don’t want to put that much effort into learning a language, you can hire a freelancer to do this for you online from sites like Upwork or Guru. This is a pretty trivial application and if you can formulate a specification that describes what you want the function to do, someone could probably gin up a set of scripts to do this inside of a day. Alternatively you could probably go to a local college (or even high school) and see if you can hire a student to set this up for you.

Stranger

I believe Stranger and I are both recommending Perl for this task. That is what I would use, anyway. BTW Perl has a Windows installer; also, you can run scripts from the DOS shell window (cmd), but you don’t have to.

I’ve written Perl scripts which have handled million line files with ease - and quickly also. Pythons is a more advanced language, and more popular now, but Perl is indeed easier to learn and will let you do what you want to do very easily.

I don’t have my well thumbed Perl book with me, but get one from a used book store if need be so you’ll have easy access to the powerful set of functions and examples.
I used Programming Perl and found it really good.
Perl is also good if your process communicates through a set of files. You can write individual scripts to tie things together, and a Perl script to call the other ones. I worked in a Solaris/Linux environment so the OS did this for me, but Perl is good at starting up other Perl scripts.
Things like capitalizing all of a string is trivial in Perl.
I know it is tempting to hold on to the old stuff, but it is sometimes good to move on. You’ll find that you might be able to do all sorts of stuff that Easytrieve can’t.

I agree with others that Perl is ideally suited for what you are looking to achieve. It has functions that make it pretty easy to slice/dice text, and its file handling is simple and intuitive, which are the two most important things you need based on your description of the problem.

You mention that you have a Mac at home. You have access to everything you need to do this work. If you wanted to do this on a Windows machine, you would need to install a Perl package such as ActivePerl.

Have a look at this tutorial from Stanford CS. When they say Unix / command line, that means the command line that you use in the Terminal app on your Mac.

http://cslibrary.stanford.edu/108/EssentialPerl.html

Let us know what you think. Regex looks might look daunting at first glance because it appears so arcane, but once you work with it a bit it becomes second nature.

The solution of getting someone else to do all the work does have a certain undeniable charm :slight_smile:

This is what I would recommend: http://strawberryperl.com. However, the o.p. uses a Mac and so he has Perl installed by default, because macOS is a modern operating system designed to be used by real adults. :wink:

I’m really more of an advocate for Python as it is what I use for data analysis and visualization, but for what the o.p. wants Perl is clearly the easier tool to use; in fact, this is essentially what it was designed to do. Larry Wall, the designer of Perl, was a linguist by training, and is essentially unconcerned about the underlying computer science philosophy of the language; he just wanted something that works in handling text regardless of how the programmer approaches the problem. Guido van Rossum, the designer of Python, is a computer scientist, and he wanted a language in which there was a clear singular way to approach a problem, so Python has some pretty rigorous methodology (“pythonic”) in how things should be done, although the language is flexible enough to allow you to do it in several different ways even if they are less than optimized.

Stranger

OK, that worked. So now I type something in it, right?

OK, let’s concentrate on Perl.

I don’t really understand the concept of OO programming. In sequential programming, I know where every piece of data lies in an input file. I tell the program where it is. I know where every piece of data should be in the output file. I tell the program where to put it. It’s been a long and trying day, and I’m trying to read the Wikipedia article on what OO actually is. It’s pretty alien to me. I kind of have the impression that OO programs aren’t stand-alone programs; instead, you have a bunch of subroutines and each program goes out and grabs the subroutine it needs. Or something.

Don’t worry about object oriented programming (OOP). For what you are doing, you absolutely don’t need it, and you can do purely functional programming in Perl (or Python) without invoking any objects or creating classes and methods. You can use Perl as a purely imperative scripting tool that simply acts on your data in response to command inputs without creating any objects or data structures except those that are implicit within a regex.

Stranger

I would be working in a Windows environment. I just use the Mac at home to connect to the Windows computer in Seattle.

I’ll have a look, but I don’t think I can do it tonight. As I said, long day.

That’s what I hated about FORTRAN. Like… You had to know what your output would be before you run the program. I just wanted the answers, and then I could go back and make it look pretty.

-Why are you installing an older version of Easytrieve than what you had before? Can you get the more recent version?
-What would it cost to get the maintenance contract?

I personally think trying to learn a programming language to do this stuff at this point is going to be challenging. The scripts you’ve posted are programming-like, so you have some experience. But it’ll be a big step to start with a blank page and write a program to do what you need. Not only do you have to know how to write the program, but you need to be able to figure things out when the program isn’t doing what you want (known as debugging). These tasks could be very challenging and time consuming. Or you may find it easy and natural. But from what you’ve described, I think you’d be much better off getting Easytrieve working again than trying to write your own program.

Do you have any friends or family who are programmers? If so, then I would more likely consider trying to learn programming for this task. Having someone you can work with one-on-one and who can look over your work will be a huge help and will make the project much more doable.

Running perl -v will tell you whether Perl is installed. But that is irrelevant if you are going to do all development on the Windows machine.

My first-ever Perl script probably did something like read the input file in a line at a time, do some computation/manipulation involving the text, and print out the results. For that type of job one does not need to worry about the philosophy of object-oriented programming.

The IT company took the disc to their office for safekeeping about a decade ago. I don’t know how hard they looked for it, but they found the older version on their server instead of finding the proper version, taking it off of an old computer I was given and kept so that I would have Easytrieve, or trying the flash drive on my deck.

As nearly as I can recall, a maintenance contract was $2,400/year. They wouldn’t tell me what it is now, nor would they tell, over the phone, the person who would make the transaction.

Yeah, I’d rather stick with what I know. Fingers are crossed that Projammer’s link does the trick. But it never hurts to learn new things, especially work-wise.

Usually, I would say otherwise, but since your experience is so out of date, Perl will probably be more familiar. Perl is better for you to get going quickly.

If you ever want to get back into coding, though, learn Python. Perl is going the way of the dodo.

You’re on Windows? Do you know the Command Prompt at all?

https://www.youtube.com/watch?v=MBBWVgE0ewk&list=PL6gx4Cwl9DGDV6SnbINlVUd0o2xT4JbMu

https://www.youtube.com/watch?v=QBAQ-bWEreI

You could look into FME (Feature manipulation engine) from Safe Software. It’s visual programming, with very little text. You just assemble blocks visually and tie them together with lines, and the records/lines from your data file just flow from one box to the next and get transformed, merged, etc. then written out to another file. I’ve never used it with fixed-width text, but it shouldn’t be a problem. Large user community, especially in geospatial systems. Pretty expensive, though (a few thousand bucks for a basic license). They offer trials.

Can you describe the steps of how you installed the older version of Easytrieve? Did they give you a zip or exe file?

When you ran it, did it ask for a license? From your description, it sounds like there was a trial period that expired. It sounds like it doesn’t know about your license. It may be that you just need to configure the license. How do you configure the license in Easytrieve? Is there a text field where you enter a bunch of numbers? Or is it looking for a file?

What version of Easytrieve were you originally running and what version are you running now?

Here are the instructions for installing the license key:

https://docops.ca.com/ca-easytrieve/11-6/en/installing/install-the-license-key

Has that step been done?

Our IT support contractor installed it. I don’t know what kind of files they are. I’m hoping they can use the instructions on Projammer’s link to install the key. If that fixes the problem, great; but I still think it would be a good idea for me to learn Perl. I think the version they installed was ‘R11’ or something like that. If I were in the office, I could look on the box. Shortly after receiving the software in 2007, we received an updated version. It might have been ‘R22’, but I don’t remember. ISTR there was a ‘2’ in it somewhere. The newer version has colours that make it easier to see what’s what (e.g., comments are red, literal strings are blue…) and has a Run button. The previous version is supposed to have a Run button, but it doesn’t; so I have to go to the Build tab and select Execute from the options.

ETA after preview:

[quote]

This is the link Projammer posted. I sent that to our gatekeeper after hours yesterday.

.

From everything you’re describing, it sounds like the IT contractor didn’t do the step to install the license. You may have seen this behavior with other software trials. You can download it and run it, but you’ll get a popup which says you have X days left in the trial. After the trial is over, it says you have to have a license to keep working.

Are you the only person in the company which runs Easytrieve? Are there other computers with Easytrieve installed?

I would strongly support you learning to program. Being able to write your own programs provides a huge amount of flexibility in what you can accomplish. However, I would also want to make sure you have reasonable expectations. I feel that trying to replicate the capabilities of Easytrieve will be a monumental task with your background. Especially with this being part of your job, there will be many time and capability pressures on you to get this done quickly. While I think you could do it eventually, I don’t think the timeframe is appropriate.