I want to calculate timestamp for custom date and time. E.g 23/09/2022 4:30:45
To calculate Julian Timestamp of current date and time you can use JULIANTIMESTAMP using ENTER TAL but for Custom timestamp we have COMPUTETIMESTAMP GPC .
Syntax from GPC Reference manual
jval := COMPUTETIMESTAMP ( date-n-time,
[error-mask] );
Data types
jval is 64-bit Fixed Julian timestamp .
date-n-time is an integer array of date and time [YYYY,MM,DD,HH,,MM,SS,MIL,MIC] all elements of array are compulsory.
error-mask is integer array of bits 1 or 0 of length 8.
So let's Jump to the main Question how to Calculate Custom timestamp in COBOL85 . I have small example .
?ANSI
?save param
?symbols
?inspect
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-FLD-CUST PIC X(50).
01 ARR.
03 DT PIC S9(4) COMP OCCURS 8 TIMES.
01 VAL PIC 9(16).
01 JTIME PIC S9(18) VALUE 0.
01 CER.
03 ERR PIC S9(1) COMP OCCURS 8 TIMES.
PROCEDURE DIVISION.
PROGRAM-BEGIN.
MOVE 2022 TO DT(1).
MOVE 99 TO DT(2).
MOVE 30 TO DT(3).
MOVE 10 TO DT(4).
MOVE 00 TO DT(5).
MOVE 00 TO DT(6).
MOVE 000 TO DT(7).
MOVE 000 TO DT(8).
ENTER TAL "COMPUTETIMESTAMP" USING ARR , CER
GIVING JTIME.
IF JTIME = -1
DISPLAY "INVALID DATE"
ELSE
DISPLAY JTIME.
STOP RUN.