Pathmaker Programming Guide
Using Null Values
Defining Data for a NonStop SQL Pathmaker Application
C–8 067868 Tandem Computers Incorporated
Using Null Values in
Transaction Requesters
Transaction (TRNS) requesters do not have the same limitations on using null values
that DB requesters have. In both cases, the service manipulates the null indicator, not
the requester. Because you write the services for a TRNS requester, you have access to
the null indicator (INDICATOR) in your Custom Source File code. Therefore, you can
read and alter the indicator’s value.
By controlling the value of the null indicator, you could insert null values into tables or
update columns that accept null values from non-null to null values. The examples
given earlier for inserting and updating into a table could be handled differently with
a TRNS requester. Suppose you have the following table:
MEMBERNUM MEMBERNAME SPOUSENAME
--------------------------------------------
| 1 | John | Paula |
--------------------------------------------
| 2 | Mary | ??????? |
--------------------------------------------
If John gets divorced and you use a TRNS requester application to update this table,
the SPOUSENAME column for John could contain a null value.
If Mary changes the spelling of her name and you use a TRNS requester application to
update this table, the SPOUSENAME column for Mary would still contain a null
value.
If you insert a new, unmarried member, the SPOUSENAME column for the new
member could contain a null value.
You are responsible for handling null values in the service. You must decide how
updates and inserts will be handled.
You must also remember to set the working storage for a null value to a displayable
value. The following code fragment illustrates one way you could do this:
01 Q-MARKS PIC X(15) VALUE "???".
.
.
.
EXEC SQL
SELECT MEMBERNAME,
SPOUSENAME
INTO :MEMBERNAME OF MEMBER-HOST,
:SPOUSENAME OF MEMBER-HOST
FROM =MEMBER
WHERE MEMBERNUM = :MEMBERNUM OF MEMBER-HOST
END-EXEC.
IF INDICATOR OF SPOUSENAME OF MEMBER-HOST IS EQUAL TO -1
MOVE Q-MARKS TO VALU OF SPOUSENAME OF MEMBER-HOST.