Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

CTIME - Time stamp calculations

&pagelevel(3)&pagelevel

General

Application area:

Requesting and accessing lists and tables; see "Requesting and accessing lists and tables"

Macro type:

Type S, MF format 3: C/D/E/L/M form; see "S-type macros"

Macro description

The CTIME macro offers the following functions:

  • conversion of the time stamp format (FUNCT=*CONV)

  • addition and subtraction of a timespan to/from a time stamp (FUNCT=*ADD)

  • calculation of the timespan between two time stamps (FUNCT=*DIFF)

CTIME supplies the results in the operand list in printable, binary or TODR/TODX form.

Notes

  • The CTIME macro does not use an SVC.

  • Because the functions of the CTIME macro are initiated via a subprogram interface rather than a SVC, a program calling CTIME must provide a save area 18 words long. The address of this save area must be loaded into register R13 before the macro call.

The operand list contains memory areas for:

Input time stamp 1

NTICS1I

Length: 48 bytes

Input time stamp 2

NTICS2I

Length: 48 bytes

Input timespan

NTICD1I

Length: 32 bytes

Output time stamp

NTICS1O

Length: 48 bytes

Output timespan

NTICD1O

Length: 32 bytes

The field names for PREFIX=N and MACID=TIC apply.

Time stamps and timespans are used to define the DSECTs NTICS (for time stamps) and NTICD (for timespans) for addressing data fields containing time specifications.

A time stamp consists of the date (year, month, day, day of the week) and time (hours, minutes, seconds, milliseconds, microseconds). It always refers to a particular time base and can be specified in different formats. Timespans consist of day and time specifications and can also be specified in different formats.

Possible time bases are:

UTC:

Universal Time Coordinate corresponds to Greenwich Mean Time (world
time)

LTI:

Local Time (local time in the calling system)

FZ:

Foreign Zone (“foreign” or any time base)
If the FZ time base is specified, zone information must also be specified to
make the time stamp unambiguous. This information indicates which world
time zone difference and/or which season difference must be observed and
whether the time stamp was specified in summer or winter time.

Time stamps can have the following formats:

ISO4

Printable format in decimal notation as follows:
yyyy-mm-ddjjj wwhh:mm:ssvhz:mz-hs:ms-smlsmcs

where

yyyy

Year

(4 bytes)

mm

Month

(2 bytes)

dd

Day of the month

(2 bytes)

jjj

Julian date

(3 bytes)

ww

Day of the week

(2 bytes)

hh

Hours

(2 bytes)

mm

Minutes

(2 bytes)

ss

Seconds

(2 bytes)

v

Sign of zone difference

(1 bytes)

hz

Hours of zone difference

(2 bytes)

mz

Minutes of zone difference

(2 bytes)

hs

Hours of season difference

(2 bytes)

ms

Minutes of season difference

(2 bytes)

s

Summer/wintertime specification

(1 bytes)

mls

Milliseconds

(3 bytes)

mcs

Microseconds

(3 bytes)


The data area for accepting the time stamp has the following format (macro expansion with MF=D and PREFIX=N):

NTICSISO4       DS    0XL48        timestamp in iso4
NTICSDATE_U     DS    0XL10        date union
*
NTICSMD         DS    0XL10        date
NTICSIDY        DS    CL4          year
NTICSID1        DS    CL1          hyphen1
NTICSIDM        DS    CL2          month
NTICSID2        DS    CL1          hyphen2
NTICSIDD        DS    CL2          day
*
                ORG   NTICSDATE_U
NTICSDATE_CHAR  DS    CL10         date_char
                ORG   NTICSDATE_U+10
NTICSIDJ        DS    CL3          julian 
NTICSIDB        DS    CL1          blank
*
NTICSMW         DS    0CL2         begin of weekday
NTICSIWD        DS    CL2          weekday
*
NTICSMT         DS    0CL8         time: "hh:mm:ss"
NTICSITH        DS    CL2          hour
NTICSIT1        DS    CL1          colon1
NTICSITM        DS    CL2          minute
NTICSIT2        DS    CL1          colon2
NTICSITS        DS    CL2          second
*
NTICSMZ         DS    0CL14        zone: "shh:mm-hh:mm-a"
NTICSIZS        DS    CL1          zonesign
NTICSIZH        DS    CL2          zonehour
NTICSIZ1        DS    CL1          colon3
NTICSIZM        DS    CL2          zoneminute
NTICSIZ2        DS    CL1          hyphen3
NTICSISH        DS    CL2          seasonhour
NTICSIS1        DS    CL1          colon4
NTICSISM        DS    CL2          seasonminute
NTICSIS2        DS    CL1          hyphen4
NTICSISA        DS    FL1          actualseason
*
NTICSMF         DS    0XL6         begin of fraction of second
NTICSIF         DS    0CL6         fraction of second : "mmmuuu"
NTICSIFM        DS    CL3          millisecond
NTICSIFN        DS    CL3          microsecond
NTICSILE        EQU   *-NTICSISO4  LENGTH OF ISO4 TIMESTAMP
*                                  (without address of CHDATE List)
NTICSCDL        DS    A            chdates_addr

