Natural for UNIX Version 8.3.7 for UNIX
 —  Statements  —

SET TIME

SET TIME

SETTIME

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.


Function

The SET TIME (or SETTIME) statement is used in conjunction with the Natural system variable *TIMD to measure the time it takes to execute a specific section of a program.

The SET TIME statement is placed at a specific position in the program, and *TIMD will contain the amount of time elapsed since the execution of the SET TIME statement.

*TIMD must always contain a reference to the SET TIME statement, either by using the source-code line number of the SET TIME statement or by assigning a label to the SET TIME statement, which can then be used as a reference.

Top of page

Example

** Example 'STIEX1': SETTIME                                            
************************************************************************
DEFINE DATA LOCAL                                                       
1 EMPLOY-VIEW VIEW OF EMPLOYEES                                         
  2 NAME                                                                
END-DEFINE                                                              
*                                                                       
ST. SETTIME                                                      
WRITE 10X 'START TIME:' *TIME                                           
*                                                                       
READ (100) EMPLOY-VIEW BY NAME                                          
END-READ                                                                
*                                                                       
WRITE NOTITLE 10X 'END TIME:  ' *TIME                                   
WRITE         10X 'ELAPSED TIME TO READ 100 RECORDS'                    
                  '(HH:II:SS.T) :' *TIMD (ST.) (EM=99:99:99'.'9) 
*                                                                       
END

Output of Program STIEX1:

START TIME: 16:39:07.6                                    
END TIME:   16:39:07.7                                    
ELAPSED TIME TO READ 100 RECORDS (HH:MM:SS.T) : 00:00:00.1

Top of page