All of the focus with OAR has been on the Web-GUI front, but as we've noted before, we think that it has great potential in other areas. As a result, for our first effort we chose to write a handler to generate IFS files. Our example doesn't do anything that couldn't have been done by an RPG program directly called the IFS APIs, or indeed that generated a work file and then invoked CPYTOSTMF to create the IFS file. But there's an elegant simplicity in being able to write directly to the IFS by adding a keyword to the F-spec for the file and using your normal write operations.
We were pleasantly surprised to find how easy it was to code the handler once we’d figured out the basic mechanics. The fact that the data is already in human-readable form was a big plus as it avoids the necessity of decoding packed decimal and binary fields. For many, the biggest challenge will be the fact that almost everything (and we mean everything) involves the use of basing pointers. OAR passes you a single parameter and the vast majority of the items in that structure are the basing pointers to the various fields and structures that you need to access. Luckily, you don't need to do any pointer manipulation, but you should be completely comfortable with the use of based structures - if you know that the rest is a breeze.
The only other thing that you should be familiar with is the use of nested-data structures and qualified data names, but then you all know about those already, right? Of course, we could’ve made the handler more complex. One obvious addition would be to optionally output an initial record containing the field names as column headings. Another would be to allow the user program to specify things such as the field delimiters (e.g., tabs instead of commas, single quotes instead of double, etc.), end-of-record characters and the code page for the IFS file. Implementing these isn’t rocket science, but it does hint at the level of complexity that’d be required should one decide to write their own 5250 handler!
We’ll be working on other handlers soon and hope to see others publish their own efforts. Much can be done, but the code won't write itself!
If you have any suggestions for handlers that you think would be useful, please let us know via the comments. We'd rather spend time on routines that will be useful to others than just play around for the fun of it.
As it happens, Susan will be teaching OAR at the Ocean User Group conference on Friday of this week. If you live in the area and haven't already booked for the event, come and join us! If you're already registered we look forward to seeing you there.





Recent Comments