Hi, Ruth -
What program are you planning on using to execute the file that contains the SQL? I'm having some difficulty understanding the larger picture as to what you are trying to accomplish, so some elaboration on your part would be very helpful.
Will the SQL be only a single SELECT statement?
Is the SQL dynamically created or are you running a saved/verified single SQL command or a sequence of SQL commands?
Will the SQL always work or is there a possibility it will contain syntax errors, logic errors, etc. (i.e., written by users or by developers)?
Will you be creating tables/triggers or other DB objects on the fly?
Creating logins?
Granting permissions?
Executing a stored procedure?
Depending on the particulars of what you want/need to do, the code in the "Run and Wait" example app may not be a viable solution.
-----------------------------
In regards your concerns about documentation/help, the free code samples on the TopWizProgramming web site are very concise and very well-written, but they do make extensive use of Window API functions, which are called from PowerBuilder via external function declarations. This is because they provide a means of doing things that cannot be done without using the API functions.
There is extensive documentation on the Windows API documentation available from Microsoft that you can access:
https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-api-list
Use the search field in the left sidebar on this web page to find documentation topics on API functions and structures. You need to supply the Windows names for these functions and structures, etc., and not the names by which they are called in PowerBuilder code. When an external function declaration in PB contains the "ALIAS FOR" clause, this means PB's name for the API function differs from the actual API function's name listed in the ALIAS FOR clause.
Please realize that Windows API documentation is supplied by Microsoft, not Appeon, and the documentation is directed at an audience that codes in C or C++. Microsoft uses type definitions out the wazoo (even nested, multi-level type definitions), which admittedly, can be confusing if all you've ever seen is PB code. In many cases, there are PB equivalents, but even so, it can be confusing. For example, a (typedef'd) DWORD is actually a PB UnsignedLong or ULong. Here's a link which helps explain most of the Windows API type definitions:
https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types
I've written a four-part tutorial on the subject of Interfacing Windows API functions to PB applications, and these documents are available in the Tech Articles section of the Community:
https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder
The links to these four articles are currently listed beginning on page 4. The Appendix in Part 4 of the tutorial contains PB translations for many of the more commonly-used Windows API data types.
Best regards, John