148 IBM Tivoli Web Access for Information Management
򐂰 Avoid pursuing a JavaScript solution.
Using the JavaScript Date() function has the same limitation of not supporting the more
than 20 Web Access external date and time formats.
Calculating a duration: An example using BLQUXVAL
One of the most frequent types of business logic requests is date calculation. Web Access
provides sample date calculations and code that can be used by Web application developers
to develop additional calculations. Business logic exit module BLQUXVAL contains a routine
that calculates the total duration when a problem record is closed using the date and time
occurred and completed. In order to calculate duration, you must know the s-words
associated with the date and time fields involved. In this case, S0C3D contains date
occurred, and S0C40 holds date completed. The dates in these s-word variables are in the
user's external date format. In order to perform calculations on them, you have to convert
them to internal date format. TSX BLQTXCVT is provided to perform such calculations.
BLQUXVAL calls BLQTXCVT using a HLAPI/REXX USERTSP transaction.
Example: A-9 Using BLGUXVAL to calculate a duration
tsp_name = 'BLQTXCVT' /* Date converter TSX */
CDATE.1 = S0C3D /* Date occurred */
CDATE.2 = S0C40 /* Date completed */
CDATE.0 = 2 /* Values to be converted */
CONVERT = 'EXTTOINT' /* Convert external to internal */
input.1.?name = 'tsp_name' /* Put tsx name in input variable*/
input.2.?name = 'CDATE.'
input.3.?name = 'CONVERT'
input.0 = 3
The CDATE compound variable can contain as many dates as need to be converted. The
CONVERT variable might contain EXTTOINT (external to internal) or INTOEXT (internal to
external), depending on which type of conversion must be performed.
BLQTXCVT returns the results in one of several output variables. Requested external dates
go into OUTPUT.UEXTDATE.n, and requested internal dates go into OUTPUT.UINTDATE.n.
Here, OUTPUT is assumed to be the name of your output stem. In our example, you can
access the output as:
date1 = output.uintdate.1
date2 = output.uintdate.2
In order to perform calculations on dates in REXX, you must put them into a special format
(which is basically the Information Management for z/OS internal format with the slashes
removed).
/* Get rid of slashes in internal date */
date1 = Translate('01235689',date1,'0123456789')
date2 = Translate('01235689',date2,'0123456789')
Since you are working with two date and time pairs, you should ensure that the second pair
really occurred after the first pair:
If date2 < date1 | (date2 = date1 & S0C71 < S0C6A) then
Exit 200 'HTML BLQ0P104.html Date/time completed must be ' ,
'greater than date/time occurred: 'S0C3D S0C6A'.'

Get IBM Tivoli Web Access for Information Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.