BINAR



The numeric values are specified in halfwords in binary notation.

The data area for accepting the time stamp has the following format (macro
expansion with MF=D and PREFIX=N):

NTICSBINAR      DS    0XL42        timestamp in binar
NTICSBDY        DS    H            year
NTICSBDM        DS    H            month
NTICSBDD        DS    H            day
NTICSBDJ        DS    H            julian
NTICSFILL1      DS    CL6          fill1
NTICSBWD        DS    H            weekday
*
NTICSBTH        DS    H            hour
NTICSBTM        DS    H            minute
NTICSBTS        DS    H            second
NTICSBL1        EQU   *-NTICSBINAR LENGTH OF BINARY TIMESTAMP
*                                     PART1 (date & time)
NTICSFILL2      DS    CL2          fill2
NTICSBZH        DS    H            zonehour
NTICSBZM        DS    H            zoneminute
NTICSBSH        DS    H            seasonhour
NTICSBSM        DS    H            seasonminute
NTICSBSA        DS    FL1          actualseason
NTICSFILL3      DS    CL5          fill3
*                                  fraction of second
NTICSBFM        DS    H            millisecond
NTICSBFN        DS    H            microsecond
NTICSBL2        EQU   *-NTICSBFM   LENGTH OF BINARY TIMESTAMP
*                                     PART2 (fraction of second)
NTICSBLE        EQU   *-NTICSBINAR LENGTH OF BINARY TIMESTAMP

TODR



Time of day register format. The TOD register has the length of a doubleword
and contains e.g. for EPOCH=00:
((Number of microseconds since 1/1/1900) * 4096) modulo 2 64

It is incremented by the hardware. The TOD register can be queried using the
STCK command. The interpretation of the TODR content depends on the epoch
set for the system run, see the “Introduction to System Administration” manual
[10 (Related publications)]).

The data area for accepting the time stamp has the following format (macro
expansion with MF=D and PREFIX=N):


NTICST          DS    0XL8         timestamp in TODR
NTICSTMS        DS    F            most significant word:
*                                    approx sec
NTICSTLS        DS    F            least significant word:
*                                    micro_sec * 2**12
TODX


Extended time of day register format: it has the length of a doubleword and
contains the number of microseconds since January 1 1900 0 hours.

The data area for accepting the time stamp has the following format (macro
expansion with MF=D and PREFIX=N):

NTICSX          DS    0XL8         timestamp in TODX
NTICSTHW        DS    F            high word
NTICSTLW        DS    F            low word

Timespans can have the following formats:

ISO4 /
ISO4MIC



Printable format in decimal notation.

The data area for accepting the timespan has the following format (macro expansion with MF=D and PREFIX=N):

NTICDI        DS    0XL32        tdiff in iso4
NTICDIS       DS    CL1          sign
NTICDIDD      DS    CL10         day
NTICDID1      DS    CL1          hyphen
NTICDITH      DS    CL2          hour
NTICDIT1      DS    CL1          colon1
NTICDITM      DS    CL2          minute
NTICDIT2      DS    CL1          colon2
NTICDITS      DS    CL2          second
NTICDIFP      DS    CL1          point
NTICDIFM      DS    CL3          millisecond
NTICDIFN      DS    CL3          microsecond
NTICDILE      EQU   *-NTICDI     LENGTH OF ISO4 TIMEDIFFERENCE
*                                (without unused field)
              DS    CL5          unused

BINAR /
BINARMIC



Binary specification.
The data area for accepting the timespan has the following format (macro
expansion with MF=D and PREFIX=N):

NTICDB        DS    0XL16        tdiff in binar
NTICDBDD      DS    F            day
NTICDBTH      DS    H            hour
NTICDBTM      DS    H            minute
NTICDBTS      DS    H            second
NTICDBFM      DS    H            millisecond
NTICDBFN      DS    H            microsecond
NTICDBLE      EQU   *-NTICDB     LENGTH OF BINARY TIMESTAMP
*                                (without the fill field)
              DS    H            to fill the gap

TODR



Time of day register format.
The data area for accepting the timespan has the following format (macro
expansion with MF=D and PREFIX=N):

NTICDT        DS    0XL8         tdiff in TODR (for C)
NTICDTMS      DS    F            most significant word:
*                                   approx. sec
NTICDTLS      DS    F            least significant word:
*                                   micro_sec * 2**12

