IBM Support

IBM Rational Robot: SQABasic Code Example to calculate age.

Troubleshooting


Problem

This technote is a little example of code that returns the number of days between the current date and a hard-coded date in the format DD-mmm-YYYY

Resolving The Problem

Declare Function TimeSpanInDays (beginDatum As Variant, endDatum As Variant) As integer

Sub Main

Dim Result As Integer
print TimeSpanInDays(CVdate("01-Jan-2005"),Date)
End Sub


Function TimeSpanInDays (beginDatum As Variant, endDatum as Variant)
Dim counter As integer
if CVDate(beginDatum)>CVDate(endDatum) then
print "The first parameter must be smaller than the second"
TimeSpanInDays = -1
exit Function
End if
counter =0
while CVdate(beginDatum) <> CVDate(endDatum)
beginDatum = beginDatum+1
counter = Counter+1
Wend
TimeSpanInDays = counter
End Function



[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Scripting","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2002.05.20;2003.06.00;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

26053

Document Information

Modified date:
16 June 2018

UID

swg21127731