You can invoke PS Query using PeopleCode. To do that you can use query classes in PeopleCode.
Query classes in PeopleCode can be used to create a new query, or to modify or delete an existing query. You can also use methods in the Query class to execute the query and have the result set returned as...
How to run a PS/Query to a file using PeopleCode