TODX



Extended time of day register format.
The data area for accepting the time stamp has the following format (macro
expansion with MF=D and PREFIX=N):

NTICSX          DS    0XL8         timestamp in TODX
NTICSTHW        DS    F            high word
NTICSTLW        DS    F            low word

Value ranges

The following value ranges are valid for the CTIME macro. Note that the macro format distinguishes between input and output with regard to time stamps and timespans.

BINAR or ISO4 format:

1900-01-01 00:00:00.000000 < time stamp < 9999-12-31 23:59:59.999999

Permitted time difference: ± 2147483647 days

TODR format:

t0   <=  time stamp  <=  t1

Permitted time difference: ± 26062 days

t0 and t1 are dependent on the EPOCH designation which is set for the TOD register. With the default epoch (GTIME parameter EPOCH=00), the TODR time stamp range is:

1900-01-01 00:00:00.000000  <=  time stamp  <=  2042-09-17 23:53:47.370495

TODX format:

1900-01-01 00:00:00.000000  <=  time stamp  <=  4317-03-18 02:44:48.587775

Permitted time difference: ± 882867 days

Macro format and description of operands

CTIME

FUNCT=*CONV / *ADD / *ADDLL / *DIFF / addr / (r)

,BASE1IN=*UTC / *LTI / *FZ / addr / (r)

,FRM1IN=*ISO4 / *ISO4MIC / *BINAR / *BINARMIC / *TODR / *TODX / addr / (r)

,INF1IN=*CALEND / *JULIAN / addr / (r)

,FRM1ZIN=*NONE / *ISO4 / *ISO4LST / *BINAR / *BINARLST / addr / (r)

,CHDL1IN=*NONE / addr / (r)

,BASE2IN=*UTC / *LTI / *FZ / addr / (r)

,FRM2IN=*ISO4 / *ISO4MIC / *BINAR / *BINARMIC / *TODR / *TODX / addr / (r)

,INF2IN=*CALEND / *JULIAN / addr / (r)

,FRM2ZIN=*NONE / *ISO4 / *ISO4LST / *BINAR / *BINARLST / addr / (r)

,CHDL2IN=*NONE / addr / (r)

,BASEOUT=*LTI / *UTC / *FZ / addr / (r)

,FRMOUT=*ISO4 / *ISO4MIC / *BINAR / *BINARMIC / *TODR / *TODX / addr / (r)

,FRMZOUT=*NONE / *ISO4 / *ISO4LST / *BINAR / *BINARLST / addr / (r)

,CHDLOUT=*NONE / addr / (r)

,FRMDIN=*ISO4 / *ISO4MIC / *BINAR / *BINARMIC / *TODR / *TODX / addr / (r)

,FRMDOUT=*ISO4 / *ISO4MIC / *BINAR / *BINARMIC / *TODR / addr / (r)

,LINKADR=*NONE / linkaddr

,MF=D / C / L / M / E

[,PARAM=addr / (r)]

,PREFIX=N / p

,MACID=TIC / macid

The operands are described in alphabetical order below.

BASE1IN=

BASE2IN=

BASEOUT=

BASE1IN and BASE2IN specify the time base valid for the 1st and 2nd input time stamps and BASEOUT specifies the time base valid for the output time stamp.

*UTC
The time stamp is specified according to UTC (Universal Time Coordinate, which corresponds to Greenwich Mean Time).
This is the default value for BASE2IN.

*LTI
The time stamp is specified according to LTI (Local TIme), the local time base valid in the calling system. This is the default value for BASEOUT.

*FZ
The time stamp is specified in a foreign or any time base (Foreign Zone). The information that characterizes this time base must be included in the zone information for the time stamp involved and specified with the relevant parameters (the FRMxZIN or FRMZOUT operand must be specified).

addr
Symbolic address (name) of a field that must be loaded beforehand with the relevant equate. Length = 1 byte.

(r)
Register containing the value of the relevant equate.

CHDL1IN=

CHDL2IN=

CHDLOUT=

Provides a table (list) of conversion times for use in assigning FZ time stamps to summer time or winter time.
A specification other than *NONE is only permissible with MF=M and with “FZ” time stamps.

*NONE
No table provided.

