Profound.js API List
Overview
The Profound.js API is the built-in library that Profound.js modules use to work with IBM i resources and RPG-style data. It covers database access, program and command calls, data areas, printer files, the IFS, date/time and string handling, error handling, and server management, so that these operations can be coded directly in JavaScript or TypeScript.
Most of the API are called through the pjs namespace object that Profound.js makes available to every module (for example, pjs.query() or pjs.getDataArea()). The remaining API fall into three groups:
Object methods - The definition API create objects that carry their own methods. A file created with
pjs.defineTable()providesfile.open(),file.fetchNext(), and the other Record Level Access methods; a display created withpjs.defineDisplay()providesdisplay.read()and related methods; and a printer file created withpjs.definePrinter()providesprinterFile.write().Extensions to JavaScript types - Profound.js adds RPG-style operations to the standard
String,Number,Date, andBuffertypes, and to Profound.js array fields. Examples includestring.scan(),Number.halfAdjust(),date.addDays(), andarray.lookup().Server-level API - A smaller set of API is exposed on the module object returned by
require("profoundjs"). These are used in server startup and configuration code rather than in application modules, and are documented on the Server Management API page.
API Categories
Each category page below lists the individual API it contains. Open a category page to see the syntax, parameters, and usage details for a specific API.
Database and File Access
SQL API - Running SQL against local and remote databases, including
pjs.query(), prepared statements built withpjs.prepare()andpjs.execute(), cursor fetching, and connection handling.Record Level Access API - Native record-level I/O against database files, including defining a file with
pjs.defineTable(), positioning and reading withfile.positionTo()andfile.fetchNext(), writing, updating, and deleting records, and commitment control withpjs.commit()andpjs.rollBack().Data Area API - Creating, reading, updating, and unlocking IBM i data areas.
IFS API - Locating, reading, and writing stream files in the Integrated File System with
pjs.findIFSFile(),pjs.readIFSFile(), andpjs.writeIFSFile().Printer File API - Defining a printer file with
pjs.definePrinter()and generating print output withprinterFile.open(),printerFile.write(), andprinterFile.close().
Program Flow and Integration
Call API - Calling other Profound.js modules, programs, service program procedures, and IBM i commands, passing parameters, making outbound HTTP requests, and transferring control.
Error Handling API - Raising, inspecting, and trapping errors with
pjs.error(),pjs.setError(), andpjs.status().Information/Logging API - Writing to the log, dumping field values, sending messages and email, and retrieving information about the current user and database driver.
Server Management API - Configuring and starting the Profound.js server, including
profoundjs.applyConfig()andprofoundjs.server.listen(), and access to the underlying Express application.
Data Definition and Structure
Declaration/Initialization API - Declaring fields with
pjs.define()and returning them to their initial or default values withpjs.clear()andpjs.reset().Data Structure API - Defining data structures with
pjs.ds()and moving values between structures, subfields, and plain JavaScript objects.Data Conversion API - Converting between character and numeric representations with
pjs.char(),pjs.move(),pjs.moveLeft(),pjs.getInt(), andpjs.setInt().Memory Management API - Lower-level work with storage and buffers, including allocating and freeing pointer-based memory, bit and zone operations, null indicators, switches, and session storage.
Working with Values
String API - RPG-style string handling such as scanning, replacing, trimming, and translating, plus conversion to and from EBCDIC hexadecimal.
Number API - Numeric formatting and arithmetic helpers, including edit codes, edit words, half adjust rounding, and numeric parsing.
Date/Time API - Building, comparing, and adjusting dates, times, and timestamps, along with Lilian date conversions and date/time format patterns.
Array API - RPG-style array operations such as lookups and their
GE,GT,LE, andLTvariants, summing, sorting, and moving array data.
User Interface
User Interface API - Working with Rich Display Files from a module, including
pjs.defineDisplay(), reading and writing display record formats, grid handling, and message boxes.
Other
Encryption API - Encrypting and decrypting values with
pjs.encrypt()andpjs.decrypt().Miscellaneous PJS APIs - API that do not belong to one of the categories above, such as
pjs.newUUID(),pjs.setOptions(), andpjs.askAgent().
Related Pages
- Array API
- Call API
- Data Area API
- Data Conversion API
- Data Structure API
- Date/Time API
- Declaration/Initialization API
- Encryption API
- Error Handling API
- IFS API
- Information/Logging API
- Memory Management API
- Miscellaneous PJS APIs
- Number API
- Printer File API
- Record Level Access API
- Server Management API
- SQL API
- String API
- User Interface API