11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ISNV<br />

Syntax<br />

ISNV(expr)<br />

Description<br />

The <strong>UniBasic</strong> ISNV function tests an expression for the null value. If expr is the null<br />

value, this function returns a code of 1. If the expression is not null, or if it contains<br />

a null value as well as other characters, this function returns a code of 0.<br />

Note: The udtconfig parameter NULL_FLAG must be on for a program that contains<br />

ISNV to compile. With this flag on, the null value represents an unknown value (represented<br />

by @NULL in <strong>UniBasic</strong> programs), as opposed to an empty string<br />

(represented as “”). IBM recommends that you use @ variables to represent UniData<br />

delimiters and the null value because the ASCII value used to represent these<br />

characters can vary with language group.<br />

Examples<br />

The following program example demonstrates testing for the null value in a variable:<br />

1-403 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

A=@NULL<br />

IF ISNV(A) THEN PRINT "A is the null value."<br />

This program results in the following output:<br />

A is the null value.<br />

The following program uses the function ISNV to determine if a string consists of the<br />

null value:<br />

PRINT "1.a ISNV(@NULL) = ":ISNV(@NULL)<br />

PRINT "2.a NOT(ISNV(@NULL)) = ":NOT(ISNV(@NULL))<br />

A = "abc":@NULL:"def"<br />

PRINT "1.b ISNV('abc':@NULL:'def') = ":ISNV(A)<br />

PRINT "2.b NOT(ISNV('abc':@NULL:'def')) = ":NOT(ISNV(A))

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!