addr
Symbolic address (name) of a field containing the table of conversion times. This operand value is only permitted with MF=M and may only be specified in conjunction with BASExxx=*FZ. To process this table, the values FRMxZIN=*ISO4LST/*BINARLST or FRMZOUT=*ISO4LST/*BINARLST must be set. For unique representation of a time stamp, the zone information fields zone difference and conversion difference must also be assigned.
The table must be aligned on a word boundary and the format must be as follows:

The conversion time information is contained in consecutive doublewords. CHDATE data appears as UTC-based STCK values shifted 8 bits logically to the right
(SRL command), with the lowest-value bit indicating the nature of the conversion: if the bit = 0, conversion is from winter to summer time, if the bit = 1, conversion is from summer to winter time.
The table should be generated with GTIME CHDATE=...
These doublewords must contain ascending values.
The table must end with the doubleword D'0'.
See "CTIME - Time stamp calculations" for a worked example.

(r)
Register with the address value of addr.

FRMDIN=

FRMDOUT

Specifies the existing timespan format (FRMDIN as input timespan) or the desired timespan format (FRMDOUT as output timespan).

*ISO4
The timespan is represented in printable format. With FRMDOUT, millisecond and microsecond fields are also provided.

*ISO4MIC
The timespan is represented in printable format. With FRMDIN, additional expansion with milliseconds and microseconds is expected.

*BINAR
The timespan is represented in binary form with fixed-point numbers. 4 bytes are used for the days and 2 bytes each for the hours, minutes and seconds. With FRMDOUT, millisecond and microsecond fields are also provided.

*BINARMIC
The timespan is represented in binary form with fixed point numbers. With FRMDIN, additional expansion with milliseconds and microseconds is expected.

*TODR
The timespan is represented in time of day register format.

*TODX
The timespan is represented in extended time of day register format.

addr
Symbolic address (name) of a field that must be loaded beforehand with the relevant equate. Length = 1 byte.

(r)
Register containing the value of the relevant equate.

FRM1IN=

FRM2IN=

FRMOUT=

Specifies the existing time stamp format (FRM1IN, FRM2IN as input time stamps) or the desired time stamp format (FRMOUT as output time stamp).

*ISO4
The time stamp is represented in printable format. This is the default value for FRM2IN and FRMOUT. With FRMDOUT, millisecond and microsecond fields are also provided.

*ISO4MIC
The time stamp is represented in printable format. With input time stamps, additional expansion with milliseconds and microseconds is expected.

*BINAR
The time stamp is represented in binary form with halfword fixed-point numbers. With FRMDOUT, millisecond and microsecond fields are also provided.

*BINARMIC
The time stamp is represented in binary form with halfword fixed point numbers. With input time stamps, additional expansion with milliseconds and microseconds is expected.

*TODR
The time stamp is represented in time of day register format.

*TODX
The timespan is represented in extended time of day register format.

addr
Symbolic address (name) of a field that must be loaded beforehand with the relevant equate. Length = 1 byte.

(r)
Register containing the value of the relevant equate.

FRM1ZIN=

FRM2ZIN=

FRMZOUT=

Specifies the format of the additional zone information supplied (FRMxZIN) or desired (FRMZOUT), which characterizes the time base of the specified time stamp.
This operand is mandatory if the time base “FZ” was specified for the time stamp involved.

If the “LTI” time base was specified for an input time stamp, it is possible to specify whether or not the season information supplied with the time stamp is to be evaluated. “*NONE” means that this information is not evaluated. Other values require the corresponding field of the zone information to contain a valid value.

For the output time stamp, the FRMZOUT operand specifies the format in which the zone information is to be output. If “*NONE” is specified, the format of the time stamp itself is assumed (if the “*TODR” format is used, the zone information is output in binary form).

*NONE
No zone information is supplied.

*ISO4
The zone information is specified in printable format.

*ISO4LST
The zone information is specified in printable format. The address of the CHDATE table must be provided by the operands CHDLxIN or CHDLOUT.
The specification in the zone information which shows whether the time stamp is for summer or winter time is ignored. The FZ time stamp is compared with this table to obtain the summer / winter time information (see also the example on "CTIME - Time stamp calculations").

*BINAR
The zone information is specified in binary form as a halfword fixed-point number.

*BINARLST
The zone information is specified in binary form as a halfword fixed-point number. The address of the CHDATE table must be provided by the operands CHDLxIN or CHDLOUT.
The specification in the zone information which shows whether the time stamp is for summer or winter time is ignored. The FZ time stamp is compared with this table to obtain the summer / winter time information (see also the example on "CTIME - Time stamp calculations").

addr
Symbolic address (name) of a field that must be loaded beforehand with the relevant equate. Length = 1 byte.

(r)
Register containing the value of the relevant equate.

FUNCT=
Specifies which function of the CTIME macro is to be executed.

*CONV
The 1st input time stamp is converted into a different format. The results are written to the output time stamp.

*ADD
The input timespan is added to the 1st input time stamp. The results appear in the output time stamp. The input timespan may also be negative. The format of the input timespan is specified with the FRMDIN operand.

*ADDLL
As is the case with *ADD, the input timespan is added to the 1st input time stamp.

Here, however, a conversion between summer time and winter time is taken into account between the input time stamp and the output time stamp. (These conversion days do not have the usual length of 24 hours; they are lengthened or shortened by the conversion difference. When addition is carried out, however, they are nevertheless considered to be 24-hour days, in contrast to *ADD). The results appear in the output time stamp. The input timespan can also be negative.

Example
The conversion from winter to summer time took place on 30.03.2008 at 02:00:00.


Input time stamp

2008-03-29,23:00:00

Input timespan

+00001-00:00:00 (1 Tag)

*ADD result

2008-03-31,00:00:00

*ADDLL result

2008-03-30,23:00:00


*DIFF
The time difference between the 1st input time stamp and the 2nd input time stamp is calculated. The results appear in the output timespan.

addr
Symbolic address (name) of a field that must be loaded beforehand with the relevant equate. Length = 1 byte.

(r)
Register containing the value of the relevant equate.

INF1IN=

INF2IN=

Specifies the type of day specification used in the input time stamp involved.

*CALEND
The conventional calendar month and day specification is used.

*JULIAN
The date is specified according to the Julian system, which numbers the days of the year consecutively, starting at January 1.

addr
Symbolic address (name) of a field that must be loaded beforehand with the relevant equate. Length = 1 byte.

(r)
Register containing the value of the relevant equate.

LINKADR=

Specifies the manner in which the address of the entry point IGTCTI for the CTIME routine in the GET-TIME subsystem is supplied to the user program. LINKADR must be specified if MF=E; in all other cases specifying LINKADR has no effect.

*NONE
During assembly the assembler generates an external reference for the IGTCTI entry point and this is resolved during linking via the autolink function of the BLS.
This value can be used when the module containing the CTIME call

  • is always linked and loaded with the dynamic binder loader DBL (in this case, CTIME in the E form is allowed to issue a V constant, which is supplied by the BLS during the load procedure) or

  • is linked with the BINDER (see the “BINDER” manual [5 (Related publications)] under the BINDER statement SET-EXTERN-RESOLUTION RESOLUTION=STD.

linkaddr
Symbolic address (name) of a word in which the user has provided the address of the IGTCTI entry point before the CTIME call.
The following example shows how the address of the IGTCTI entry point is first supplied to the program by an appropriate BIND call and can then be transferred for the CTIME call into the word designated by “linkaddr”:


         BIND   MF=E,PARAM=BINDPL
         :
         CTIME  MF=E,PARAM=OPLIST,LINKADR=AENTRY
         :
AENTRY   DS     F
OPLIST   CTIME  MF=L,...
BINDPL   BIND   MF=L,SYMBOL=IGTCTI,SYMBLAD=AENTRY


The entry address of the CTIME routine must always be supplied to the user program in this way if none of the cases mentioned in LINKADR=*NONE apply, e.g. especially if the module with the CTIME call is linked by BINDER under the BINDER statement SET-EXTERN-RESOLUTION RESOLUTION=MANDATORY.

MF=
For a general description of the MF operand, its operand values and any subsequent operands (e.g. PREFIX, MACID and PARAM), see section “S-type macros”. The valid MF values are given at the start of the macro description under “Macro type” and are included in the macro format.

A PREFIX can be specified in the C form, D form or M form of the macro and additionally a MACID in the C form or M form (see section “S-type macros”).

In the E form and M form of the macro, the label of the data area is specified in the PARAM operand. The data area must be doubleword-aligned. Default setting: NTICPA
aligned. Default setting: NTICPA

When calling the macro with MF=L, the user must specify this label explicitly, otherwise an MNOTE is output.

Use of registers

The following registers are required for a CTIME macro call:

R1
R13

is loaded by the macro with the address of the operand list.
must be loaded before the macro call with the address of an 18-word save area
which the calling program has to provide.

R14
R15

is loaded by the macro with the return address of the user program.
is overwritten by the routine called (via CTIME).

Return information and error flags

Standard header:

+---------------+
|   |   |   |   |
|c|c|b|b|a|a|a|a|
+---------------+

The following return code relating to execution of the CTIME macro is transferred in the standard header
(cc=Subcode2, bb=Subcode1, aaaa=Maincode):

cc

bb

aaaa

Meaning

00

00

0000

Function executed successfully


01

0001

The function was aborted: an invalid time stamp was specified in the parameter
list.
Action: correct time stamp.


01

0002

The function was aborted: error in the zone information of a specified time stamp.
Action: correct zone information.


01

0003

The function was aborted: error in timespan specification.
Action: correct timespan specification.


01

0006

The function was aborted: error in specification of the input or output data via the
operands in the parameter list.
Action: correct specification.


01

000D

The function was aborted: address of CHDATEs table not aligned on word
boundary or address field is empty.
Action: correct program.


01

000E

The function was aborted: error in format of CHDATEs table. The desired data
processing is not possible. Possible errors:

  1. The first byte of each entry is not X'00' .

  2. The last byte of each entry is not alternately X'00' and X'01'.

  3. The entries are not monotonously ascending in terms of the time stamp for
    assignment. This may be because

    • the table was wrongly formated with GTIME;

    • e.g. CHDATEs were only entered for the next two years but a three-year
      time stamp is to be assigned; the data following the table is in this case
      taken to be a continuation of the table.

  4. The time difference between two entries (excluding the first two) is not
    between 4 to 8 months

Action: correct table or table-formation program.

00

04

FFFF

The function was aborted: Data area is not aligned on a double word boundary.
Action: correct program.

02

00

0007

Warning: the function was executed but the output time stamp is before or after
the conversion times. It is not possible to determine whether summer or winter
time applies. It is assumed that a winter time stamp is required. To make sure that
the output time stamp is unambiguous, zone information must be stored with it.
This warning can occur only for an LTI time stamp or for an FZ time stamp for
which a CHDATE table has been provided.

02


0008

Warning: the function was executed but the specified time stamp is represented
in a conversion time interval that cannot actually occur. A winter time stamp is
assumed. If it is known whether summer or winter time applies, this information
can be supplied with the time stamp (see FRMnZIN operand). This warning can
occur only for an LTI input time stamp or for an FZ time stamp for which a
CHDATE table has been provided.
Action:
if information is available as to whether summer or winter time applies, it can be
supplied with the time stamp. To process this information, the FRMxZIN operand
must be set accordingly.

02


0009

Warning: input time stamp is not unique.
The function was executed but the specified time stamp is now represented in a
conversion interval in which the time stamp is represented twice.
A summer time stamp is assumed.
If it is known whether the time stamp is a summer or winter time stamp, this
information can be supplied with the time stamp (see FRMnZIN operand). This
warning can occur only for an LTI input time stamp or for an FZ time stamp for
which a CHDATE table has been provided.
Action:
if information is available as to whether summer or winter time applies, it can be
supplied with the time stamp. To process this information, the FRMxZIN operand
must be set accordingly.

02


000A

Warning: output time stamp is not unique.
The function was executed but the output time stamp is in a time interval at the
conversion between summer and winter time that occurs twice. To ensure that
the output time stamp is unambiguous, the zone information must be stored with
the time stamp. This warning can occur only for an LTI output time stamp or for
an FZ time stamp for which a CHDATE table has been provided.

02


000B

Warning: the function was executed but the upper range limit (see “Value
ranges”) was exceeded when a timespan was added to a time stamp. The output
date receives the value of the upper range limit.

02


000C

Warning: the function was executed but the result of subtracting a timespan from
a time stamp was a value less than the lower range limit (see “Value ranges”).
The output date receives the value of the lower range limit.

02


000F

Warning: the function was executed but the output time stamp is in a conversion
time interval which is not actually permitted. This warning can occur only for
*ADDLL function output time stamps.

Other return codes which, in accordance with conventions, apply to all macros are given in the table “Standard return codes” (Standard header).

If subcode1 is not equal to zero, only the return code in the standard header is set and no other data is transfered.

The calling program is terminated when the following errors occur:

  • The data area is not assigned to the caller.

  • The data area is not aligned on a doubleword boundary.

  • The data area is protected against write access.

Example illustrating utilization of a user-specific CHDATEs table

         TITLE 'GTIME and CTIME'
*
         PRINT NOGEN,BASE
         GPARMOD 31
*
CGTIME   @ENTR TYP=M
         BIND MF=E,PARAM=BINDPLG
         BIND MF=E,PARAM=BINDPLC
*
         LA    R1,GTPAR1
         USING NTIGPL,R1
         MVC   NTIGCHD(NTIGCHDL),=A(0,128) ————————————————————————————  (1) 
         LA    R3,CHDATES —————————————————————————————————————————————  (2) 
*
         @CYCL ,
         GTIME MF=E,PARAM=(R1),LINKADR=AENTRYG ————————————————————————  (3) 
         MVC   0(NTIGCHDL,R3),NTIGCHD —————————————————————————————————  (4) 
         LA    R3,NTIGCHDL(R3) ————————————————————————————————————————  (5) 
*
         @WHEN NE
         CLC NTIGRET,=A(0)
         @BREA , ——————————————————————————————————————————————————————  (6) 
*
         @BEND ,
*
**********************************************************************
* Following this part of the program, the system's CHDATES are       *
* already stored in the CHDATES memory area.                         *
**********************************************************************
*
DTH1     LA    R1,CTPAR2
         USING NTICPL,R1
         CTIME MF=M,CHDLOUT=CHDATES
*
         RDATA MF=(E,READDATE) ————————————————————————————————————————  (7) 
         LA    R1,CTPAR2
         USING NTICPL,R1
         MVC   NTIC1MD(L'DATEDATE),DATEDATE ———————————————————————————  (8) 
         MVC   NTIC1MT(L'DATETIME),DATETIME
         MVC   NTIC3MZ(14),=C'+01:00:-01:00-'
         CTIME MF=E,PARAM=(R1),LINKADR=AENTRYC ————————————————————————  (9) 
*
END      @EXIT
*
**********************************************************************
* With the above section of the program, RDATA is used to read in a  *
* date in the format "yyyy mm dd hh mm ss" from the terminal and to  *
* convert it using the CTIME from UTC to FZ, taking into account the *
* CHDATEs table. The event is shown in ISO4 format in the parameter  *
* list in the output time stamp.                                     *
**********************************************************************
*
READDATE RDATA INDATE,0,MF=L —————————————————————————————————————————— (10) 
*
INDATE   DS    0CL30
DATELEN  DS    CL2
DATERES  DS    CL2
DATEDATE DS    CL10
DATESPAC DS    CL1
DATETIME DS    CL8
*
GTPAR1   GTIME MF=L,CHDATE=NEXT ––––––––––––––––––––––––––––––––––––––––––––– 
(3)
*
CTPAR2   CTIME MF=L,FUNCT=*CONV,BASE1IN=*UTC,FRM1IN=*ISO4,             C
               BASEOUT=*LTI,FRMOUT=*ISO4 –––––––––––––––––––––––––––––––––– 
(9)
*
CHDATES  DS    100D ——————————————————————————————————————————————————— (11) 
*
BINDPLG  BIND MF=L,SYMBOL=I@GTIME,SYMBLAD=AENTRYG
BINDPLC  BIND MF=L,SYMBOL=IGTCTI,SYMBLAD=AENTRYC
*
AENTRYG  DS    A
AENTRYC  DS    A
*
         @END   ,
**********************************************************************
* DSECTs                                                             *
**********************************************************************
*
NTICPL   CTIME MF=D
NTIGPL   GTIME MF=D
         END

(1)

Default setting of the GTIME parameter list with a value that ensures that the subsequent CHDATEs are supplied in chronological order.

(2)

The storage address of the CHDATE is loaded in register R3.

(3)

The GTIME call fetches the first or next CHDATE.

(4)

Secured in the storage area.

(5)

The pointer to the CHDATEs table is incremented by X'08'.

(6)

The loop should be quit if there is no next CHDATE (or in the event of an error).

(7)

The RDATA requires that a date be entered via a data display terminal. The date must be entered in the format yyyy-mm-dd hh:mm:ss (it is not necessary to enter the divider; it is sufficient to enter a blank in each case).

(8)

The CTIME data area is supplied with date and zone.

(9)

The input time stamp is converted from UTC to LTI. Both the output and input time stamps should be in ISO4 format.

(10)

RDATA data area with definition of the entry field INDATE.

(11)

Area definition for up to 100 CHDATEs.

Runtime log

/start-assembh
%  BLS0500 PROGRAM 'ASSEMBH', VERSION '<ver>' OF '<date>' LOADED
%  ASS6010 <ver> OF BS2000 ASSEMBH  READY 
//compile source=*library-element(macexmp.lib,cgtime), -
//        compiler-action=module-generation(module-format=llm), -
//        macro-library=$tsos.syslib.assembh.012, -  —————————————————— (12) 
//        module-library=macexmp.lib, -
//        listing=parameters(output=*library-element(macexmp.lib,cgtime)), -
//        test-support=*aid
%  ASS6011 ASSEMBLY TIME: 1605 MSEC
%  ASS6018 0 FLAGS, 0 PRIVILEGED FLAGS, 0 MNOTES
%  ASS6019 HIGHEST ERROR-WEIGHT: NO ERRORS
%  ASS6006 LISTING GENERATOR TIME: 101 MSEC
//end
%  ASS6012 END OF ASSEMBH
/add-file-link link-name=blslib00,file-name=$tsos.syslib.assembh.012 —— (13) 
/load-executable-program library=macexmp.lib,element-or-symbol=cgtime, -
/     dbl-parameters=*par(resolution=*par(alternate-libraries=*yes))
%  BLS0523 ELEMENT 'CGTIME', VERSION '@' FROM LIBRARY
   ':2OSG:$QM212.MACEXMP.LIB' IN PROCESS
%  BLS0524 LLM 'CGTIME', VERSION ' ' OF '<date> <time>' LOADED
/%in dth1 <%d %@(chdates) -> %xl96>  —————————————————————————————————— (14) 
/%in end <%d indate,%1 -> %xl232> ————————————————————————————————————— (15) 

/%r

*** TID: 005000D8 *** TSN: 2QSE ********************************************
CURRENT PC: 0000006A    CSECT: CGTIME  *************************************
V'00000208' = CGTIME   + #'00000208'  ————————————————————————————————— (16) 
00000208 (00000208) 008FF960 489C4000 0090D566 AC464001    ..9-.. ...N... .
00000218 (00000218) 0091BA3A 1E2A4000 00929F0D 900E4001    .j.... ..k.... .
00000228 (00000228) 009383E1 01F24000 009468B4 73D64001    .lc..2 ..m...O .
00000238 (00000238) 00954D87 E5BA4000 0096325B 579E4001    .n(gV. ..o.$.. .
00000248 (00000248) 0097172E C9824000 009804CF 49A04001    .p..Ib ..q.... .
00000258 (00000258) 00FFFFFF FFFFFF00 0099CE76 2D684001    .~~~~~~..r.... .
*2012-01-20 14:36:35 —————————————————————————————————————————————————— (17) 
SRC_REF:   230 SOURCE: CGTIME  PROC: CGTIME  *******************************
INDATE          = |....2012-01-20 14:36:35.......|
CURRENT PC: 00000098    CSECT: CGTIME  *************************************
V'00000120' = CGTIME   + #'00000120' —————————————————————————————————— (18) 
00000120 (00000120) 00050702 00000000 01010001 01010001    ................
00000130 (00000130) 02010000 01010100 F2F0F1F2 60F0F160    ........2012-01-
00000140 (00000140) F2F0F0F0 F0404040 F1F47AF3 F67AF3F5    20000   14:36:35
00000150 (00000150) 00000000 00000000 00000000 00000000    ................
00000160 (00000160) 00000000 00000000 F0F0F0F0 60F0F060    ........0000-00-
00000170 (00000170) F0F0F0F0 F0404040 F0F07AF0 F07AF0F0    00000   00:00:00
00000180 (00000180) 00000000 00000000 00000000 00000000    ................
00000190 (00000190) 00000000 00000000 4EF0F0F0 F0F0F0F0    ........+0000000
000001A0 (000001A0) F0F0F060 F0F07AF0 F07AF0F0 00000000    000-00:00:00....
000001B0 (000001B0) 00000000 00000000 F2F0F1F2 60F0F160    ........2012-01-
000001C0 (000001C0) F2F0F0F2 F040C6D9 F1F57AF3 F67AF3F5    20020 FR15:36:35
000001D0 (000001D0) 4EF0F17A F0F060F0 F17AF0F0 60E6F0F0    +01:00-01:00-W00
000001E0 (000001E0) F0F0F0F0 00000208 00000000 0000016C    0000...........%
000001F0 (000001F0) 00000000 00000000 00000000 00000000    ................
00000200 (00000200) 00000000 00F8C180                      .....8A.

(12)

During assembly, the library containing the necessary @ macros for structured programs is specified.

(13)

In order to run structured programs, the library with the @ macros will also be required. Here it is assigned in the load call using the link name BLSLIB00 and the specification ALTERNATE-LIBRARIES=*YES.

(14)

The CHKDATEs table is to be output at the symbolic address DTH1.

(15)

The INDATE field and the operand list are to be outpout at the symbolic address END. After a successful CTIME call, the start address of the operand list is contained in register R1. The operand list is 232 bytes in length (this information is obtained by releasing the DSECT with CTIME MF=D).

(16)

The symbolic address DTH1 has been reached. The table of the CHDATEs is output. 10 CHDATES are currently recognized in the system. They are in TODR format, shifted 1 byte to the right.The system marks the end of the CHDATEs table with X'00FFFFFF FFFFFF00'.

(17)

Entry of a time stamp is requested (Prompt “*”).

(18)

The symbolic address END has been reached. The contents of the field INDATE are output: The time stamp entered was read in correctly by RDATA.

Output of the operands list:

  • The first input time stamp of the operand list corresponds to the time stamp “2012-01-20 14:36:35” read in by RDATA. The time basis is UTC. The time stamp is in ISO4 format.

  • The second input time stamp and the input timespan was not specified.

  • The output time stamp (based on LTI) is in ISO4 format and contains the following information:The day specified is the 20th day of the year, a Friday.The current time has been recalculated. The LTI time is “15:36:35”. The zone information “+01:00-01:00-W” shows that the zone difference between UTC and LTI is one hour and the difference between daylight saving time and standard time is also one hour, and that now is standard time (“W” as “winter“, standard time; summer time would be indicated by “S” as “summer”).

  • No output timespan was calculated.