FORDERDSP CF E WORKSTN
D corder S 10I 0
D avgorder S 12S 2
D ccan S 10I 0
D cusa s 10I 0
F/FREE
EXFMT RECORD1;
DOW NOT(*IN03);
EXSR CALCTOTAL;
WRITE RECORD1;
EXFMT RECORD2;
IF *IN03 = *OFF;
EXSR CLEARREC1;
EXFMT RECORD1;
ENDIF;
ENDDO;
if *in03 = *on;
exfmt record3;
ENDIF;
*INLR = *ON;
RETURN;
BEGSR CALCTOTAL;
TOTAL = (BIKES * 1000) + (BOARDS * 100) + (BLADES * 75);
HST = TOTAL * 0.13;
TOTAL = TOTAL + HST;
COMMENT = 'NEW ORDER';
IF TOTAL > 1000;
select;
when shipto = 'USA' or shipto = 'usa';
shipcost = total / 1000 * 15;
cusa = cusa + 1;
when shipto = 'CAN' or shipto = 'can';
shipcost = total / 1000 * 10;
ccan = ccan + 1;
ENDSL;
ind = ccan;
total = (total + shipcost);
corder = corder + 1;
avgorder = (avgorder + total) / corder;
ELSE;
ENDIF;
norder = corder;
ncan = ccan;
nusa = cusa;
avgord = avgorder;
SELECT;
WHEN TOTAL > 0 AND TOTAL <= 1000;
COMMENT = 'Order shipped by 9am tomorrow';
WHEN TOTAL > 1000 AND TOTAL <= 5000;
COMMENT = 'Order shipped by 5pm tomorrow';
WHEN TOTAL > 5000 AND TOTAL <= 8000;
COMMENT = 'Order shipped in two business days';
WHEN TOTAL > 8000;
COMMENT = 'Order shipped by the end of the month';
ENDSL;
ENDSR;
BEGSR CLEARREC1;
BIKES = 0;
BOARDS = 0;
BLADES = 0;
shipto = ' ';
ENDSR;
No comments:
Post a Comment