SQL/MP Programming Manual for COBOL85
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
10-35
Constructing a Server that Interfaces With Pathway
Handling Null Results
If the value returned is null, SQL/MP checks NULL-INFO and moves a -1 into the
location pointed to by IND-PTR. (Errors are returned if the value is null but NULL-INFO
is 0 or if IND-PTR is an invalid address.)
Your program must check NULL-INFO to determine whether the value returned could
be null. Handle null values as follows:
•
If NULL-INFO is -1, check the indicator variable pointed to by IND-PTR of
SQLVAR. If the indicator variable is also -1, then a null value was returned. Display
something representing a null value (perhaps blanks or zeroes); otherwise, display
the value in the location pointed to by VAR-PTR.
•
If NULL-INFO is 0, display the value pointed to by VAR-PTR.
If ignoring null values, simply display the value pointed to by VAR-PTR.
Constructing a Server that Interfaces With
Pathway
A dynamic SQL application can accept statements directly from a screen interface like
Pathway. The dynamic SQL statement (or part of a statement) accepted directly from
the user is compiled and executed, and the program replies to the user.
In many cases, you can use Pathmaker to code applications for a Pathway
environment. For detailed information on coding servers using SQL with Pathway
screens, see the Pathmaker Programming Guide. This subsection presents guidelines
for writing a dynamic SQL COBOL85 server that interfaces with Pathway. For general
guidelines on writing COBOL85 servers for Pathway, see the COBOL85 for NonStop
Systems Manual and the Pathway/TS SCREEN COBOL Reference Manual.
Constructing an SQL Statement from User Input
If the program functions with Pathway input, the user enters statements in a Pathway
screen, and the SCREEN COBOL requester program sends the data to your program.
Your program then performs the database request and replies to the SCREEN COBOL
requester, which replies to the user through the Pathway screen.
If the user enters field values (instead of SQL statements), your program must
construct the SQL statement from the input values. To construct the statement, first
check values passed from the requester in the buffer to decide what the statement
Note. The DESCRIBE INPUT statement sets the NULL-INFO field, depending on whether the
prepared SQL statement includes a null indicator and not on whether the column in the table
supports a null value. To determine if a column supports a null value, check the
NULLALLOWED column in the COLUMN catalog table for the catalog where the table is
registered.