How to move procedures between applications

There are at least two reasons why you might want to move a procedure from one application to another. Sometimes it's just a convenience, a logical reorganization because a procedure fits better in another app. Or if the procedure is in a DLL you might want to move it to avoid circular references, where a procedure in DLL A calls a procedure in DLL B that calls a procedure in DLL A. (A lot of developers live with circular references, but they're best avoided.)

In any case, the way to export a single procedure or a set of procedures is to use Clarion's TXA format. A TXA is a text representation of the information in an APP file, and it can contain all of APP's procedures as well as global data, or it can just contain the procedures you specify.

TXAs are long and difficult to read - a simple browse procedure will be over 1000 lines of text. Happily, most of the time all you need to do is export and import.

To export a TXA, load up and app and from the Application menu choose either Export Application to Text or Selective Export.

For a full export you'll be asked the name of the file, which defaults to <appname>.TXA. 

Selective export sometimes confuses developers because the export window isn't consistent with the rest of the IDE. 

Here's the Select for Export dialog:

You can sort the procedures available for export by Module, Template, Name and Category, and there's a selector entry field. 

There are buttons for selecting and deselecting, but there is no context menu. You can however double-click on a procedure to select or deselect it. The color difference is subtle when the procedure is selected, but dramatic when you move off that procedure: 

The really odd bit about this window is that to complete the export you click on the green check button in the top left corner. 

Having done so you will have a TXA file that you can import. Open your other app and choose Application | Import TXA.

When importing a TXA you must be in an application that uses the same template family (Clarion, ABC) as the TXA's application.

Importing directly from an application 

You may have noticed that there is an Import From Application option on the Application menu. If you select this you'll be asked to choose an .APP file, after which you will see the above screen. 

I feel pretty comfortable in stating that Import From Application simply does a selective export from the APP you specify, saving you the step of manually importing the resulting TXA. 

If you are recreating the entire app you will probably want to use the Application from TXA quick start:

Other TXA uses

I sometimes use TXAs for diagnostics. If there's something really weird going on in an app, such the IDE generating consistently wrong and/or uncompilable code, I'll look in the TXA for clues. Thankfully this isn't something I've had to do often, and I don't think I've run across it since the last time I imported a C6 app.

If you have any TXA tips or tricks please post them to the comments.