Using CA Easytrieve for Unix, how to code a program to write the Unix date and time to a file at the start and end of execution.

Document ID : KB000055623
Last Modified Date : 14/02/2018
Show Technical Document Details

* THE FOLLOWING PROGRAM WRITES THE UNIX DATE AND TIME TO A FILE
* AT THE BEGINNING OF THE JOB IN A START PROC AND AGAIN AT THE
* END OF THE JOB IN A FINISH PROC. THIS JOB IS EXECUTED FROM
* A UNIX SCRIPT

FILE RPT1 F(71) PRINTER
FILE PERSNL F(150)
REGION   1    1  N
BRANCH   2    2  N
EMP#     9    5  N             HEADING ('EMPLOYEE' 'NUMBER')
NAME    17   20  A             HEADING ('EMPLOYEE' 'NAME')
NET     90    4  P 2           HEADING ('NET' 'PAY')
GROSS   94    4  P 2           HEADING ('GROSS' 'PAY')
FILE COUNT F(20)
RECORDCOUNT 1 8 N 0
LOOP W 8 N 0
DEFINE PARM-FIELD  S  16  A
PROGRAM NAME MY-PROGRAM USING PARM-FIELD
EXECUTE MY-PROGRAM
JOB INPUT PERSNL NAME MY-PROGRAM START BEGIN FINISH ENDIT
PRINT REPORT1
LOOP = 0
*
CHECK
IF LOOP = 1000
   GOTO JOB
ELSE
   LOOP = LOOP + 1
   GOTO CHECK
END-IF
*
BEGIN. PROC
LINK 'echo Start Date > startdate'
LINK 'date >> startdate'
END-PROC
*
ENDIT. PROC
LINK 'echo End Date > enddate'
LINK 'date >> enddate'
LINK 'echo Number of PERSNL records read > recsread'
RECORDCOUNT = PERSNL:RECORD-COUNT
PUT COUNT
END-PROC
*
REPORT REPORT1 LINESIZE 70 PRINTER RPT1
TITLE 'EMPLOYEE GROSS AND NET PAY'
 LINE NAME EMP# GROSS NET
*
THE UNIX SCRIPT TO EXECUTE THE ABOVE JOB
rm startdate
rm enddate
rm recsread
rm RPT1
rm COUNT
clear
cathy1
cat COUNT >> recsread
echo ' ' >> recsread
cat startdate
cat enddate
cat recsread