Thanks for the reply...
Here's the code:
DEFINE FILE &&COST
TELL/D8 = TELL2K(LDYP,TELL);
CTRLCPRL/A10 = CONTRACT|CPORT|CRL;
CT/I9C = IF CTRL NE LAST CTRL THEN 1 ELSE 0;
LDDT/YYMD = IF APUD NE 0 THEN APUD ELSE HALD;
LDPRWK/D8 = YYPPWW(LDDT,0,'D8');
LDPRWK2/A8 = EDIT(LDPRWK);
LDYPW/A8 = LDPRWK2;
LDYRPER/A6 = EDIT(LDPRWK2,'999999$$');
LDYEAR/A4 = EDIT(LDPRWK2,'9999$$$$');
LDPER/A2 = EDIT(LDPRWK2,'$$$$99$$');
LDWEEK/A2 = EDIT(LDPRWK2,'$$$$$$99');
DLPRWK/D8 = YYPPWW(DLDT,0,'D8');
DLPRWK2/A8 = EDIT(DLPRWK);
DELYPW/A8 = DLPRWK2;
DELYRPER/A6 = EDIT(DLPRWK2,'999999$$');
DELYEAR/A4 = EDIT(DLPRWK2,'9999$$$$');
DELPER/A2 = EDIT(DLPRWK2,'$$$$99$$');
DELWEEK/A2 = EDIT(DLPRWK2,'$$$$$$99');
ESLH/D10M = ESLH;
-************************************************************************
-INCLUDE ONTIME
-************************************************************************
END
-RUN
ONTIME.fex has the following source code:
-* File ontime.fex
CPUT1/I6YMD = IF CPUDTO EQ ' ' THEN EDIT(CPUDFROM) ELSE EDIT(CPUDTO);
CPUT2/YYMD = CPUT1;
CPUT3/I8YYMD = CPUT2;
CPUT/A8 = EDIT(CPUT3);
CLDTIMF/A4 = IF CLDTIMF EQ '9999' THEN '0000' ELSE CLDTIMF;
CLDTIMF/A4 = IF CLDTIMF EQ '9999' THEN '0000' ELSE CLDTIMF;
CLDTIMT2/A4 =
IF CLDTIMF EQ '0000' AND CLDTIMT EQ '9999' THEN '2359'
ELSE IF CLDTIMF EQ '0000' AND CLDTIMT NE '9999' THEN CLDTIMT
ELSE IF CLDTIMF NE '0000' AND CLDTIMT EQ '9999' THEN CLDTIMF
ELSE IF CLDTIMF NE '0000' AND CLDTIMT NE '9999' THEN CLDTIMT;
CLDTIMT/A4 = CLDTIMT2;
COMLOAD/A12 = CPUT|CLDTIMT2;
-** ACTUAL LOAD DATE AND TIME *****************************************
LDDT1/I8YYMD = LDDT;
LDDT2/A8 = EDIT(LDDT1);
ACTLDTIME/A4 = IF ACTPUTM EQ '9999' THEN '0000' ELSE ACTPUTM;
ACTLOAD/A12 = LDDT2|ACTLDTIME;
-* LOADING ONTIME / LATE COUNTERS AND FLAGS ***************************
OTLOAD/I9C = IF ACTLOAD LE COMLOAD THEN 1 ELSE 0;
OTHRLD/I9C = IF (ACTLOAD LE COMLOAD) OR
((ACTLOAD GT COMLOAD) AND
(EXTCOD1 EQ 'A6' OR 'B6' OR 'C6' OR 'D6' OR 'E6'
OR 'G6' OR 'H6'
OR '01' OR '03' OR '06' OR '10' OR '11'
OR '12' OR '13' OR '14' OR '15' OR '16'
OR '19' OR '20')) THEN 1 ELSE 0;
OTLDA6/I9C = IF (ACTLOAD GT COMLOAD) AND (EXTCOD1 EQ 'A6') THEN 1 ELSE 0;
OTLDB6/I9C = IF (ACTLOAD GT COMLOAD) AND (EXTCOD1 EQ 'B6') THEN 1 ELSE 0;
OTLDC6/I9C = IF (ACTLOAD GT COMLOAD) AND (EXTCOD1 EQ 'C6') THEN 1 ELSE 0;
OTLDD6/I9C = IF (ACTLOAD GT COMLOAD) AND (EXTCOD1 EQ 'D6') THEN 1 ELSE 0;
OTLDE6/I9C = IF (ACTLOAD GT COMLOAD) AND (EXTCOD1 EQ 'E6') THEN 1 ELSE 0;
OTLDG6/I9C = IF (ACTLOAD GT COMLOAD) AND (EXTCOD1 EQ 'G6') THEN 1 ELSE 0;
OTLDH6/I9C = IF (ACTLOAD GT COMLOAD) AND (EXTCOD1 EQ 'H6') THEN 1 ELSE 0;
OTLIBM/I9C = IF (ACTLOAD GT COMLOAD) AND
(EXTCOD1 EQ '01' OR '03' OR '06' OR '10' OR '11'
OR '12' OR '13' OR '14' OR '15' OR '16'
OR '19' OR '20') THEN 1 ELSE 0;
LTLOAD/I9C = IF ACTLOAD GT COMLOAD THEN 1 ELSE 0;
LTHRLD/I9C = IF (ACTLOAD GT COMLOAD) AND
(EXTCOD1 NE 'A6' OR 'B6' OR 'C6' OR 'D6' OR 'E6'
OR 'G6' OR 'H6'
OR '01' OR '03' OR '06' OR '10' OR '11'
OR '12' OR '13' OR '14' OR '15' OR '16'
OR '19' OR '20') THEN 1 ELSE 0;
LTHRLDFG/A1 = IF LTHRLD EQ 1 THEN 'L' ELSE ' ';
LTLDA6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'A6' THEN 1 ELSE 0;
LTLDB6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'B6' THEN 1 ELSE 0;
LTLDC6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'C6' THEN 1 ELSE 0;
LTLDD6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'D6' THEN 1 ELSE 0;
LTLDE6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'E6' THEN 1 ELSE 0;
LTLDF6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'F6' THEN 1 ELSE 0;
LTLDG6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'G6' THEN 1 ELSE 0;
LTLDH6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'H6' THEN 1 ELSE 0;
LTLDI6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'I6' THEN 1 ELSE 0;
LTLDJ6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'J6' THEN 1 ELSE 0;
LTLDK6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'K6' THEN 1 ELSE 0;
LTLDL6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'L6' THEN 1 ELSE 0;
LTLDM6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'M6' THEN 1 ELSE 0;
LTLDN6/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ 'N6' THEN 1 ELSE 0;
LTLD01/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '01' THEN 1 ELSE 0;
LTLD02/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '02' THEN 1 ELSE 0;
LTLD03/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '03' THEN 1 ELSE 0;
LTLD04/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '04' THEN 1 ELSE 0;
LTLD05/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '05' THEN 1 ELSE 0;
LTLD06/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '06' THEN 1 ELSE 0;
LTLD07/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '07' THEN 1 ELSE 0;
LTLD08/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '08' THEN 1 ELSE 0;
LTLD09/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '09' THEN 1 ELSE 0;
LTLD10/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '10' THEN 1 ELSE 0;
LTLD11/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '11' THEN 1 ELSE 0;
LTLD12/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '12' THEN 1 ELSE 0;
LTLD13/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '13' THEN 1 ELSE 0;
LTLD14/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '14' THEN 1 ELSE 0;
LTLD15/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '15' THEN 1 ELSE 0;
LTLD16/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '16' THEN 1 ELSE 0;
LTLD17/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '17' THEN 1 ELSE 0;
LTLD18/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '18' THEN 1 ELSE 0;
LTLD19/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '19' THEN 1 ELSE 0;
LTLD20/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '20' THEN 1 ELSE 0;
LTLD21/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '21' THEN 1 ELSE 0;
LTLD22/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '22' THEN 1 ELSE 0;
LTLD23/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '23' THEN 1 ELSE 0;
LTLD24/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '24' THEN 1 ELSE 0;
LTLD25/I9C = IF LTLOAD EQ 1 AND EXTCOD1 EQ '25' THEN 1 ELSE 0;
LTLDIBM/I9C = IF LTLOAD EQ 1
AND EXTCOD1 FROM '01' TO '25' THEN 1 ELSE 0;
-* COMMITTED DELIVERY DATE AND TIME SPREAD ****************************
CDET1/I6YMD = IF CDELTO EQ ' ' THEN EDIT(CDELFROM) ELSE EDIT(CDELTO);
CDET2/YYMD = CDET1;
CDET3/I8YYMD = CDET2;
CDET4/YYMD = CDET2;
CDET/A8 = EDIT(CDET3);
****IMF/A4 = IF ****IMF EQ '9999' THEN '0000' ELSE ****IMF;
****IMT2/A4 =
IF ****IMF EQ '0000' AND ****IMT EQ '9999' THEN '2359'
ELSE IF ****IMF EQ '0000' AND ****IMT NE '9999' THEN ****IMT
ELSE IF ****IMF NE '0000' AND ****IMT EQ '9999' THEN ****IMF
ELSE IF ****IMF NE '0000' AND ****IMT NE '9999' THEN ****IMT;
****IMT/A4 = ****IMT2;
COMDELV/A12 = CDET|****IMT2;
-** ACTUAL DELIVERY DATE AND TIME *************************************
DELV2/I8YYMD = DLDT;
DELV/A8 = EDIT(DELV2);
ACTDLTIME/A4 = IF ACTDLTM EQ '9999' THEN '0000' ELSE ACTDLTM;
ACTDELV/A12 = DELV|ACTDLTIME;
-* DELIVERY ONTIME / LATE COUNTERS AND FLAGS **************************
OTDELV/I9C = IF ACTDELV LE COMDELV THEN 1 ELSE 0;
OTHRDL/I9C = IF (ACTDELV LE COMDELV) OR
((ACTDELV GT COMDELV) AND
(EXTCOD2 EQ 'A6' OR 'B6' OR 'C6' OR 'D6' OR 'E6'
OR 'G6' OR 'H6'
OR '01' OR '03' OR '06' OR '10' OR '11'
OR '12' OR '13' OR '14' OR '15' OR '16'
OR '19' OR '20')) THEN 1 ELSE 0;
OTDLA6/I9C = IF (ACTDELV GT COMDELV) AND (EXTCOD2 EQ 'A6') THEN 1 ELSE 0;
OTDLB6/I9C = IF (ACTDELV GT COMDELV) AND (EXTCOD2 EQ 'B6') THEN 1 ELSE 0;
OTDLC6/I9C = IF (ACTDELV GT COMDELV) AND (EXTCOD2 EQ 'C6') THEN 1 ELSE 0;
OTDLD6/I9C = IF (ACTDELV GT COMDELV) AND (EXTCOD2 EQ 'D6') THEN 1 ELSE 0;
OTDLE6/I9C = IF (ACTDELV GT COMDELV) AND (EXTCOD2 EQ 'E6') THEN 1 ELSE 0;
OTDLG6/I9C = IF (ACTDELV GT COMDELV) AND (EXTCOD2 EQ 'G6') THEN 1 ELSE 0;
OTDLH6/I9C = IF (ACTDELV GT COMDELV) AND (EXTCOD2 EQ 'H6') THEN 1 ELSE 0;
OTDIBM/I9C = IF (ACTDELV GT COMDELV) AND
(EXTCOD2 EQ '01' OR '03' OR '06' OR '10' OR '11'
OR '12' OR '13' OR '14' OR '15' OR '16'
OR '19' OR '20') THEN 1 ELSE 0;
LTDELV/I9C = IF ACTDELV GT COMDELV THEN 1 ELSE 0;
LTHRDL/I9C = IF (ACTDELV GT COMDELV) AND
(EXTCOD2 NE 'A6' OR 'B6' OR 'C6' OR 'D6' OR 'E6'
OR 'G6' OR 'H6'
OR '01' OR '03' OR '06' OR '10' OR '11'
OR '12' OR '13' OR '14' OR '15' OR '16'
OR '19' OR '20') THEN 1 ELSE 0;
LTHRDLFG/A1 = IF LTHRDL EQ 1 THEN 'L' ELSE ' ';
C6LATE/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'C6' THEN 1 ELSE 0;
K6LATE/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'K6' THEN 1 ELSE 0;
LTDLA6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'A6' THEN 1 ELSE 0;
LTDLB6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'B6' THEN 1 ELSE 0;
LTDLC6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'C6' THEN 1 ELSE 0;
LTDLD6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'D6' THEN 1 ELSE 0;
LTDLE6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'E6' THEN 1 ELSE 0;
LTDLF6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'F6' THEN 1 ELSE 0;
LTDLG6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'G6' THEN 1 ELSE 0;
LTDLH6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'H6' THEN 1 ELSE 0;
LTDLI6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'I6' THEN 1 ELSE 0;
LTDLJ6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'J6' THEN 1 ELSE 0;
LTDLK6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'K6' THEN 1 ELSE 0;
LTDLL6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'L6' THEN 1 ELSE 0;
LTDLM6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'M6' THEN 1 ELSE 0;
LTDLN6/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ 'N6' THEN 1 ELSE 0;
LTDL01/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '01' THEN 1 ELSE 0;
LTDL02/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '02' THEN 1 ELSE 0;
LTDL03/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '03' THEN 1 ELSE 0;
LTDL04/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '04' THEN 1 ELSE 0;
LTDL05/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '05' THEN 1 ELSE 0;
LTDL06/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '06' THEN 1 ELSE 0;
LTDL07/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '07' THEN 1 ELSE 0;
LTDL08/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '08' THEN 1 ELSE 0;
LTDL09/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '09' THEN 1 ELSE 0;
LTDL10/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '10' THEN 1 ELSE 0;
LTDL11/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '11' THEN 1 ELSE 0;
LTDL12/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '12' THEN 1 ELSE 0;
LTDL13/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '13' THEN 1 ELSE 0;
LTDL14/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '14' THEN 1 ELSE 0;
LTDL15/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '15' THEN 1 ELSE 0;
LTDL16/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '16' THEN 1 ELSE 0;
LTDL17/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '17' THEN 1 ELSE 0;
LTDL18/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '18' THEN 1 ELSE 0;
LTDL19/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '19' THEN 1 ELSE 0;
LTDL20/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '20' THEN 1 ELSE 0;
LTDL21/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '21' THEN 1 ELSE 0;
LTDL22/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '22' THEN 1 ELSE 0;
LTDL23/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '23' THEN 1 ELSE 0;
LTDL24/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '24' THEN 1 ELSE 0;
LTDL25/I9C = IF LTDELV EQ 1 AND EXTCOD2 EQ '25' THEN 1 ELSE 0;
LTDLIBM/I9C = IF LTDELV EQ 1
AND EXTCOD2 FROM '01' TO '25' THEN 1 ELSE 0;
-************************************************************************
ACTTRAN2/D8 = DLDT - LDDT;
ACTTRAN/D8 = IF ACTTRAN2 LE 0 THEN 0 ELSE ACTTRAN2;
ELAPS1/I4 = IF DLDT GT 0 THEN DLDT - LDDT ELSE 0;
BUSTRAN2/D8 = WRKDYS(LDDT,DLDT,ELAPS1,1,BUSTRAN);
BUSTRAN/D8 = IF BUSTRAN2 EQ 9999 THEN 0 ELSE BUSTRAN2;
-************************************************************************
ACTCOM2/D8 = CDET2- CPUT2;
ACTCOM/D8 = IF ACTCOM2 LE 0 THEN 0 ELSE ACTCOM2;
ELAPS1/I4 = IF CDET2 GT 0 THEN CDET2 - CPUT2 ELSE 0;
BUSCOM2/D8 = WRKDYS(CPUT2,CDET2,ELAPS1,1,BUSCOM2);
BUSCOM/D8 = IF BUSCOM2 EQ 9999 THEN 0 ELSE BUSCOM2;
-************************************************************************
It's a lot but I hope it's enough.
Thanks,
Ronnel C
WebFocus 7.1.5
IBM ZOS 1.6