Over the past few months I’ve become quite a tool builder.
The project I’m currently on involves a lot of really repetitive code changes and analysis … basically I’ve been externalizing as much of the text in the product as I can (to message files). There are a LOT of display files to be analyzed … and this particular task looked like it was going to be very very very boring.
However … rather than trying to analyze each and every display file for text that can be externalized, I wrote a set of programs that would automate the process for me.
The first program read through each display file source member in a source file, parse the DDS, and write a file that contained the source member information; line number; text; length; and other useful bits. Obviously this program had to be aware of DDS continuation characters.
The next program would read through the file created in the first program and automatically generate messages in a message file that contained the text extracted from the DDS and recorded the generated messages id.
The final program in the set re-processed the source members … commenting out the lines where the hard coded text existed, and adding a duplicate line that replaced the text with a dummy field and the MSGID keyword (with the message id assigned to the text).
So now you’re thinking: Yeah, so? What’s your point?
My point is this … when you’re presented with a repetitive task that could be seriously mind numbing … consider making it more interesting by building a tool to do the job for you. Chances are you’ll get it done faster … and it will clearly be more interesting. You might even learn something along the way.
As more tasks on this project are assigned to me … I always try to figure out if a tool would get the job done faster. This has been the case more often than not.
Just for this project, I’ve written additional tools to …
- Convert single byte Japanese text to double byte Japanese text.
- Identify compile time arrays in RPG programs (not convert them to messages though)
- Compare two message files for additions and changes
Each tool presented it’s own set of problems … and ended up being quite engaging to write.