There's no built in way to generate a Data Matrix barcode. You'll need an external encoder object of some type (a DLL with direct calls, or an OLE Automation object), and possibly installation of font files.
ID Automation sells a Data Matrix product that will fit what you need, but it's not cheap. A set of fonts gets installed on the machine, use one of them on a text field (appropriately sized height/width), call the encoder to turn your data into a string for the new field, and the font makes it look like a data matrix barcode. We've been doing something similar with a their universal barcode package for 10+ years.
Generating a Data Matrix barcode directly in Powerbuilder script *might* be possible. I'm looking at some C code that's 1300 lines long, but translating it would be more time consuming, and therefor expensive, than using a pre-packaged product that comes with support. It would also be a lot slower than a packaged, external, DLL.
Are there restrictions on what you can install on machines? Is this for web, mobile or desktop?
Miguel created some source code that may work well as a starting point for you. It utilizes the ZXING library, located here: https://github.com/zxing/zxing. Once on that page scroll down and you'll see that Data Matrix is one of the supported bar codes.