Examples
Example 3. Date Routines
While working with the creation and last referral dates of MVS data sets (non VSAM) obtained from their VTOC entries, I needed a routine to convert the dates to other formats. Converting the dates first to Julian day number was the solution I decided upon. Programmers (myself included) often refer to dates in the form yyyy.ddd as Julian dates, but this is not correct. Julian dates (abbreviated JD) are a continuous count of days and fractions since noon Universal Time on January 1, 4713 BCE. A Julian date is expressed as a real number; the number of whole days and fractions of a day from the base date. For example, the Julian date for CE 2014 October 24 02:30:00.0 UT is JD 2456954.604167.
The advantages to using a JDN for date routines is obvious. Two determine the difference between two dates, find the JDN of both dates and subtract. To advance a date, n number of days, add n to the JDN. To find the day of the week, calculate JDN modulo 7, etc.
The routines used here return integer results, so the JDN, as used here, starts at 00:00:00 on January 1, -4712, which is day 0. Day one is January 2, -4712, January 1, 2013 is 2,456,293, etc.
To obtain the current date/time getDate() can be used:
int getDate(struct dateTime *_dateTime);This routine retrieves the TOD value from a store clock fast call and adjusts the time according to the value found in the cvt fields cvttz and cvtlso. These two fields adjust the UTC time returned by the stckf for time zone and leap second differences.
Passed to the routine is the struct dateTime, where the retrieved date/time information is stored and passed back to the calling routine.
struct dateTime
{
int jdn; // Julian Day Number
int Lilian; // Lilian Date used by LE
char yyyymmdd[9]; // e.g. 20141104
char yyyymmdd2[11]; // e.g. 2014/11/04
int dayOfWeek; // 0 - 6
char weekdayLong[9]; // Full text, e.g. "Monday"
char weekdayShort[4]; // Abbrev. Text, e.g. "Mon"
char time24[9]; // 24 hour hh:mm:ss
char time12[9]; // 12 hour hh:mm:ss
char ampm[3]; // AM or PM
char monthLong[10]; // Full Text e.g. "January"
char monthShort[4]; // Abbrev. Month e.g. "Jan"
char yyyyddd[9]; // yyyy.ddd
char longDate[40]; // Tuesday, November 04, 2014 10:54:38AM
// Binary Representation of Fields
short int dayOfYear; // 1 - 366
short int year;
short int month;
short int day;
short int hour;
short int min;
short int sec;
};
For date conversion purposes I created 12 routines.
Type Signatures
extern int ISODayToJulianDN(int year, int day);extern int UnixTime(int JD);
extern int LilianDate(int JD);
extern int GregorianToJDN(int year, int month, int day);
extern void JulianDNToGregorian(int JD, int *year, int *month, int *day);
extern int dayOfTheYEAR(int year, int month, int day);
extern void dayOfYearToCalendar(int year, int *month, int *day);
extern int dayOfTheWeek(int JD);
extern int ISODayOfTheWeek(int JD);
extern int ANSIDate(int JD);
extern int TODToJDN(unsigned long long int TOD);
extern int isYearLeapYear(int year);
These routines facilitate the conversion from one date format to another. Included are yyyy.ddd (ISO date format), Unix time, and Lilian date which began at the start of the Gregorian Calendar on October 15, 1582. Lilian date is the format used by Language Environment®.
Most of the algorithms for this routines are from Jean Meeus, Astronomical Algorithms (Richmod, Virginia: Willmann-Bell, 1991) modified for my needs. I tested the routines on a Linux system using the NetBeans IDE (Oracle open source). They were then FTP'ed to MVS and the HLASM code generated using METAL C.
Performance testing of the GregorianToJDN routine with a date of 2014/10/28 executed 10,000,000 times took 4.12 CPU seconds or about 0.412μ seconds per call, on a zEnterprise 114 3.8GHz processor.
The C source code for all the routines appears below:
/*
* File: cvt.h
* Author: John
*
* Created on November 3, 2014, 9:00 PM
*/
#ifndef CVT_H
#define CVT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __MVS__
#pragma pack(packed)
#endif
struct cvt
{
void *cvttcbp; /* - Address of PSATNEW. @PTC */
void *cvt0ef00; /* - ADDRESS OF ROUTINE TO SCHEDULE */
void *cvtlink; /* - ADDRESS OF DCB FOR SYS1.LINKLIB DATA SET. */
void *cvtauscb; /* - ADDRESS OF ASSIGN/UNASSIGN SERVICE @H1A */
void *cvtbuf; /* - ADDRESS OF THE BUFFER OF THE RESIDENT */
void *cvtxapg; /* - ADDRESS OF I/O SUPERVISOR APPENDAGE VECTOR */
void *cvt0vl00; /* - ADDRESS OF ENTRY POINT OF THE TASK */
void *cvtpcnvt; /* - ADDRESS OF ENTRY POINT OF THE ROUTINE */
void *cvtprltv; /* - ADDRESS OF ENTRY POINT OF THE ROUTINE */
void *cvtllcb; /* - ADDRESS OF THE LLCB. @P1M */
void *cvtlltrm; /* - ADDRESS OF LLA'S MEMORY TERNIMATION @P1M */
void *cvtxtler; /* - ADDRESS OF ERROR RECOVERY PROCEDURE (ERP) */
void *cvtsysad; /* - UCB ADDRESS FOR THE SYSTEM RESIDENCE */
void *cvtbterm; /* - ADDRESS OF ENTRY POINT OF THE ABTERM */
int cvtdate; /* - CURRENT DATE IN PACKED DECIMAL */
void *cvtmslt; /* - ADDRESS OF THE MASTER COMMON AREA IN */
void *cvtzdtab; /* - ADDRESS OF I/O DEVICE */
void *cvtxitp; /* - ADDRESS OF ERROR INTERPRETER ROUTINE */
void *cvt0ef01; /* ENTRY POINT IN STAGE II EXIT EFFECTOR @02C */
struct
{
short int _cvtvss; /* VECTOR SECTION SIZE @D5A */
short int _cvtvpsm; /* VECTOR PARTIAL SUM NUMBER @D5A */
} cvtvprm;
short int cvtexit; /* - AN SVC 3 INSTRUCTION. EXIT TO @PBA */
short int cvtbret; /* - A BR 14 INSTRUCTION. RETURN TO @PBA */
void *cvtsvdcb; /* - ADDRESS OF THE DCB FOR THE SYS1.SVCLIB */
void *cvttpc; /* - ADDRESS OF THE TIMER SUPERVISOR WORK AREA */
struct {
unsigned char _cvtflgc0; /* - Flags @0IA */
unsigned char _cvtflgc1; /* - Flags @0IA */
short int _cvticpid; /* - IPL'ED CPU PHYSICAL ID @ZA51978 */
} cvtflgcs;
unsigned char cvtcvt[4]; /* - CVT ACRONYM IN EBCDIC (EYE-CATCHER) @PCA */
void *cvtcucb; /* - ADDRESS OF THE UNIT CONTOL MODULE (UCM) */
void *cvtqte00; /* - ADDRESS OF THE TIMER ENQUEUE ROUTINE FOR */
void *cvtqtd00; /* - ADDRESS OF THE TIMER DEQUEUE ROUTINE FOR */
void *cvtstb; /* - ADDRESS OF THE I/O DEVICE @LDC */
unsigned char cvtdcb; /* - OPERATING SYSTEM FOR @LGC */
int cvtdcba : 24; /* - ADDRESS OF THE DCB FOR THE SYS1.LOGREC */
int cvtsv76m; /* - SVC 76 MESSAGE COUNT FIELD (OS/VS2) */
void *cvtixavl; /* - ADDRESS OF THE I/O SUPERVISOR'S FREELIST */
void *cvtnucb; /* - RESERVED (MDCXXX) @YA19285 */
void *cvtfbosv; /* - ADDRESS OF PROGRAM FETCH ROUTINE @G860P46 */
void *cvt0ds; /* - ADDRESS OF ENTRY POINT OF THE DISPATCHER */
void *cvtecvt; /* - POINTER TO THE EXTENDED CVT @LJC */
void *cvtdairx; /* - ADDRESS OF THE 31- BIT ENTRY @L4A */
void *cvtmser; /* - ADDRESS OF DATA AREA OF MASTER SCHEDULER */
void *cvt0pt01; /* - ADDRESS OF BRANCH ENTRY POINT OF POST */
void *cvttvt; /* - ADDRESS OF TSO VECTOR TABLE @ZA65725 */
int cvt040id; /* - IFB040I WTO MESSAGE ID. @09C */
unsigned char cvtmz00[4]; /* - HIGHEST ADDRESS IN VIRTUAL STORAGE FOR */
void *cvt1ef00; /* - ADDRESS OF ROUTINE WHICH CREATES IRB'S */
void *cvtqocr; /* - GRAPHICS INTERFACE TASK (GFX) FIELD. */
void *cvtqmwr; /* - ADDRESS OF THE ALLOCATION COMMUNICATION */
short int cvtsnctr; /* - SERIAL NUMBER COUNTER FOR ASSIGNING SERIAL */
unsigned char cvtopta; /* - OPTION INDICATORS @LBC */
unsigned char cvtoptb; /* - MISCELLANEOUS FLAGS @LBC */
void *cvtqcdsr; /* - CDE SEARCH ROUTINE ADDRESS (OS/VS2) */
void *cvtqlpaq; /* - ADDRESS OF POINTER TO MOST RECENT ENTRY */
void *cvtenfct; /* EVENT NOTIFICATION CONTROL TABLE */
void *cvtsmca; /* - ADDRESS OF THE SYSTEM MANAGEMENT CONTROL */
void *cvtabend; /* - ADDRESS OF SECONDARY CVT FOR ABEND IN EOT */
void *cvtuser; /* - A WORD AVAILABLE TO THE USER */
void *cvtmdlds; /* - RESERVED FOR MODEL-DEPENDENT SUPPORT */
short int cvtqabst; /* - AN SVC 13 (ABEND) INVOCATION (OS/VS2) @PDA */
short int cvtlnksc; /* - AN SVC 6 (LINK) INVOCATION @PDA */
void *cvttsce; /* - ADDRESS OF THE FIRST TIME SLICE CONTROL */
void *cvtpatch; /* - ADDRESS OF A 200-BYTE FE PATCH AREA */
void *cvtrms; /* - RECOVERY MANAGEMENT SUPPORT (RMS) */
void *cvtspdme; /* - SERVICE PROCESSOR DAMAGE MONITOR @ZA57793 */
void *cvt0scr1; /* - ADDRESS OF THE SECTOR CALCULATION ROUTINE */
struct
{
unsigned char _cvtgtfst; /* - GTF FLAG BYTES ICB312 */
int _cvtgtfa : 24; /* -ADDRESS OF MAIN MONITOR CALL ROUTING */
} cvtgtf;
struct
{
unsigned char _cvttcmfg; /* - TCAM FLAGS */
int _cvtaqavb : 24; /* - SAME AS CVTAQAVT ABOVE */
} cvtaqavt;
unsigned char cvtrs0f4[4]; /* RESERVED @LFC */
void *cvtsaf; /* - ADDRESS OF ROUTER VECTOR TABLE. @L5A */
void *cvtext1; /* - ADDRESS OF OS - OS/VS COMMON EXTENSION */
void *cvtcbsp; /* - ADDRESS OF ACCESS METHOD CONTROL BLOCK */
struct
{
unsigned char _filler1; /* - RESERVED - FIRST BYTE OF CVTPURG @LFC */
int _cvtpurga : 24; /* - ADDRESS OF SUBSYSTEM PURGE ROUTINE ICB330 */
} cvtpurg;
unsigned char cvtamff[4]; /* - RESERVED FOR ACCESS METHOD FLAGS ICB436 */
void *cvtqmsg; /* - ADDRESS OF INFORMATION TO BE @G860P46 */
struct
{
unsigned char _cvtdmsrf; /* - OPEN/CLOSE/EOV FLAG BYTE. SETTING BOTH */
int _cvtdmsra : 24; /* - ADDRESS OF THE OPEN/CLOSE/EOV SUPERVISORY */
} cvtdmsr;
void *cvtsfr; /* - ADDRESS OF SETFRR ROUTINE @G383P9A */
void *cvtgxl; /* - ADDRESS OF CONTENTS SUPERVISION @G860P46 */
void *cvtreal; /* - ADDRESS OF THE VIRTUAL STORAGE @G860P46 */
void *cvtptrv; /* - ADDRESS OF PAGING SUPERVISOR GENERAL @L1C */
void *cvtihvp; /* - POINTER TO IHV$COMM. INITIALIZED TO @06C */
void *cvtjesct; /* - ADDRESS OF JOB ENTRY SUBSYSTEM (JES) */
unsigned char cvtrs12c[4]; /* - RESERVED @LFC */
int cvttz; /* - Difference between local time and UTC */
void *cvtmchpr; /* - ADDRESS OF MACHINE CHECK PARAMETER LIST */
void *cvteorm; /* - POTENTIAL REAL HIGH STORAGE ADDRESS. @LBC */
void *cvtptrv3; /* - ADDRESS OF PAGING SUPERVISOR ROUTINE @L1A */
void *cvtlkrm; /* ADDRESS OF CML LOCK RESOURCE @G860P46 */
struct
{
unsigned char _filler2; /* - RESERVED - FIRST BYTE OF CVTAPF @LFC */
int _cvtapfa : 24; /* ADDRESS OF BRANCH ENTRY POINT IN */
} cvtapf;
void *cvtext2;
struct
{
unsigned char _filler4; /* - RESERVED - FIRST BYTE OF CVTHJES @LFC */
int _cvthjesa : 24; /* - ADDRESS OF OPTIONAL JOB ENTRY SUBSYSTEM */
} cvthjes;
struct
{
unsigned char _cvtrstcp; /* - LOGICAL CPU ADDRESS OF TARGET OF @ZA84941 */
unsigned char _cvtrstrs; /* - RESTART REASON. @ZA84941 */
unsigned char _filler5[2]; /* - RESERVED FOR RESTART FLIH @ZA84941 */
} cvtrstw2;
unsigned char cvtsname[8]; /* SYSTEM NAME FOR CURRENT SYSTEM. */
void *cvtgetl; /* - ADDRESS OF IKJGETL, TSO GET LINE ROUTINE */
void *cvtlpdsr; /* - ADDRESS OF LINK PACK AREA (LPA) DIRECTORY */
void *cvtpvtp; /* - ADDRESS OF PAGE VECTOR TABLE */
struct
{
unsigned char _cvtdirst; /* - FLAG BYTE @ZA65734 */
int _cvtlpdir : 24; /* - ADDRESS OF LINK PACK AREA (LPA) DIRECTORY */
} cvtlpdia;
void *cvtrbcb; /* - ADDRESS OF THE RECORD BUFFER'S @LEC */
unsigned char cvtrs170[4]; /* - RESERVED @LFC */
struct
{
unsigned char _cvtsylk; /* - SUPERVISOR LOCK. ONLY ENABLED TASKS MAY */
int _cvtslid : 24; /* - SAME AS CVTSLIDA ABOVE @ZA65734 */
} cvtslida;
struct
{
unsigned char _cvtflag1; /* - FLAG BYTE @0CC */
unsigned char _cvtflag2; /* - FLAG BYTE @0CA */
unsigned char _cvtflag3; /* - FLAG BYTE @0CA */
unsigned char _cvtflag4; /* - FLAG BYTE @0CA */
} cvtflags;
void *cvtrt03; /* - ADDRESS OF SRB TIMING @G383P9A */
unsigned char cvtrs180[8]; /* - RESERVED @LOC */
void *cvtexsnr; /* - ADDRESS OF EXCESSIVE SPIN NOTIFICATION */
unsigned char cvtexsnl; /* - SERIALIZATION BYTE FOR EXCESSIVE SPIN */
unsigned char cvtspvlk; /* - NUMBER OF TASKS WHICH HAVE TERMINATED */
unsigned char cvtctlfg; /* - SYSTEM CONTROL FLAGS @LBC */
char cvtapg; /* - DISPATCHING PRIORITY OF AUTOMATIC PRIORITY */
unsigned char cvttrace[2]; /* - RESERVED @(DCR670) @G860P46 */
unsigned char cvttrac2[2]; /* - RESERVED @(DCR670) @G860P46 */
void *cvtrscn; /* - ADDRESS OF ROUTINE TO SCAN TCB TREE */
void *cvttas; /* - ADDRESS OF ROUTINE TO TRANSFER ADDRESS */
void *cvttrcrm; /* - ADDRESS POINTER OF THE SYSTEM @G860P46 */
void *cvtshrvm; /* - LOWEST ADDRESS OF SHARED VIRTUAL STORAGE */
void *cvt0vl01; /* - ENTRY POINT ADDRESS OF VALIDITY CHECK */
void *cvtppgmx; /* - ADDRESS POINTER FOR MVS/370-XA. @G860P46 */
unsigned char cvtgrsst; /* - GRS status. SERIALIZATION: None. @0DA */
unsigned char cvtrs1ad; /* - Reserved @NJC */
unsigned char cvtbsm0f[2]; /* - Return via reg 15, BSM 0,15 @NJA */
void *cvtgvt; /* - ADDRESS OF THE GRS VECTOR TABLE @G383P9A */
void *cvtascrf; /* - CREATED ASCB QUEUE HEADER */
void *cvtascrl; /* - CREATED ASCB QUEUE TRAILER */
void *cvtputl; /* - ADDRESS OF IKJPUTL, TSO PUT LINE ROUTINE */
void *cvtsrbrt; /* - DISPATCHER RETURN ADDRESS FOR SRB ROUTINES */
void *cvtolt0a; /* - BRANCH ENTRY TO OLTEP MEMORY TERMINATION */
void *cvtsmfex; /* - BRANCH ENTRY TO SYSTEM MANAGEMENT */
void *cvtcspie; /* - ENTRY POINT ADDRESS OF THE SUPERVISOR */
void *cvtptgt; /* - ADDRESS OF IKJPTGT, TSO PUTGET ROUTINE */
unsigned char cvtsigpt; /* - SIGP TIMEOUT VALUE. @07A */
unsigned char cvtspdmc; /* - SERVICE PROCESSOR DAMAGE MACHINE @ZA57793 */
unsigned char cvtdssac; /* - DYNAMIC SUPPORT SYSTEM (DSS) ACTIVATED */
unsigned char cvtrs1d7; /* - RESERVED @LFC */
void *cvtstck; /* - ADDRESS OF IKJSTCK, TSO STACK ROUTINE */
short int cvtmaxmp; /* - Maximum CPU address available for */
unsigned char cvtbsm2[2]; /* - RETURN VIA REG 2, BSM 0,2. @L4A */
void *cvtscan; /* - ADDRESS OF IKJSCAN, TSO SCAN ROUTINE */
void *cvtauthl; /* - POINTER TO AUTHORIZED LIBRARY TABLE. @LWC */
void *cvtbldcp; /* - BRANCH ENTRY TO BUILD POOL MDC003 */
void *cvtgetcl; /* - BRANCH ENTRY TO GET CELL MDC004 */
void *cvtfrecl; /* - BRANCH ENTRY TO FREE CELL MDC005 */
void *cvtdelcp; /* - BRANCH ENTRY TO DELETE POOL MDC006 */
void *cvtcrmn; /* - BRANCH ENTRY TO SVC 120 (GETMAIN/FREEMAIN */
void *cvtcras; /* - POINTER DEFINED ADDRESS OF BRANCH @G860PVB */
void *cvtqsas; /* - POINTER DEFINED ADDRESS OF @G860PVB */
void *cvtfras; /* - POINTER DEFINED ENTRY TO TASK @G860PVB */
void *cvts1ee; /* - BRANCH ENTRY TO STAGE 1 EXIT EFFECTOR */
void *cvtpars; /* - ADDRESS OF IKJPARS, TSO PARSE ROUTINE */
void *cvtquis; /* - BRANCH ENTRY TO QUIESCE MDC013 */
void *cvtstxu; /* - BRANCH ENTRY TO ATTENTION EXIT EPILOGUE */
void *cvtopte; /* - BRANCH ENTRY ADDRESS TO SYSEVENT MDC015 */
void *cvtsdrm; /* - BRANCH ENTRY ADDRESS OF THE RESOURCE */
void *cvtcsrt; /* - POINTER TO CALLABLE SERVICE REQUEST @D9C */
void *cvtaqtop; /* - POINTER TO THE ALLOCATION QUEUE @G860P46 */
void *cvtvvmdi; /* - CONSTANT USED BY PAGED LINK PACK AREA */
void *cvtasvt; /* - POINTER TO ADDRESS SPACE VECTOR TABLE */
void *cvtgda; /* - POINTER TO GLOBAL DATA AREA (GDA) IN SQA */
void *cvtascbh; /* - POINTER TO HIGHEST PRIORITY ADDRESS SPACE */
void *cvtascbl; /* - POINTER TO LOWEST PRIORITY ASCB ON THE */
void *cvtrtmct; /* - POINTER TO RECOVERY/TERMINATION CONTROL */
void *cvtsv60; /* - BRANCH ENTRY ADDRESS FOR @D8C */
void *cvtsdmp; /* - ADDRESS OF SVC DUMP BRANCH @G860P46 */
void *cvtscbp; /* - ADDRESS OF SCB PURGE RESOURCE @G860P46 */
unsigned char cvtsdbf[4]; /* - Address of 4K SQA buffer used by SVC */
void *cvtrtms; /* - ADDRESS OF SERVICABILITY LEVEL INDICATOR */
void *cvttpios; /* - ADDRESS OF THE TELEPROCESSING I/O */
void *cvtsic; /* - BRANCH ADDRESS OF THE ROUTINE TO SCHEDULE */
void *cvtopctp; /* - ADDRESS OF SYSTEM RESOURCES MANAGER (SRM) */
void *cvtexpro; /* - ADDRESS OF EXIT PROLOGUE/TYPE 1 EXIT */
void *cvtgsmq; /* - ADDRESS OF GLOBAL SERVICE MANAGER QUEUE */
void *cvtlsmq; /* - ADDRESS OF LOCAL SERVICE MANAGER QUEUE */
unsigned char cvtrs26c[4]; /* - RESERVED. @LZC */
void *cvtvwait; /* - ADDRESS OF WAIT ROUTINE MDC048 */
void *cvtparrl; /* - ADDRESS OF PARTIALLY LOADED @G860P46 */
void *cvtapft; /* - ADDRESS OF AUTHORIZED PROGRAM FACILITY */
void *cvtqcs01; /* - BRANCH ENTRY ADDRESS TO PROGRAM MANAGER */
int cvtfqcb; /* - FORMERLY USED BY ENQ/DEQ. @G383P9A */
int cvtlqcb; /* - FORMERLY USED BY ENQ/DEQ. @G383P9A */
void *cvtrenq; /* - RESOURCE MANAGER ADDRESS FOR ENQ @G860P46 */
void *cvtrspie; /* - RESOURCE MANAGER FOR @G860P46 */
void *cvtlkrma; /* - RESOURCE MANAGER ADDRESS FOR LOCK @G860P46 */
void *cvtcsd; /* - VIRTUAL ADDRESS OF COMMON SYSTEM DATA AREA */
void *cvtdqiqe; /* - RESOURCE MANAGER FOR EXIT @G860P46 */
void *cvtrpost; /* - RESOURCE MANAGER FOR POST. @G860P46 */
void *cvt062r1; /* - BRANCH ENTRY TO DETACH MDC060 */
void *cvtveac0; /* - ASCBCHAP BRANCH ENTRY MDC061 */
void *cvtglmn; /* - GLOBAL BRANCH ENTRY ADDRESS FOR */
void *cvtspsa; /* - POINTER TO GLOBAL WORK/SAVE AREA VECTOR */
void *cvtwsal; /* - ADDRESS OF TABLE OF LENGTHS OF LOCAL */
void *cvtwsag; /* - ADDRESS OF TABLE OF LENGTHS OF GLOBAL */
void *cvtwsac; /* - ADDRESS OF TABLE OF LENGTHS OF CPU */
void *cvtrecrq; /* - ADDRESS OF THE RECORDING REQUEST @G860P46 */
void *cvtasmvt; /* - POINTER TO AUXILIARY STORAGE MANAGEMENT */
void *cvtiobp; /* - ADDRESS OF THE BLOCK PROCESSOR CVT */
void *cvtspost; /* - POST RESOURCE MANAGER TERMINATION ROUTINE */
struct
{
short int _cvtrstci; /* - CPU ID OF THE CPU HOLDING THE @ZA84941 */
unsigned char _cvtrstri[2]; /* - IDENTIFIER OF OWNING ROUTINE @ZA84941 */
} cvtrstwd;
void *cvtfetch; /* - ADDRESS OF ENTRY POINT FOR BASIC @G860P46 */
void *cvt044r2; /* - ADDRESS OF IGC044R2 IN CHAP SERVICE */
void *cvtperfm; /* - ADDRESS OF THE PERFORMANCE WORK AREA. */
void *cvtdair; /* - ADDRESS OF IKJDAIR, TSO DYNAMIC */
void *cvtehdef; /* - ADDRESS OF IKJEHDEF, TSO DEFAULT @G860P46 */
void *cvtehcir; /* - ADDRESS OF IKJEHCIR, TSO CATALOG @G860P46 */
void *cvtssap; /* - ADDRESS OF SYSTEM SAVE AREA @ZA65734 */
void *cvtaidvt; /* - POINTER TO APPENDAGE ID VECTOR TABLE */
void *cvtipcds; /* - BRANCH ENTRY FOR DIRECT SIGNAL */
void *cvtipcri; /* - BRANCH ENTRY FOR REMOTE IMMEDIATE */
void *cvtipcrp; /* - BRANCH ENTRY FOR REMOTE PENDABLE */
void *cvtpccat; /* - POINTER TO PHYSICAL CCA VECTOR TABLE */
void *cvtlccat; /* - POINTER TO LOGICAL CCA VECTOR TABLE */
void *cvtxsft; /* - ADDRESS OF SYSTEM FUNCTION TABLE @G383P9A */
void *cvtxstks; /* - ADDRESS OF PCLINK STACK @G383P9A */
void *cvtxstkn; /* - ADDRESS OF PCLINK STACK (SAVE=NO) @G383P9A */
void *cvtxunss; /* - ADDRESS OF PCLINK UNSTACK @G383P9A */
void *cvtpwi; /* - ADDRESS OF THE WINDOW INTERCEPT ROUTINE */
void *cvtpvbp; /* - ADDRESS OF THE VIRTUAL BLOCK PROCESSOR */
void *cvtmfctl; /* - POINTER TO MEASUREMENT FACILITY CONTROL */
void *cvtmfrtr; /* - IF MEASUREMENT FACILITY IS ACTIVE, */
void *cvtvpsib; /* - BRANCH ENTRY TO PAGE SERVICES @G860PVB */
void *cvtvsi; /* - POINTER DEFINED, BRANCH ENTRY @G860P46 */
void *cvtexcl; /* - ADDRESS POINTER TO THE EXCP @D3A */
void *cvtxunsn; /* - ADDRESS OF PCLINK UNSTACK @G383P9A */
void *cvtisnbr; /* - ENTRY POINT ADDRESS OF DISABLED @LLA */
void *cvtxextr; /* - ADDRESS OF PCLINK EXTRACT ROUTINE */
void *cvtmsfrm; /* - ADDRESS OF THE PROCESSOR @G860P46 */
void *cvtscpin; /* - ADDRESS OF IPL-TIME SCPINFO DATA @NAC */
void *cvtwsma; /* ADDRESS OF WAIT STATE MESSAGE AREA @LLC */
void *cvtrmbr; /* - ADDRESS OF REGMAIN BRANCH ENTRY. MDC123 */
void *cvtlfrm; /* - LIST FORMAT FREEMAIN BRANCH ENTRY MDC124 */
void *cvtgmbr; /* - LIST FORMAT GETMAIN BRANCH ENTRY MDC125 */
void *cvt0tc0a; /* - ADDRESS OF TASK CLOSE MODULE MDC128 */
int cvtrlstg; /* - SIZE OF ACTUAL REAL STORAGE ONLINE @0GC */
void *cvtspfrr; /* - 'SUPER FRR' ADDRESS (ADDRESS OF @G860P46 */
unsigned char cvtrs360[4]; /* - RESERVED. @LZC */
void *cvtsvt; /* - ADDRESS POINTER FOR FETCH */
void *cvtirecm; /* - ADDRESS OF INITIATOR RESOURCE MDC158 */
void *cvtdarcm; /* - ADDRESS OF DEVICE ALLOCATION MDC159 */
void *cvt0pt02; /* - ADDRESS OF POST ENTRY POINT MDC160 */
unsigned char cvtrs374[4]; /* RESERVED @LOC */
void *cvtwtcb; /* - ADDRESS OF WAIT STATE TCB. MDC164 */
void *cvtvacr; /* - ACR/VARY CPU CHANNEL RECOVERY MDC178 */
void *cvtrecon; /* - VARY CPU SHUTDOWN ROUTINE @G860PVB */
void *cvtgtfr8; /* - GENERALIZED TRACE FACILITY (GTF) MDC180 */
void *cvtvstop; /* - ADDRESS OF VARY CPU STOP CPU MDC169 */
void *cvtvpsa; /* - ADDRESS OF COPY OF SYSGEN'ED PSA - MDC170 */
void *cvtrmptt; /* - ADDRESS OF ISTRAMA1, THE VTAM @Z30AP9A */
void *cvtrmpmt; /* - ADDRESS OF ISTRAMA2, THE VTAM @Z30AP9A */
void *cvtexp1; /* - ADDRESS OF EXIT PROLOGUE WHICH MDC173 */
void *cvtcsdrl; /* - REAL ADDRESS OF COMMON SYSTEM DATA MDC174 */
void *cvtssrb; /* - STATUS STOP SRB ENTRY. MDC175 */
unsigned char cvtrs3a4[4]; /* - RESERVED @LFC */
void *cvtqv1; /* - ADDRESS OF QUEUE VERIFICATION FOR MDC181 */
void *cvtqv2; /* - ADDRESS OF QUEUE VERIFICATION FOR MDC182 */
void *cvtqv3; /* - ADDRESS OF QUEUE VERIFICATION FOR MDC183 */
void *cvtgsda; /* - ADDRESS OF GLOBAL SYSTEM DUPLEX @L7C */
void *cvtadv; /* - ADDRESS OF ADDRESS VERIFICATION MDC186 */
void *cvttpio; /* - ADDRESS OF VTAM TPIO (SVC 124) MDC193 */
unsigned char cvtrs3c0[4]; /* - RESERVED @LFC */
void *cvtevent; /* - BRANCH ENTRY ADDRESS TO EVENTS @G860P46 */
void *cvtsscr; /* - ADDRESS OF STORAGE SYSTEM @Z30LP9A */
void *cvtcbbr; /* - BRANCH ENTRY ADDRESS TO @Z30EN9A */
void *cvteff02; /* - ADDRESS OF IKJEFF02, TSO MESSAGE @ZM30972 */
void *cvtlsch; /* - ADDRESS OF LOCAL SCHEDULE. @G50EP9A */
void *cvtcdeq; /* - ADDRESS OF PROGRAM MANAGER @G50EP9A */
void *cvthsm; /* - POINTER TO HIERARCHICAL STORAGE @ZA27771 */
void *cvtrac; /* - ADDRESS OF ACCESS CONTROL CVT. @Z40RP9A */
void *cvtcgk; /* - ADDRESS OF ROUTINE USED TO CHANGE @G860P46 */
void *cvtsrm; /* - ADDRESS OF ENTRY TABLE FOR SRM, @G50IP9A */
void *cvt0pt0e; /* - ENTRY POINT TO IDENTIFY POST EXIT @Z40EP9A */
void *cvt0pt03; /* - POST REINVOCATION ENTRY POINT @Z40EP9A */
void *cvttcasp; /* - POINTER TO THE TSO/VTAM TERMINAL @Z40DQ9A */
void *cvtcttvt; /* - CTT VT @PVC */
void *cvtjterm; /* - POINTER DEFINED ADDRESS OF @G860PVB */
void *cvtrsume; /* - ADDRESS OF RESUME FUNCTION. @G383P9A */
void *cvttctl; /* - ADDRESS OF TRANSFER CONTROL @Z40FP9A */
void *cvtrmt; /* - ADDRESS OF RESOURCE MANAGER @LGC */
void *cvtt6svc; /* - ENTRY POINT ADDRESS FOR TYPE 6 @Z40FP9A */
void *cvtsusp; /* - ADDRESS OF SUSPEND ROUTINE. @Z40FP9A */
void *cvtihasu; /* - ADDRESS OF BIT STRING. (MDC355) @Z404P9A */
void *cvtsfv; /* - ADDRESS OF SETFRR ROUTINE ABOVE 16M @N3A */
void *cvtidevn; /* - ADDRESS OF DEVICE NUMBER CONVERSION @LGC */
void *cvtsmf83; /* - ADDRESS OF BRANCH ENTRY TO @G741P9A */
void *cvtsmfsp; /* - ADDRESS OF SMF SUSPEND HANDLER. @G860P46 */
void *cvtmsfcb; /* - ADDRESS OF MAINTENANCE AND @G871A9A */
void *cvthid; /* - ADDRESS OF SCP HOST ID. @(DCR819) @G860P46 */
void *cvtpsxm; /* - ADDRESS OF CROSS MEMORY PAGE @G860PVB */
void *cvtucbsc; /* - ADDRESS OF UCB SCAN @G860P46 */
void *cvttpur; /* - DDR QUEUE OF TAPE UNIT-RECORD @L2A */
void *cvtdpur; /* - DDR QUEUE OF DASD SWAP REQUESTS. @L2A */
void *cvttrpos; /* - DDR QUEUE OF TAPES TO BE @L2A */
void *cvtrestx; /* - VIRTUAL ADDRESS OF TEXT TO BE @L2A */
short int cvtxcpct; /* - MAXIMUM EXCP COUNT PER ADDRESS @L2A */
short int cvtcall; /* - A BASSM 14,15 INSTRUCTION. POINTER @PDA */
void *cvtvfind; /* - THE POINTER TO VIRTUAL FETCH BUILD @L8A */
void *cvtvfget; /* - THE POINTER TO VIRTUAL FETCH GET @L8A */
void *cvtvfmem; /* RESERVED. THIS FIELD IS NO LONGER @MLC */
void *cvtvfcb; /* - THE POINTER TO VIRTUAL FETCH INTERNAL @L8A */
void *cvtpgser; /* - POINTER DEFINED ADDRESS OF ENTRY @G860P46 */
void *cvttski; /* - POINTER DEFINED ADDRESS OF TASK @G860PVB */
void *cvtcpgub; /* - POINTER DEFINED ADDRESS OF CPOOL @G860PVB */
void *cvtcpgup; /* - POINTER DEFINED ADDRESS OF CPOOL @G860PVB */
void *cvtcpgtc; /* - POINTER DEFINED ADDRESS OF GET @G860PVB */
void *cvtcpfre; /* - POINTER DEFINED ADDRESS OF CPOOL @G860PVB */
void *cvtslist; /* - POINTER DEFINED ADDRESS OF VSM @G860PVB */
void *cvtsregn; /* - POINTER DEFINED ADDRESS OF VSM @G860PVB */
void *cvtsloc; /* - POINTER DEFINED ADDRESS OF VSM @G860PVB */
void *cvtcpbdb; /* - POINTER DEFINED ADDRESS OF CPOOL @G860PVB */
void *cvtcpdlb; /* - POINTER DEFINED ADDRESS OF CPOOL @G860PVB */
void *cvtdoffs; /* - STARTING REAL ADDRESS OF DAT-OFF @G860PVB */
void *cvtdoffe; /* - ENDING REAL ADDRESS OF DAT-OFF @G860PVB */
void *cvtrcep; /* - ADDRESS OF THE RSM CONTROL AND @G860PVB */
void *cvtcpgus; /* - ADDRESS OF CPOOL GET @G860P46 */
void *cvtgrrgn; /* - POINTER DEFINED ADDRESS OF GET @G860PVB */
void *cvtgvrgn; /* - POINTER DEFINED ADDRESS OF GET @G860PVB */
unsigned char cvtionlv; /* - DEFAULT VALUE OF @G860P46 */
unsigned char cvtrs4a1[3]; /* - RESERVED @LFC */
unsigned char cvtrczrt[2]; /* - SET REGISTER 15 TO ZERO. @G860PVB */
unsigned char _filler6[2]; /* - RETURN VIA A BSM. @G860PVB */
unsigned char cvtfunc[4]; /* - Reserved for solution/offering use. @M6A */
void *cvtsmext; /* - ADDRESS OF STORAGE MAP EXTENSION. @G860PVB */
void *cvtnucmp; /* - ADDRESS OF NUCLEUS MAP. @G860PVB */
unsigned char cvtxafl; /* - FLAG BYTE FOR MVS/XA PROCESSING. @G860P46 */
unsigned char cvtrs4b5[3]; /* - RESERVED @LFC */
void *cvtvtam; /* - ADDRESS OF VTAM COMMAND PROCESSOR @G860P46 */
void *cvtspip; /* - ADDRESS OF RTM INTERFACE TO @ZA65734 */
struct
{
void *_cvtdfa; /* - ADDRESS OF DFP ID TABLE, MAPPED BY @P8A */
} cvtckras;
void *cvtnvt0; /* - ADDRESS OF DATA IN DAT-ON NUCLEUS @G860P46 */
void *cvtcsomf; /* - OWNER OF CHANNEL MEASUREMENT @G860P46 */
void *cvtcsoal; /* - OWNER OF ADDRESS LIMIT FACILITY. @G860P46 */
void *cvtichpt; /* - ADDRESS OF THE INSTALLED CHANNEL @G860P46 */
void *cvtcsocr; /* - CHANNEL SUBSYSTEM OWNER - CHANNEL @G860P46 */
void *cvtcsocs; /* - CHANNEL SUBSYSTEM OWNER - CHANNEL @G860P46 */
void *cvtllta; /* - LINK LIST TABLE ADDRESS. @G860P46 */
void *cvtdcqa; /* - ADDRESS OF DEVICE CLASS QUEUE @LDC */
void *cvtucba; /* - ADDRESS OF THE FIRST UCB IN THE @LDC */
void *cvtvestu; /* - ADDRESS OF THE ENTRY POINT OF THE @G860P46 */
void *cvtnuclu; /* - ADDRESS TO SUPPORT THE NUCLEUS @G860P46 */
struct
{
unsigned char _cvtoslv0; /* BYTE 0 OF CVTOSLVL @LRC */
unsigned char _cvtoslv1; /* BYTE 1 OF CVTOSLVL @MBC */
unsigned char _cvtoslv2; /* BYTE 2 OF CVTOSLVL @PTC */
unsigned char _cvtoslv3; /* BYTE 3 OF CVTOSLVL @NDC */
unsigned char _cvtoslv4; /* BYTE 4 OF CVTOSLVL @0KC */
unsigned char _cvtoslv5; /* BYTE 5 OF CVTOSLVL @NIC */
unsigned char _cvtoslv6; /* BYTE 6 OF CVTOSLVL @LGA */
unsigned char _cvtoslv7; /* BYTE 7 OF CVTOSLVL @LGA */
unsigned char _cvtoslv8; /* BYTE 8 OF CVTOSLVL @N9C */
unsigned char _cvtoslv9; /* BYTE 9 OF CVTOSLVL @LGA */
unsigned char _cvtoslva; /* BYTE 10 OF CVTOSLVL @LGA */
unsigned char _cvtoslvb; /* BYTE 11 OF CVTOSLVL @LGA */
unsigned char _cvtoslvc; /* BYTE 12 OF CVTOSLVL @LGA */
unsigned char _cvtoslvd; /* BYTE 13 OF CVTOSLVL @LGA */
unsigned char _cvtoslve; /* BYTE 14 OF CVTOSLVL @LGA */
unsigned char _cvtoslvf; /* BYTE 15 OF CVTOSLVL @LGA */
} cvtoslvl;
};
#define cvtvss cvtvprm._cvtvss
#define cvtvpsm cvtvprm._cvtvpsm
#define cvtflgc0 cvtflgcs._cvtflgc0
#define cvtflgc1 cvtflgcs._cvtflgc1
#define cvticpid cvtflgcs._cvticpid
#define cvtgtfst cvtgtf._cvtgtfst
#define cvtgtfa cvtgtf._cvtgtfa
#define cvttcmfg cvtaqavt._cvttcmfg
#define cvtaqavb cvtaqavt._cvtaqavb
#define cvtpurga cvtpurg._cvtpurga
#define cvtdmsrf cvtdmsr._cvtdmsrf
#define cvtdmsra cvtdmsr._cvtdmsra
#define cvtapfa cvtapf._cvtapfa
#define cvtext2a cvtext2._cvtext2a
#define cvthjesa cvthjes._cvthjesa
#define cvtrstcp cvtrstw2._cvtrstcp
#define cvtrstrs cvtrstw2._cvtrstrs
#define cvtdirst cvtlpdia._cvtdirst
#define cvtlpdir cvtlpdia._cvtlpdir
#define cvtsylk cvtslida._cvtsylk
#define cvtslid cvtslida._cvtslid
#define cvtflag1 cvtflags._cvtflag1
#define cvtflag2 cvtflags._cvtflag2
#define cvtflag3 cvtflags._cvtflag3
#define cvtflag4 cvtflags._cvtflag4
#define cvtrstci cvtrstwd._cvtrstci
#define cvtrstri cvtrstwd._cvtrstri
#define cvtdfa cvtckras._cvtdfa
#define cvtoslv0 cvtoslvl._cvtoslv0
#define cvtoslv1 cvtoslvl._cvtoslv1
#define cvtoslv2 cvtoslvl._cvtoslv2
#define cvtoslv3 cvtoslvl._cvtoslv3
#define cvtoslv4 cvtoslvl._cvtoslv4
#define cvtoslv5 cvtoslvl._cvtoslv5
#define cvtoslv6 cvtoslvl._cvtoslv6
#define cvtoslv7 cvtoslvl._cvtoslv7
#define cvtoslv8 cvtoslvl._cvtoslv8
#define cvtoslv9 cvtoslvl._cvtoslv9
#define cvtoslva cvtoslvl._cvtoslva
#define cvtoslvb cvtoslvl._cvtoslvb
#define cvtoslvc cvtoslvl._cvtoslvc
#define cvtoslvd cvtoslvl._cvtoslvd
#define cvtoslve cvtoslvl._cvtoslve
#define cvtoslvf cvtoslvl._cvtoslvf
/* Values for field "cvtflgc0" */
#define cvtmulnf 0x80 /* - For users of IFAUSAGE, REQUEST=FUNCTIONxxx */
/* Values for field "cvtdcb" */
#define cvtmvse 0x80 /* - S/370-XA MODE EXECUTION @G860PVB */
#define cvt1sss 0x40 /* - OPTION 1 (PCP) SSS. ALSO, LANGUAGE @H3C */
#define cvt2sps 0x20 /* - OPTION 2 (MFT) SPS, OS/VS1, VSE @PHC */
#define cvt4ms1 0x10 /* - OPTION 4 (MVT) MS1, OS/VS2 */
#define cvtosext 0x08 /* - INDICATOR THAT THE CVTOSLVL AREA IS @LGA */
#define cvt4mps 0x04 /* - MODEL 65 MULTIPROCESSING */
#define cvt6dat 0x02 /* - DYNAMIC ADDRESS TRANSLATION BY CPU */
#define cvtmvs2 0x01 /* - MULTIPLE MEMORY OPTION OF OS/VS2 IS */
#define cvt8aos2 0x12 /* - OS/VS2 SYSTEM */
/* Values for field "cvtopta" */
#define cvtcch 0x80 /* - CHANNEL CHECK HANDLER (CCH) OPTION PRESENT */
#define cvtapr 0x40 /* - ALTERNATE PATH RETRY (APR) OPTION PRESENT */
#define cvtddr 0x20 /* - DYNAMIC DEVICE RECONFIGURATION (DDR) */
#define cvtnip 0x10 /* - NIP IS EXECUTING */
#define cvt121tr 0x04 /* - DO NOT TRANSLATE EXCP V=R. @ZA45816 */
#define cvtascii 0x02 /* - ASCII TAPE PROCESSING IS GENERATED IN */
#define cvtxpfp 0x01 /* - CPU HAS EXTENDED PRECISION FLOATING POINT */
/* Values for field "cvtoptb" */
#define cvtprot 0x80 /* - CPU HAS STORE PROTECTION FEATURE (OS/VS1) */
#define cvtctims 0x40 /* - IF ON, HARDWARE HAS THE CLOCK COMPARATOR */
#define cvttod 0x20 /* - CPU HAS TIME-OF-DAY CLOCK FEATURE */
#define cvtnlog 0x10 /* - SYS1.LOGREC IS UNAVAILABLE FOR ERROR */
#define cvtapthr 0x08 /* - NIP SETS THIS BIT TO 1 WHEN DEVICE TESTING */
#define cvtfp 0x04 /* - CPU HAS FETCH PROTECTION FEATURE (OS/VS1) */
#define cvtvs1a 0x02 /* - VS1 ASSIST IS AVAILABLE FOR USE (OS/VS1) */
#define cvtvs1b 0x01 /* - VS1 ASSIST SUBSET IS AVAILABLE FOR USE */
/* Values for field "cvtgtfst" */
#define cvtgtfav 0x80 /* - IF ZERO, GTF NOT ACTIVE. IF ONE, GTF */
#define cvtspd 0x40 /* - SERVICE PROCESSOR DAMAGE. @ZA57793 */
#define cvtwspr 0x20 /* - WAITING FOR SERVICE PROCESSOR @ZA57793 */
#define cvtusr 0x04 /* - TRACE=USR SPECIFIED. USER-REQUESTED TRACE */
#define cvtrnio 0x02 /* - GTF IS ACTIVE AND TRACING RNIO EVENTS */
/* Values for field "cvttcmfg" */
#define cvttcrdy 0x80 /* - TCAM IS READY TO ACCEPT USERS */
#define cvtldev 0x40 /* - LOCAL DEVICE ATTACHED TO TCAM */
#define cvtnwtcm 0x20 /* - MULTIPLE TCAM FEATURE ACTIVE. @D1A */
/* Values for field "cvtdmsrf" */
#define cvtsdump 0x80 /* - SET BY COREZAP. WILL CAUSE AN SDUMP TO BE */
#define cvtudump 0x40 /* - SET BY COREZAP. WILL CAUSE AN ABEND DUMP */
/* Values for field "cvtdirst" */
#define cvtdicom 0x80 /* - LPA DIRECTORY HAS BEEN INITIALIZED BY NIP */
/* Values for field "cvtsylk" */
#define cvtsylks 0xFF /* - SET LOCK BYTE */
#define cvtsylkr 0x00 /* - RESET LOCK BYTE */
/* Values for field "cvtflag1" */
#define cvtrsmwd 0x80 /* - IF ONE REAL STORAGE MANAGER WINDOW @L1A */
#define cvtsvprc 0x40 /* - SERVICE PROCESSOR ARCHITECTURE @H3C */
#define cvtcuse 0x20 /* - CUSE. SET BY NIP @03A */
#define cvtmvpg 0x10 /* - IF ONE, MOVEPAGE CAPABILITY IS @LIA */
#define cvtover 0x08 /* - SUBPOOL OVERRIDE IS SUPPORTED. @LRA */
#define cvtcstr 0x04 /* - IF ONE, CSTRING FACILITY IS PRESENT @DCA */
#define cvtsubsp 0x02 /* - IF ONE, SUBSPACE FACILITY IS PRESENT @LVA */
#define cvtkpar 0x01 /* - RESERVED FOR USE BY RTM ONLY. @M2A */
/* Values for field "cvtflag2" */
#define cvtcmpsc 0x80 /* - IF ONE, INDICATES PRESENCE OF MVS @0CA */
#define cvtcmpsh 0x40 /* - IF ONE, INDICATES PRESENCE OF CMPSC @0CA */
#define cvtsopf 0x20 /* - IF ONE, INDICATES PRESENCE OF THE @M9A */
#define cvtbfph 0x10 /* - If one, indicates presence of */
#define cvtper2 0x08 /* - If one, indicates presence of */
#define cvtiqd 0x04 /* - If one, indicates that Internal @MRC */
#define cvtalr 0x02 /* - If one, indicates ASN and LX Reuse @MXA */
#define cvtedat 0x01 /* - If one, indicates that the Enhanced DAT */
/* Values for field "cvtflag3" */
#define cvtesame 0x80 /* - */
#define cvtzarch 0x80 /* - If one, indicates presence of */
/* Values for field "cvtflag4" */
#define cvtp001i 0x80 /* If one, indicates that P001 support */
#define cvtp001a 0x40 /* If one, indicates that the system is */
#define cvtznalc 0x20 /* zNALC @0JA */
#define cvtdcpa 0x10 /* Dynamic CPU Addition is enabled @NAA */
/* Values for field "cvtctlfg" */
#define cvtdstat 0x10 /* - DEVSTAT OPTION IN EFFECT. DEVICE ADDRESS */
#define cvtdrmod 0x08 /* - Set on when DRMODE=YES was specified. @MZA */
#define cvtnomp 0x04 /* - MULTIPROCESSING CODE IS NOT IN THE SYSTEM. */
#define cvtgtrce 0x02 /* - GENERALIZED TRACE FACILITY (GTF) HAS */
#define cvtsdtrc 0x01 /* - SVC DUMP HAS SUPPRESSED SUPERVISOR TRACE. */
/* Values for field "cvtgrsst" */
#define cvte51gn 0x80 /* - When on, global resource contention */
#define cvte51ln 0x40 /* - When on, local resource contention */
/* Values for field "cvtmfrtr" */
#define cvtmfact 0x80 /* - IF ONE, I/O SUPERVISOR AND TIMER SECOND */
/* Values for field "cvtgsda" */
#define cvtgsdab 0x80 /* - IF HIGH-ORDER BIT IS ONE, THERE IS MDC185 */
/* Values for field "cvtfunc" */
#define cvtsoln 0x80 /* - If high order bit is on, this is not @M6A */
/* Values for field "cvtxafl" */
#define cvtcsrim 0x80 /* - EXPLICIT LOAD PROCESSING REQUIRED @G860PVB */
/* Values for field "cvtoslv0" */
#define cvth3310 0x80 /* HBB3310 FUNCTIONS ARE PRESENT @DBA */
#define cvtesa 0x80 /* ESA/370 IS SUPPORTED @LQA */
#define cvtxax 0x80 /* ESA/370 IS SUPPORTED (XAX - OLD NAME) @LQC */
#define cvth4420 0x40 /* HBB4420 FUNCTIONS ARE PRESENT. @LPA */
#define cvtj3313 0x20 /* JBB3313 FUNCTIONS ARE PRESENT @LHA */
#define cvtj3311 0x10 /* JBB3311 FUNCTIONS ARE PRESENT @DBA */
#define cvthiper 0x10 /* HIPERSPACES ARE SUPPORTED @DAA */
#define cvth4410 0x08 /* HBB4410 FUNCTIONS ARE PRESENT. @LKA */
#define cvtlkr 0x08 /* SPIN LOCK RESTRUCTURE INDICATOR. @LJA */
#define cvtucbsv 0x08 /* UCB SERVICES INSTALLED. @LMA */
#define cvtcads 0x04 /* SCOPE=COMMON DATA SPACES SUPPORTED @04A */
#define cvtcrptl 0x02 /* ENCRYPTION ASYMMETRIC FEATURE IS @05A */
#define cvtj4422 0x01 /* JBB4422 FUNCTIONS ARE PRESENT @LTA */
/* Values for field "cvtoslv1" */
#define cvth4430 0x80 /* HBB4430 FUNCTIONS ARE PRESENT @LQA */
#define cvtdyapf 0x80 /* DYNAMIC APF, THROUGH CSVAPF, PRESENT @LQA */
#define cvtwlm 0x40 /* WORKLOAD MANAGER IS INSTALLED @LYA */
#define cvth5510 0x20 /* HBB5510 FUNCTIONS ARE PRESENT @M1A */
#define cvtdynex 0x20 /* CSVDYNEX FOR DYNAMIC EXITS IS PRESENT @LXA */
#define cvth5520 0x10 /* HBB5520 FUNCTIONS ARE PRESENT @M3A */
#define cvtenclv 0x10 /* ENCLAVES FUNCTION IS PRESENT @M4A */
#define cvtj5522 0x08 /* JBB5522 FUNCTIONS ARE PRESENT @M8A */
#define cvth5530 0x04 /* HBB6603 FUNCTIONS ARE PRESENT @MBA */
#define cvth6603 0x04 /* HBB6603 FUNCTIONS ARE PRESENT @MDA */
#define cvtos390_010300 0x04 /* OS/390 R3 @MEA */
#define cvtos390_r3 0x04 /* OS/390 R3 @MEA */
#define cvtdynl 0x04 /* Dynamic LNKLST, via CSVDYNL, is present */
#define cvth6601 0x02 /* OS/390 release 1 @M9A */
#define cvtos390 0x02 /* OS/390 release 1 @M9A */
#define cvtos390_010100 0x02 /* OS/390 R1 @MEA */
#define cvtos390_r1 0x02 /* OS/390 R1 @MEA */
#define cvtprded 0x02 /* Product enable/disable (IFAEDxxx) @M9A */
#define cvtj6602 0x01 /* OS/390 release 2 @MAA */
#define cvtos390_010200 0x01 /* OS/390 R2 @MEA */
#define cvtos390_r2 0x01 /* OS/390 R2 @MEA */
#define cvtparmc 0x01 /* Logical Parmlib Service is available */
/* Values for field "cvtoslv2" */
#define cvtos390_010400 0x80 /* OS/390 R4 @MEA */
#define cvtos390_020400 0x80 /* OS/390 R4 @PPA */
#define cvtos390_r4 0x80 /* OS/390 R4 @MEA */
#define cvtj6604 0x80 /* OS/390 R4 @MEA */
#define cvtdylpa 0x80 /* Dynamic LPA (CSVDYLPA) available @MEA */
#define cvtrtls 0x80 /* Runtime Library Services (CSVRTLS) @MEA */
#define cvtos390_020500 0x40 /* OS/390 R5 @MFA */
#define cvtos390_r5 0x40 /* OS/390 R5 @MFA */
#define cvth6605 0x40 /* OS/390 R5 @MFA */
#define cvtos390_020600 0x20 /* OS/390 R6 @MGA */
#define cvtos390_r6 0x20 /* OS/390 R6 @MGA */
#define cvth6606 0x20 /* OS/390 R6 @MGA */
#define cvtbfp 0x10 /* Binary Floating Point support @MGA */
#define cvtos390_020700 0x08 /* OS/390 R7 @MHA */
#define cvtos390_r7 0x08 /* OS/390 R7 @MHA */
#define cvtj6607 0x08 /* OS/390 R7 @MHA */
#define cvtos390_020800 0x04 /* OS/390 R8 @MIA */
#define cvtos390_r8 0x04 /* OS/390 R8 @MIA */
#define cvth6608 0x04 /* OS/390 R8 @MIA */
#define cvtos390_020900 0x02 /* OS/390 R9 @MJA */
#define cvtos390_r9 0x02 /* OS/390 R9 @MJA */
#define cvtj6609 0x02 /* OS/390 R9 @MJA */
#define cvth6609 0x02 /* OS/390 R9 @MJA */
#define cvtos390_021000 0x01 /* OS/390 R10 @PUC */
#define cvtos390_r10 0x01 /* OS/390 R10 @MLA */
#define cvth7703 0x01 /* OS/390 R10 @MLA */
/* Values for field "cvtoslv3" */
#define cvtpause 0x80 /* Pause/Release services are present @MKA */
#define cvtpaus2 0x40 /* IEAVAPE2 and related services, and @N5A */
#define cvtzos 0x20 /* z/OS V1R1 @MMA */
#define cvtzos_010100 0x20 /* z/OS V1R1 @MMA */
#define cvtzos_v1r1 0x20 /* z/OS V1R1 @MMA */
#define cvtj7713 0x20 /* JBB7713 @MMA */
#define cvtlparc 0x20 /* LPAR Clustering is present. @PWA */
#define cvtzos_010200 0x10 /* z/OS V1R2 @MQA */
#define cvtzos_v1r2 0x10 /* z/OS V1R2 @MQA */
#define cvth7705 0x10 /* HBB7705 @MQA */
#define cvtv64 0x10 /* 64-bit virtual services are present. @MQA */
#define cvtzos_010300 0x08 /* z/OS V1R3 @MSA */
#define cvtzos_v1r3 0x08 /* z/OS V1R3 @MSA */
#define cvth7706 0x08 /* HBB7706 @MSA */
#define cvtzos_010400 0x04 /* z/OS V1R4 @MUA */
#define cvtzos_v1r4 0x04 /* z/OS V1R4 @MUA */
#define cvth7707 0x04 /* HBB7707 @MUA */
#define cvtzos_010500 0x02 /* z/OS V1R5 @MVA */
#define cvtzos_v1r5 0x02 /* z/OS V1R5 @MVA */
#define cvth7708 0x02 /* HBB7708 @MVA */
#define cvtzos_010600 0x01 /* z/OS V1R6 @MWA */
#define cvtzos_v1r6 0x01 /* z/OS V1R6 @MWA */
#define cvth7709 0x01 /* HBB7709 @MWA */
/* Values for field "cvtoslv4" */
#define cvtcsrsi 0x80 /* CSRSI service is available @0EA */
#define cvtunics 0x40 /* Unicode callable services available @MLA */
#define cvtcsrun 0x20 /* CSRUNIC callable service available @MLA */
#define cvtilm 0x10 /* IBM License Manager functions are @PYM */
#define cvtalrs 0x08 /* ASN-and-LX-Reuse architecture is @MXA */
#define cvttocp 0x04 /* TIMEUSED TIME_ON_CP @0KA */
#define cvtziip 0x02 /* zIIP support is present @H5A */
#define cvtsup 0x02 /* zIIP support is present @H5A */
#define cvtifar 0x01 /* IFA routine is present @H4A */
/* Values for field "cvtoslv5" */
#define cvtzose 0x80 /* z/OS.e @MTA */
#define cvtzosas 0x80 /* z/OS.e @MTA */
#define cvtpuma 0x80 /* z/OS.e @MTA */
#define cvtzos_010700 0x40 /* z/OS V1R7 @Q3C */
#define cvtzos_v1r7 0x40 /* z/OS V1R7 @Q3C */
#define cvth7720 0x40 /* HBB7720 @MYA */
#define cvtzos_010800 0x20 /* z/OS V1R8 @N2A */
#define cvtzos_v1r8 0x20 /* z/OS V1R8 @N2A */
#define cvth7730 0x20 /* HBB7730 @N2A */
#define cvtzos_010900 0x10 /* z/OS V1R9 @N6A */
#define cvtzos_v1r9 0x10 /* z/OS V1R9 @N6A */
#define cvth7740 0x10 /* HBB7740 @N6A */
#define cvtzos_011000 0x08 /* z/OS V1R10 @N8A */
#define cvtzos_v1r10 0x08 /* z/OS V1R10 @N8A */
#define cvth7750 0x08 /* HBB7750 @N8A */
#define cvtzos_011100 0x04 /* z/OS V1R11 @NBA */
#define cvtzos_v1r11 0x04 /* z/OS V1R11 @NBA */
#define cvt_g64cpu_infrastructure 0x04 /* G64CPU Infrastructure present @NCA */
#define cvth7760 0x04 /* HBB7760 @NBA */
#define cvtzos_011200 0x02 /* z/OS V1R12 @NFA */
#define cvtzos_v1r12 0x02 /* z/OS V1R12 @NFA */
#define cvth7770 0x02 /* HBB7770 @NFA */
#define cvtzos_011300 0x01 /* z/OS V1R13 @NIA */
#define cvtzos_v1r13 0x01 /* z/OS V1R13 @NIA */
#define cvth7780 0x01 /* HBB7780 @NIA */
/* Values for field "cvtoslv8" */
#define cvtpaus3 0x80 /* IEA4xxxx @N9A */
#define cvtpaus4 0x40 /* Pause with checkpoint-OK @0MA */
struct cvtvstgx
{
int cvtbldls; /* - RESERVED - WAS STARTING ADDRESS OF @P3C */
int cvtbldle; /* - RESERVED - WAS ENDING ADDRESS OF @P3C */
void *cvtmlpas; /* - STARTING VIRTUAL ADDRESS OF MLPA. @G860PVB */
void *cvtmlpae; /* - ENDING VIRTUAL ADDRESS OF MLPA. @G860PVB */
void *cvtflpas; /* - STARTING VIRTUAL ADDRESS OF FLPA. @G860PVB */
void *cvtflpae; /* - ENDING VIRTUAL ADDRESS OF FLPA. @G860PVB */
void *cvtplpas; /* - STARTING VIRTUAL ADDRESS OF PLPA. @G860PVB */
void *cvtplpae; /* - ENDING VIRTUAL ADDRESS OF PLPA. @G860PVB */
void *cvtrwns; /* - STARTING VIRTUAL ADDRESS OF @G860PVB */
void *cvtrwne; /* - ENDING VIRTUAL ADDRESS OF @G860PVB */
void *cvtrons; /* - STARTING VIRTUAL ADDRESS OF @G860PVB */
void *cvtrone; /* - ENDING VIRTUAL ADDRESS OF @G860PVB */
void *cvterwns; /* - STARTING EXTENDED ADDRESS @G860P46 */
void *cvterwne; /* - ENDING EXTENDED ADDRESS @G860P46 */
void *cvteplps; /* - STARTING VIRTUAL ADDRESS OF @G860PVB */
void *cvteplpe; /* - ENDING VIRTUAL ADDRESS OF @G860PVB */
void *cvteflps; /* - STARTING VIRTUAL ADDRESS OF @G860PVB */
void *cvteflpe; /* - ENDING VIRTUAL ADDRESS OF @G860PVB */
void *cvtemlps; /* - STARTING VIRTUAL ADDRESS OF @G860PVB */
void *cvtemlpe; /* - ENDING VIRTUAL ADDRESS OF @G860PVB */
};
struct cvtxtnt1
{
void *cvtfachn; /* - ADDRESS OF CHAIN OF DCB FIELD AREAS */
unsigned char cvt1r004[8]; /* RESERVED @LFC */
};
struct cvtxtnt2
{
unsigned char cvt2r000[4]; /* RESERVED @LFC */
unsigned char cvtnucls; /* - IDENTIFICATION OF THE NUCLEUS MEMBER */
unsigned char cvtflgbt; /* - Flag byte. This byte is an interface */
unsigned char cvtiocid[2]; /* - EBCDIC IDENTIFIER OF THE ACTIVE I/O @LBA */
void *cvtdebvr; /* - ADDRESS OF BRANCH ENTRY POINT OF DEB */
void *cvtcvaf; /* - POINTER TO THE CVAF TABLE, WHICH CONTAINS */
void *cvtmmvt; /* ADDRESS OF THE MEDIA MANAGER VECTOR TABLE */
void *cvtncvp; /* ADDRESS OF CSA BUFFER POOL - USED BY */
struct
{
unsigned char _filler1; /* - RESERVED - FIRST BYTE OF CVTQID @LFC */
int _cvtqida : 24; /* - ADDRESS OF QUEUE IDENTIFICATION (QID) */
} cvtqid;
void *cvtoltep; /* - POINTER TO CONTROL BLOCK CREATED BY SVC 59 */
unsigned char cvt2r020[4]; /* - RESERVED @LFC */
struct
{
unsigned char _filler2[4]; /* @P5A */
} cvtavvt;
void *cvtccvt; /* - ADDRESS OF CRYPTOGRAPHIC FACILITY CVT */
void *cvtskta; /* - ADDRESS OF STORAGE KEY TABLE (VM */
void *cvticb; /* - ADDRESS OF MASS STORAGE SYSTEM (MSS) */
unsigned char cvtfbyt1; /* - FLAG BYTE */
unsigned char cvt2r035[3]; /* - RESERVED @LFC */
struct
{
int _cvtldtol; /* HIGH WORD @08A */
int _cvtldtor; /* LOW WORD @08A */
} cvtldto;
void *cvtatcvt; /* - POINTER TO VTAM'S CVT @ZA65734 */
unsigned char cvt2r044[4]; /* - RESERVED @LFC */
int cvtbclmt; /* - NUMBER OF 130-BYTE RECORDS SET ASIDE @LBA */
int cvt2r04c; /* RESERVED @0BA */
long long int cvtlso;
// struct
// {
// int _cvtlsoh; /* HIGH WORD @0BA */
// int _cvtlsol; /* LOW WORD @0BA */
// } cvtlso;
unsigned char cvt2r058[44]; /* RESERVED @0BC */
};
#define cvtqida cvtqid._cvtqida
#define cvtldtor cvtldto._cvtldtor
/* Values for field "cvtflgbt" */
#define cvtnpe 0x80 /* - INDICATES NON-PAGING ENVIRONMENT (VM */
#define cvtvme 0x40 /* - INDICATES MACHINE IS OPERATING IN VM */
#define cvtbah 0x20 /* - INDICATES THAT THE VM/370 - OS/VS1 BTAM */
#define cvtundvm 0x10 /* - Running under VM (this is not the same */
/* Values for field "cvtavvt" */
#define cvtavin 0x80 /* INDICATES AVM INSTALLED @LAA */
/* Values for field "cvtfbyt1" */
#define cvtrde 0x80 /* - RELIABILITY DATA EXTRACTOR INDICATOR @D7A */
/* Values for field "cvtatcvt" */
#define cvtatact 0x80 /* IF ON, VTAM IS ACTIVE MDC081 */
#ifdef __MVS__
#pragma pack(reset)
#endif
#include
#include
#include
#include
#include "cvt.h"
#include "psa.h"
#include "metal.h"
#ifndef __MVS_
#include
#endif
#define timerUnit 1.048576
const char weekdays[7][11] = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
};
const char weekdaysShort[7][4] = {
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
};
const char months[12][10] = {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
const char monthsShort[12][4] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
};
/*
Julian dates (abbreviated JD) are a continuous count of days and fractions
since noon Universal Time on January 1, 4713 BCE (on the Julian calendar).
The time scale that is the basis for Julian dates is Universal Time,
and that 0h UT corresponds to a Julian date fraction of 0.5.
Astronomical calculations include a year 0, so these dates are accordingly,
i.e. the year 4713 BC becomes astronomical year number −4712, etc.
In this system the year 0 is equivalent to 1 BC.
The Julian Day Number (JDN) is the integer assigned to a whole solar day in
the Julian day count starting from noon Greenwich Mean Time, with Julian day
number 0 assigned to the day starting at noon on January 1, 4713 BC,
For example, the Julian day number for January 1, 2000, was 2,451,545.
The Julian Date (JD) of any instant is the Julian day number for the preceding
noon in Greenwich Mean Time plus the fraction of the day since that instant.
Julian Dates are expressed as a Julian day number with a decimal fraction added.
For example, the Julian Date for 00:30:00.0 UT January 1,2013, is 2,456,293.520833.
The routines used here return integer results, so the JDN is starts at 00:00:00 on
January 1, -4712, which is day 0. Day one is January 2, -4712, January 1, 2013
is 2,456,293, etc.
The changeover from the Julian calendar to the Gregorian calendar occurred in
October of 1582. Specifically, for dates on or before 4 October 1582,
the Julian calendar is used; for dates on or after 15 October 1582,
the Gregorian calendar is used. There is a ten-day gap in calendar dates,
but no discontinuity in Julian dates or days of the week: 4 October 1582 (Julian)
is a Thursday, which begins at JD 2299159.5; and 15 October 1582 (Gregorian) is a
Friday, which begins at JD 2299160.5.
Jean Meeus, Astronomical Algorithms (Richmod, Virginia: Willmann-Bell, 1991)
*/
extern int isYearLeapYear(int year)
{
return ((year % 4) == 0) &&
(!(((year % 100) == 0) && ((year % 400) != 0)));
}
extern int dayOfTheYEAR(int year, int month, int day)
{
int doy;
int K;
int k;
k = isYearLeapYear(year);
if (k == 1)
{
K = 1;
}
else
{
K = 2;
}
doy = (int) ((275 * month) / 9) - K * (int) ((month + 9) / 12) + day - 30;
return doy;
}
/*
From yyyy.ddd to yyyy.mm.dd
*/
extern void dayOfYearToCalendar(int year, int *month, int *day)
{
int K;
int k;
double M;
double N;
int D;
M = 0;
D = 0;
N = *day;
k = isYearLeapYear(year);
if (k == 1)
{
K = 1;
}
else
{
K = 2;
}
if (N < 32)
{
M = 1;
}
else
{
M = (int) (((9 * (K + N)) / 275) + 0.98);
}
D = N - (int) (275 * M / 9) + K * (int) ((M + 9) / 12) + 30;
*month = M;
*day = D;
}
/*
GREGORIAN_TO_JD Determine Julian day number from Gregorian calendar date
Name Epoch
Julian Date 12h Jan 1, 4713 BC
*/
extern int GregorianToJDN(int year, int month, int day)
{
double JD;
double A;
double B;
int y;
int m;
y = year;
m = month;
A = 0;
B = 0;
if (month == 1 || month == 2)
{
year -= 1;
month += 12;
}
A = (int) (year / 100);
if ((y <= 1582) && (m < 10) && (day < 5))
{
B = 0;
}
else
{
B = 2 - A + (int) (A / 4);
}
JD = (int) ((365.25 * (year + 4716))) + (int) ((30.6001 *
(month + 1))) + day + B - 1524.5;
return (int) (JD + 0.5);
}
extern int dayOfTheWeek(int JD)
{
int dow;
dow = (JD + 1) % 7;
return dow;
}
extern int ISODayOfTheWeek(int JD)
{
int dow;
dow = JD % 7;
return dow;
}
/*
ISO Ordinal date
YYYY-DDD
This system is sometimes incorrectly referred to as "Julian Date".
The astronomical Julian Date is a sequential count of the number
of days since day 0 beginning 1 January 4713 BC Greenwich noon,
Julian proleptic calendar.
*/
extern int ISODayToJulianDN(int year, int day)
{
return (day - 1) + GregorianToJDN(year, 1, 1);
}
/*
Unix Time
Epoch Calculation
0h Jan 1, 1970 (JD − 2440587.5) × 86400
The number of seconds elapsed since 00:00 Universal time on January 1,
1970 in the Gregorian calendar (Julian day 2440587.5).
*/
extern int UnixTime(int JD)
{
int ut;
ut = (JD - 2440587) * 86400;
return ut;
}
/*
ANSI Date Jan 1, 1601 (1) floor (JD − 2305812.5)
The ANSI Date defines January 1, 1601, as day 1, and is used as the origin
of COBOL integer dates.
This epoch is the beginning of the previous 400-year cycle of leap years
in the Gregorian calendar, which ended with the year 2000.
*/
extern int ANSIDate(int JD)
{
int ad;
ad = JD - 2299159;
return ad;
}
/*
Lilian date
Epoch Calculation
Oct 15, 1582 floor (JD − 2299159.5)
Used by IBM Language Environment (LE) software.
*/
extern int LilianDate(int JD)
{
int ld;
ld = JD - 2299159 + 1;
return ld;
}
/*
IBM TOD Clock to JDN
Epoch
January 1, 1900 = JDN 2415021
z/Architecture Principles of Operation
Time-of-Day Clock
The time-of-day (TOD) clock provides a high-resolution
measure of real time suitable for the indication of
date and time of day. The cycle of the clock is
approximately 143 years. A single TOD clock is
shared by all CPUs in the configuration.
Format
The TOD clock is a 104-bit register. It is a binary
counter with the format shown in the following illustration.
The TOD clock nominally is incremented by adding a
one in bit position 51 every microsecond. In models
having a higher or lower resolution, a different bit
position is incremented at such a frequency that the
rate of advancing the clock is the same as if a one
were added in bit position 51 every microsecond.
The resolution of the TOD clock is such that the
incrementing rate is comparable to the instruction
execution rate of the model.
Communication between systems is facilitated by
establishing a standard time origin that is the calendar
date and time to which a clock value of
zero corresponds. January 1, 1900, 0 a.m. Coordinated
Universal Time (UTC) is recommended
as this origin, and it is said to begin the standard
epoch for the clock.
*/
extern int TODToJDN(unsigned long long int TOD)
{
long long int seconds;
long long int days;
long long int tod;
tod = TOD / 4096; // 52 bit accuracy
seconds = tod / 1000000; // microseconds
days = seconds / 86400; // seconds in a day
days += 2415021;
return (int) days;
}
extern void JulianDNToGregorian(int JD, int *year, int *month, int *day)
{
double Z;
double F;
double B;
double C;
double D;
double E;
double A;
double alpha;
Z = (int) (JD + .5);
F = (int) Z - Z;
if (Z < 2299161)
{
A = Z;
}
else
{
alpha = (int) ((Z - 1867216.25) / 36524.25);
A = Z + 1 + alpha - (int) (alpha / 4);
}
B = A + 1524;
C = (int) ( (B - 122.1) / 365.25);
D = (int) ( 365.25 * C );
E = (int) ( (B - D) / 30.6001 );
*day = B - D - (int) (30.6001 * E) + F;
if (E < 14)
{
*month = E - 1;
}
else
{
*month = E - 13;
}
if (*month > 2)
{
*year = C - 4716;
}
else
{
*year = C - 4715;
}
}
#ifndef __MVS__
#define __CSE_CURRENT_VERSION __CSE_VERSION_1
#define __CSE_VERSION_1 1
int __stckf(unsigned long long *);
__csysenv_t __cinit(struct __csysenv_s *);
#endif
struct dateTime
{
int jdn; // Julian Day Number
int Lilian; // Lilian Date used by LE
char yyyymmdd[9]; // e.g. 20141104
char yyyymmdd2[11]; // e.g. 2014/11/04
char yyyymmdd3[11]; // e.g. 2014-11-04
int dayOfWeek; // 0 - 6
char weekdayLong[9]; // Full text, e.g. "Monday"
char weekdayShort[4]; // Abbrev. Text, e.g. "Mon"
char time24[9]; // 24 hour hh:mm:ss
char time12[9]; // 12 hour hh:mm:ss
char ampm[3]; // AM or PM
char tz[7]; // timezone from UTC: +/-hh:mm
char monthLong[10]; // Full Text e.g. "January"
char monthShort[4]; // Abbrev. Month e.g. "Jan"
char yyyyddd[9]; // yyyy.ddd
char longDate[40]; // Tuesday, November 04, 2014 10:54:38AM
char longDate2[21]; // YYYY-MM-DDTHH:MM:SSZ
char longDate3[26]; // 2014-11-13T01:14:13+00:00
struct
{
// Binary Representation of Fields
short int tz; // From (CVTTZ * 1.048576) / 3600
short int dayOfYear; // 1 - 366
short int year;
short int month;
short int day;
short int hour12;
short int hour24;
short int minute;
short int second;
} bin;
} ;
/*
Get Current Date Time Value Using Store Clock Fast
The TOD clock is a 104-bit register.
The TOD clock nominally is incremented by adding a
one in bit position 51 every microsecond.
STORE CLOCK FAST
STCKF Op1D(Op1B)
The current value of bits 0-63 of the TOD clock is
stored in the eight-byte field designated by the second-
operand address, provided the clock is in the
set, stopped, or not-set state.
For STORE CLOCK FAST, when the value of a running clock is stored,
bits to the right of the rightmost bit that is incremented are
stored as zeros.
Offsets
Dec Hex Type/Value Len Name (Dim) Description
304 (130) SIGNED 4 CVTTZ - Difference between local time and UTC (Coordinated Universal
Time) in binary units of 1.048576 seconds.
328 (148) ADDRESS 4 CVTEXT2 (0) - ADDRESS OF OS/VS1 - OS/VS2 COMMON EXTENSION
56 (38) DBL WORD 8 CVTLDTO (0) LOCAL TIME/DATE OFFSET
80 (50) DBL WORD 8 CVTLSO (0) LEAP SECOND OFFSET IN TOD FORMAT
UtcTime = StckTimeStamp - CVTLSO
LocalTime = StckTimeStamp + CVTLDTO - CVTLSO
*/
int getDate(struct dateTime *_dateTime)
{
int rc;
unsigned long long int TOD;
int days;
int year;
int month;
int day;
int remainder;
int hour12;
int hour24;
int minute;
int second;
double tod;
double diffSeconds;
double diffLeapSeconds;
long long int seconds;
int ttz;
// FFFFCA5B17000000
tod = 0;
diffSeconds = 0;
diffLeapSeconds = 0;
seconds = 0;
rc = 0;
memset(_dateTime,0,sizeof(struct dateTime));
#ifndef __MVS__
// (CE0E7F886BFCA21E)16 = (14847945245391102494)10
// date time ≈ Friday, 2014/11/14 20:44:15
TOD = 14847945245391102494ull;
ttz = 0xFFFFCA5B;
diffSeconds = ttz * 1.048576;
#endif
#ifdef __MVS__
struct psa *_psa;
struct cvt *_cvt;
struct cvtxtnt2 *_cvtxtnt2;
struct __csysenv_s _sysenv;
__csysenv_t _envtkn;
/* The __cinit() function establishes a Metal C
environment based on the characteristics in the input
csysenv structure.*/
// Initialize the csysenv structure.
memset(&_sysenv, 0x0, sizeof(_sysenv));
_sysenv.__cseversion = __CSE_VERSION_1;
// Set heap initial and increment sizes.
_sysenv.__cseheap31initsize = 65536;
_sysenv.__cseheap31incrsize = 8192;
_sysenv.__cseheap64initsize = 20;
_sysenv.__cseheap64incrsize = 1;
// Create a Metal C environment. */
_envtkn = __cinit(&_sysenv);
// Locate CVT. PSA->CVT
_psa = (void *) (intptr_t) 0; // PSA is at address 0
_cvt = _psa->_flccvt; // CVT pointer is at offset 16 of PSA
_cvtxtnt2 = _cvt->cvtext2; // CVT 2nd extension has TZ offset
// Calculate Time/Date Offset - Add
diffSeconds = _cvtxtnt2->cvtldto._cvtldtol; // LOCAL TIME/DATE OFFSET
diffSeconds *= timerUnit; // Multiply by clock timer units
// Calculate Leap Seconds - Subtract
diffLeapSeconds = _cvtxtnt2->cvtlso; // Leap Seconds Difference in TOD
diffLeapSeconds *= timerUnit; // Multiply by clock timer units
rc = __stckf(&TOD); // Use store clock fast to get TOD
#endif
tod = TOD / 4096; // 51 bit accuracy = microseconds
seconds = tod / 1000000; // microseconds to seconds
seconds += diffSeconds; // Add in time zone difference
seconds -= diffLeapSeconds; // Subtract Leap Seconds
days = seconds / 86400; // seconds in a day
days += 2415021; // Add in JDN Offset for 1900/01/01
_dateTime->jdn = days;
remainder = seconds % 86400;
hour24 = remainder / 3600;
minute = (remainder % 3600) / 60;
second = remainder % 60;
strcpy(_dateTime->ampm, "AM");
if (hour24 > 12)
{
hour12 = hour24 % 12;
strcpy(_dateTime->ampm, "PM");
}
_dateTime->bin.hour24 = hour24;
_dateTime->bin.hour12 = hour12;
_dateTime->bin.minute = minute;
_dateTime->bin.second = second;
_dateTime->bin.tz = diffSeconds / (double) 3600;
JulianDNToGregorian(days, &year, &month, &day);
_dateTime->Lilian = LilianDate(_dateTime->jdn);
_dateTime->bin.year = year;
_dateTime->bin.month = month;
_dateTime->bin.day = day;
strcpy(_dateTime->monthLong, months[month - 1]);
strcpy(_dateTime->monthShort, monthsShort[month - 1]);
sprintf(_dateTime->yyyymmdd, "%4.4i%2.2i%2.2i", year, month, day);
sprintf(_dateTime->yyyymmdd2, "%4.4i/%2.2i/%2.2i", year, month, day);
sprintf(_dateTime->yyyymmdd3, "%4.4i-%2.2i-%2.2i", year, month, day);
sprintf(_dateTime->time24, "%2.2i:%2.2i:%2.2i", hour24,
minute,second);
sprintf(_dateTime->tz, "%+2.2i:00", _dateTime->bin.tz);
sprintf(_dateTime->time12, "%2.2i:%2.2i:%2.2i", hour12, minute,second);
_dateTime->dayOfWeek = dayOfTheWeek(days);
strcpy(_dateTime->weekdayLong, weekdays[_dateTime->dayOfWeek]);
strcpy(_dateTime->weekdayShort, weekdaysShort[_dateTime->dayOfWeek]);
_dateTime->bin.dayOfYear = dayOfTheYEAR(year, month, day);
sprintf(_dateTime->yyyyddd, "%4.4i.%3.3i", year, _dateTime->bin.dayOfYear);
sprintf(_dateTime->longDate, "%s, %s %2.2i, %4.4i %s%s", _dateTime->weekdayLong,
_dateTime->monthLong, _dateTime->bin.day, year,
_dateTime->time12, _dateTime->ampm);
// longDate2 YYYY-MM-DDTHH:MM:SSZ
sprintf(_dateTime->longDate2, "%4.4i-%2.2i-%2.2iT%2.2i:%2.2i:%2.2i",
year, month, day, hour24, minute,second);
// longDate3 2014-11-13T01:14:13+00:00
sprintf(_dateTime->longDate3, "%4.4i-%2.2i-%2.2iT%2.2i:%2.2i:%2.2i%6.6s",
year, month, day, hour24, minute,
second, _dateTime->tz);
#ifdef __MVS__
__cterm((__csysenv_t) _envtkn);
#endif
return rc;
}
#ifndef __MVS_
int main()
{
struct dateTime _dateTime;
// Test Date: Friday 11/14/2014
getDate(&_dateTime);
printf("long date: %s\n",_dateTime.longDate);
printf("long date2: %s\n",_dateTime.longDate2);
printf("long date3: %s\n",_dateTime.longDate3);
printf("jdn: %i\n",_dateTime. jdn); // Julian Day Number
printf("Lilian: %i\n",_dateTime.Lilian); // Lilian Date used by LE
printf("yyyymmdd: %s\n", _dateTime.yyyymmdd); // e.g. 20141104
printf("yyyymmdd2: %s\n",_dateTime.yyyymmdd2); // e.g. 2014/11/04
printf("yyyymmdd3: %s\n", _dateTime.yyyymmdd3); // e.g. 2014-11-04
printf("dayOfWeek: %i\n" , _dateTime.dayOfWeek); // 0 - 6
printf("weekdayLong: %s\n", _dateTime.weekdayLong); // Full text, e.g. "Monday"
printf("weekdayShort: %s\n", _dateTime.weekdayShort); // Abbrev. Text, e.g. "Mon"
printf("time24: %s\n", _dateTime.time24); // 24 hour hh:mm:ss
printf("time12: %s\n",_dateTime.time12); // 12 hour hh:mm:ss
printf("ampm: %s\n", _dateTime.ampm); // AM or PM
printf("tz: %s\n", _dateTime.tz); // timezone from UTC: +/-hh:mm
printf("monthLong: %s\n",_dateTime.monthLong); // Full Text e.g. "January"
printf("monthShort: %s\n",_dateTime.monthShort); // Abbrev. Month e.g. "Jan"
printf("yyyyddd: %s\n",_dateTime.yyyyddd); // yyyy.ddd
printf("tz: %i \n",_dateTime.bin.tz);
printf("day:%i \n",_dateTime.bin.dayOfYear);
printf("yr: %i \n",_dateTime.bin.year);
printf("month: %i \n",_dateTime.bin.month);
printf("day: %i \n",_dateTime.bin.day);
printf("hour12: %i \n",_dateTime.bin.hour12);
printf("hour24: %i \n",_dateTime.bin.hour24);
printf("min: %i \n",_dateTime.bin.minute);
printf("sec: %i \n",_dateTime.bin.second);
return 0;
}
#endif
References
- Julian day, Wikipedia, 2014
- Jean Meeus, Astronomical Algorithms (Richmod, Virginia: Willmann-Bell, 1991)
- z/OS Metal C Programming Guide and Reference
- z/OS XL C/C++ Language Reference
- z/OS MVS Data Areas Volume 1