LINKAGE=SVC

Environment

The requirements for the caller are:

Environmental factor Requirement
Minimum authorization: Problem state and any PSW key.
Dispatchable unit mode: Task
Cross memory mode: PASN=HASN=SASN
AMODE: 24- or 31-bit addressing mode
ASC mode: Primary
Interrupt status: Enabled for I/O and external interrupts
Locks: No locks held
Control Parameters: Must be in the primary address space.

Programming requirements

None.

Restrictions

The caller cannot have any enabled, unlocked task (EUT) FRRs established.

Input register information

Before issuing the TIME macro, the caller does not have to place any information into any register unless using it in register notation for a particular parameter or using it as a base register.

Output register information

When control returns to the caller, the registers contain:
Register
Contents
0
The time of day if you specified DEC, BIN, or TU. If you did not specify any of these parameters, register 0 is used as a work register by the system.
1
Contains the date, if you specified DEC, BIN, TU, or MIC. If you did not specify any of these parameters, register 1 is used as a work register by the system.
2-13
Unchanged.
14
Used as a work register by the system.
15
Return code.

Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.

Performance implications

None.

Syntax

The standard form of the TIME macro with LINKAGE=SVC is written as follows:

Syntax Description
   
   name name: Symbol. Begin name in column 1.
   
One or more blanks must precede TIME.
   
TIME  
   
One or more blanks must follow TIME.
   
DEC Default: DEC
BIN stor addr: RX-type address or register (0) or (2) - (12).
TU  
MIC,stor addr  
STCK,stor addr  
   
   ,ZONE=LT Default: ZONE=LT
   ,ZONE=UTC|GMT Note: This parameter has no meaning if STCK is specified.
   
   ,LINKAGE=SVC Default: LINKAGE=SVC
   
Note: The ERRET parameter is obsolete and will be ignored by the system. Therefore, the syntax and parameter descriptions for TIME no longer contain ERRET. However, the system will still accept ERRET and it is not necessary to delete it from existing code.

Parameters

The parameters are explained as follows:

DEC
BIN
TU
MIC,stor addr
STCK,stor addr
Specifies the form in which the time of day and date, or TOD clock contents, is returned.

DEC returns the time of day in register 0 as packed decimal digits, without a sign, of the form

HHMMSSth, where:
HH
is hours (24-hour clock)
MM
is minutes
SS
is seconds
t
is tenths of seconds
h
is hundredths of seconds

BIN returns the time of day in register 0 as an unsigned 32-bit binary number. The low-order bit is equivalent to 0.01 second.

TU returns the time of day in register 0 as an unsigned 32-bit binary number. The low-order bit is approximately 26.04166 microseconds (one timer unit).

MIC returns the time of day in microseconds. The stor addr is the address of an 8-byte area in storage with bit 51 equivalent to one microsecond.

STCK returns the contents of the TOD clock as an unsigned 64-bit binary number where bit 51 is equivalent to one microsecond. The stor addr is the address of an 8-byte area in storage.

Note: The resolution of the time-of-day clock is model dependent. See Principles of Operation for an explanation of the rate advancement.

The date is returned in register 1 as packed decimal digits of the form

0CYYDDDF, where:
C
is a digit representing the century. In the years 1900 through 1999, the macro will return a value of C=0. In the years 2000 through 2099, the macro will return a value of C=1.
YY
is the last two digits of the year.
DDD
is the day of the year.
F
is a 4-bit sign character that allows the data to be unpacked and printed.
,ZONE=LT
,ZONE=UTC|GMT
Specifies that the local time and date (LT) or the Coordinated Universal Time (UTC) or Greenwich mean time (GMT) and date are to be returned.
,LINKAGE=SVC
Specifies that the linkage used to invoke the TIME service routine is through an SVC instruction.

ABEND codes

10B

See z/OS MVS System Codes for an explanation and programmer responses for this code.

Return and reason codes

The only return code from the TIME macro is a zero in register 15 indicating successful completion.

Example 1

Request the system to store the time-of-day clock in the address pointed to by register 2.
TIME   STCK,(2)

Example 2

Request that the current local time and date be returned as packed decimal digits in registers 0 and 1.
TIME DEC,ZONE=LT,LINKAGE=SVC

Example 3

Request that the current time of day in microsecond format be returned in the location OUTAREA. Note that the default is taken for LINKAGE.
        TIME MIC,OUTAREA
        .
        .
OUTAREA DS   2F