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.

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

If you do not enter a year, UniData defaults to the current year. For example,<br />

if you enter 12/1 and the year is 1996, UniData stores 10563 (12/1/96).<br />

If you enter a number between 1 and 12 for month, UniData defaults to the<br />

first day of the month in the current year. For example, if you enter just 12<br />

during 1996, UniData stores 10563 (12/1/96).<br />

Any two-digit year entered in the range 00–29 defaults to the twenty-first<br />

century. For example, UniData interprets 12/31/29 as December 31, 2029.<br />

Any two-digit year entered in the range 30–99 is considered to be 1930–<br />

1999.<br />

Converting More Than Once<br />

Depending on the date range, if an application performs ICONV on an already<br />

converted date, UniData could produce unexpected results. Dates that convert into<br />

four- or five-digit internal formats and meet the following conditions fall into this<br />

category:<br />

The first two digits are 10, 11, or 12.<br />

The second two digits are 01 through 31.<br />

The fifth digit is any number from 0 through 9. Where there is no fifth digit,<br />

UniData assigns the current year.<br />

For example, assuming 5/28/95 is the input, the code segment shown on the left<br />

results in the displays on the right:<br />

INPUT VAR<br />

VAR=ICONV(VAR,'D')<br />

PRINT VAR 10010<br />

PRINT OCONV(VAR,'D') 28 MAY 1995<br />

VAR=ICONV(VAR,'D')<br />

PRINT VAR 11963<br />

PRINT OCONV(VAR,'D') 01 OCT 2000<br />

The first ICONV returns a value of 10010. OCONV correctly returns the external<br />

format. The date matches the initial entry. However, the second ICONV accepts the<br />

internal format, 10010, as input; UniData translates this as October 1, 2000, and<br />

ICONV returns an internal format of 11963. The final OCONV returns 01 OCT 2000.<br />

Note: To prevent the preceding scenario, you can make all numeric input of fewer<br />

than six characters invalid by turning UDT.OPTIONS 82 on. However, your<br />

applications will no longer be able to process the abbreviated input dates.

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

Saved successfully!

Ooh no, something went wrong!