display.status()
Description
display.status() returns the status code held by the display object, in the same way as the RPG %STATUS built-in function used with a display file name. A value of 0 means that no exception or error has been recorded for the display file.
Errors raised by the display methods, such as 1211 (I/O operation to a closed file) or 1215 (OPEN issued to a file already opened), are thrown as exceptions and can be caught with try/catch. The program-level status of the most recent error is available with pjs.status().
Syntax
display.status()Parameters
None.
Return Value
Number - The status code held by the display object. 0 indicates no exception or error.
Examples
Example 1: Read the Display Status
Writes the display file's status code to the console after a screen has been shown.
Prerequisite: a Rich Display File named customer.json with a record format named detail that contains the fields custno, custname, and balance, and a button whose response property is bound to an indicator field named exit.
pjs.defineDisplay("display", "customer.json");
display.detail.execute();
console.log(display.status()); // 0 when no error has been recorded for the display fileRPG Equivalent
%STATUS(display_file_name)