Migrating Clarion App using AI to a new tech stack like Java/Angular

Hi everybody,

We have an old, minimally documented Clarion 6 app that we are gradually migrating to a new Java/Angular tech stack.
We are using the same MS SQL DB for both the old and the new app, so no changes there.

We’ve made a code generator that can generate basic browses and forms in the new tech stack based on the DB to speed things up, but it’s still a relatively slow process.

Now we are looking for a way to use AI tools, ideally GitHub Copilot, which we have licenses for, to speed up the migration.

Does anyone have experience with using AI to migrate Clarion to a new tech stack?
What approach, and concrete steps would you recommend in this scenario?

One observation I saw with CoPilot last year, it was quoting my own code in its answers from a hidden github repo of mine that was work in progress and thus buggy. That didnt help me at the time.

It doesnt matter too much if its Ai or a new team of coders proficient in Java/Angular, the same points and issues relevant when porting to a new code base apply regardless.

The difference between Ai or a team of proficient coders, is the Ai will suggest something you have to try to see if it works, the team of proficient coders will suggest something they already know works.

Good luck and keep us informed of progress if you dont mind.

2 Likes

Well, I don’t, but tell us a little more about the project.

Do you have the source code? I suspect AI will work better with the generated appname.clw files which AI should be able to read, but I don’t know if it will make any sense of it?

If you don’t have the source code then I think you are SOL, you may as well just work with the client and rewrite the app.

Yes, we have the Clarion source code, and I also believe that AI will have a much better chance of understanding .clw files (textual) than .app files (binary).

Our devs are proficient in Java and Angular, and they know how to read and understand Clarion code.

Well I guess you can be trailblazers then and let us know how it goes.

@Mark_Sarson is the resident Clarion AI guru here, he might be able to provide some detailed help. There are also weekly on-line Clarion meetings where you might be able to get personal advice and share your experiences.

1 Like

I’d be careful about trying to use AI as a “convert my Clarion app to Java/Angular” button. That’s not where it shines, and you’ll probably burn time cleaning up half-correct output.

Where AI does help a lot in this scenario is two things: understanding legacy behavior and accelerating repetitive scaffolding.

If I were in your shoes, I’d approach it like this:

First, use AI to extract behavior from the Clarion side. Export procedures (TXA if possible) and feed them in chunks. Don’t ask it to convert the code. Ask it to:

  • Summarize what the procedure does
  • List tables read/written
  • Extract validation rules
  • Identify calculations and defaulting logic
  • Note side effects

You’re basically using AI to generate the documentation your Clarion 6 app never had. That becomes your migration spec.

Second, migrate in functional slices, not layers. One browse + form. One workflow. One process. Keep the SQL DB stable like you’re doing, but replace behavior one slice at a time.

For each slice:

  • Produce a short behavior spec (AI-assisted, human reviewed)
  • Define the API contract
  • Implement cleanly in Java/Angular
  • Compare behavior against the legacy app

AI works much better when the target is clearly defined.

Also, build one really clean “golden example” module in the new stack. After that, Copilot becomes far more useful because it can mirror your established patterns instead of inventing structure.

The biggest risk in Clarion migrations isn’t SQL, it’s hidden business rules:

  • Validation buried in ACCEPT loops
  • Browse filters enforcing rules
  • Default values in embeds
  • Implicit locking assumptions

AI can help you find those, but you still need to confirm intent.

The bottom line is that AI won’t magically migrate the app for you. But if you use it as a documentation extractor and a scaffolding accelerator, it can meaningfully speed up the process.

That’s where I’ve seen it provide real leverage.

Good luck on your project!

Charles

4 Likes

Did you try to convert Clarion code to Java with this converter? Clarion to Java Compiler download | SourceForge.net
After the conversion you could extract the business logic and then use AI to optimise the code for your needs.

1 Like

Hi Rimas,

We haven’t tried it, but our devs are starting to see promising results without it.

The solution is still in an early stage, but essentially it first generates an .md file describing some Clarion code, and then based on it, examples, and GH Copilot instruction files, generates Java (backend) and TypeScript (frontend) code. Generated code needs fixes and additions, but it seems we might save a lot of time.

It also seems that we will be able to replace our code generator with AI using examples and instruction files.

Thanks for sharing, interesting approach. I did not went so deep with AI. For Java projects I’m using Jmix framework. For the UI Jmix uses Vaadin so no need for Javascript or Typescript except some non-trivial cases. Java only. For me Jmix feels very Clarion-ish but much smarter.

Not sure I would agree with that approach. So far as I remember the main focus of Andrew Barnham’s project was to convert Clarion .clw files to Java using Java controls. So, in terms of business logic they are the same, and the translation is only useful if AI can understand Java as a language, but not Clarion.

Either way, when you are working with .clw files rather than stuff at the template level you have already lost a bit of the information about why bits of code are there in the .clw file. Your ThisWindow.Init doesn’t show that lines 16 through 20 are part of the set up of a browse of table x and 22 through 28 for a browse on table y joined to z. You’d have to infer that through looking at the template names, and the queues attached to the calls to the browse.Inits and so on.
So, I’d say Charles’ approach makes more sense to me. The control templates that have been added to the window, with attached files, special behaviour in embeds related to them, and so on, are all there. Not a nice job for a human, because the TXAs aren’t really that human readable, but in terms of structured information about what is going on, I’d say they would allow AI to summarize what is going on in a procedure much more easily than trying to infer it from a .clw (or its translation into Java).

The various Ai’s should do better with the most common programming languages like Java, its the lessor known languages like Clarion the Ai’s wont perform so well with.

Although there’s been a contraction in the number of different programming languages used over the last couple of decades, I wouldnt be surprised to see this accelerate with Ai use.

Most jobs in the UK are just for the top 5 programming languages now.

Yeah, I think you’re hitting on the key distinction here.

The moment you drop down to the .CLW level, you’ve already lost a big part of the intent. At that point you’re looking at generated code plus embeds all blended together, and now you’re asking either a human or an AI to reverse-engineer “why” from “what”.

That’s doable… but it’s the hard way.

The template/TXA level still carries the structure:

  • What controls are on the window
  • What files are attached
  • What browse/form patterns are in play
  • Where behavior is injected (embeds)

Even if TXA isn’t pretty to read, it’s actually richer in meaning. It tells you what the developer was building, not just what Clarion generated.

That’s a much better starting point for AI.

The other issue with a straight CLW → Java translation (AI or otherwise) is that you’re preserving implementation, not extracting behavior. You end up with something that works the same way, but you still haven’t surfaced:

  • The actual business rules
  • The validation logic in a clean form
  • The workflow intent

So now you’ve got Java that still needs to be understood… which puts you right back where you started.

What I’ve been finding is that AI is most useful one level above that:

  • Use TXA/template-level info to understand structure
  • Use CLW only to fill in the embedded logic details
  • Have AI summarize behavior into something readable
  • Then generate clean code in the target stack from that

In other words, don’t translate the code… translate the intent, then re-implement.

That seems to be where AI actually gives you leverage instead of just moving the same complexity into a different language.

1 Like