A customer made the following request.
This request prompted us to extend the TT SHOW command to provide this information. In the short term we provided an ODTSequence which would do the counting.
It was pretty much as the customer suggested 'do a TT DEFINE ? and count the responses, but we did it using Supervisor. Any Supervisor interrogation can be performed in OPAL using the KEYIN function. KEYIN("TT DEF ? ODTS") will return a string with the complete response to the DEF ? command. If we store the result in as string e.g. $LIST:=KEYIN("TT DEF ? ODTS") then each time we execute the command $Line:=$List.Split(/) we get the next line of the response. The response will contain heading lines which are always prefixed by "--" and may contain blank lines so the code:
will count the number of Opals found.
The final solution allows the type to be counted to be supplied as a parameter.
will count all of the Situations defined.
The responses to a DEF ? looks like:
AAAAA |
SYSTEM |
999.14 |
Never |
15:50,21/10/02 |
ABC |
MESSAGE |
480.26 |
17:11,09/06/03 |
17:05,09/06/03 |
AC_CASE1 |
MESSAGE |
999.14 |
Never |
15:50,21/10/02 |
AC_CASE2 |
MESSAGE |
999.14 |
Never |
15:50,21/10/02 |
. |
||||
. |
||||
AC_TRICK1 |
MESSAGE |
999.14 |
Never |
15:50,21/10/02 |
AC_TRICK2 |
PER |
999.14 |
Never |
15:50,21/10/02 |
We want to determine the age of an Opal based on its date lasts used or if never used its creation date. If $Line held one line of the response then the date we want will always be the 8 characters after the first comma. So:
will give us the date, and therefore:
will store the date into #Dt in a form we can use for arithmetic.
Will store the age of the Opal in days into #Age
The report will divide the Opals into those older than 365 days, those last used between 91 and 365 days, those used between 31 and 90 days and those used in the last 30 days.
is produced. Whenever we see a new heading we store it in $Hd. The code
repeated for each range, adds the heading to the list if required. If $H0 = $HD then this heading has already been seen and can be ignored. If not then we add the heading and update $H0 in the same expression: $L0:=&#(/,$H0:=$Hd,/);
Once we have scanned all of the line we can print the report:
We also accumulate summary information:
#Tot.Accum(#A365) returns the value stored in #A365 and adds that value to #Tot.
Finally our code would only report on one type of Opal so we wrap it in a loop:
This will perform our report for each of ODTSequence,SITUation and DISPlay.
TT DO OPALS_REPORT will created a printed report (Mailed to you if you have set up a virtual print server for MAIL and have set your destination to MAIL).
The code for both ODTSequences can be downloaded here. Once downloaded unzip and transfer the file to the MCP system and enter