Function SET176A
FUNCTION OPTIONS(*DIRECT);
********** COMMENT();
EXECUTE SUBROUTINE(INSER_CUST);
EXECUTE SUBROUTINE(DEL_ORDERS);
EXECUTE SUBROUTINE(INSER_ORDE);
RETURN;
********** COMMENT();
SUBROUTINE NAME(INSER_CUST);
********** COMMENT();
CHANGE FIELD(#S_176CCOD) TO(AAAAA);
FETCH FIELDS(*ALL) FROM_FILE(SETCUS) WITH_KEY(#S_176CCOD);
CHANGE FIELD(#S_176CNAM) TO('''James Alladin Gas Heaters''');
CHANGE FIELD(#S_176LIMI) TO(15000);
CHANGE FIELD(#S_176CRED) TO(14000);
EXECUTE SUBROUTINE(INSUPD_CUS);
********** COMMENT();
CHANGE FIELD(#S_176CCOD) TO(BBBBB);
FETCH FIELDS(*ALL) FROM_FILE(SETCUS) WITH_KEY(#S_176CCOD);
CHANGE FIELD(#S_176CNAM) TO('''W. Munny Car Accessories''');
CHANGE FIELD(#S_176LIMI) TO(50000);
CHANGE FIELD(#S_176CRED) TO(49000);
EXECUTE SUBROUTINE(INSUPD_CUS);
********** COMMENT();
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(INSUPD_CUS);
********** COMMENT();
IF_STATUS IS(*OKAY);
UPDATE FIELDS(*ALL) IN_FILE(SETCUS);
ELSE;
INSERT FIELDS(*ALL) TO_FILE(SETCUS);
ENDIF;
********** COMMENT();
ENDROUTINE;
********** COMMENT(*******************************************************);
SUBROUTINE NAME(INSER_ORDE);
********** COMMENT();
BEGIN_LOOP USING(#S_176ORNO) TO(3);
CHANGE FIELD(#S_176CCOD) TO(AAAAA);
FETCH FIELDS(*ALL) FROM_FILE(SETORD) WITH_KEY(#S_176ORNO #S_176CCOD);
CHANGE FIELD(#S_176OAMT) TO('#s_176OAMT + 5000');
EXECUTE SUBROUTINE(INSERT_ORD);
END_LOOP;
********** COMMENT();
BEGIN_LOOP USING(#S_176ORNO) FROM(4) TO(6);
CHANGE FIELD(#S_176CCOD) TO(BBBBB);
FETCH FIELDS(*ALL) FROM_FILE(SETORD) WITH_KEY(#S_176ORNO #S_176CCOD);
CHANGE FIELD(#S_176OAMT) TO('#s_176OAMT + 1000');
EXECUTE SUBROUTINE(INSERT_ORD);
END_LOOP;
********** COMMENT();
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(INSERT_ORD);
********** COMMENT();
CHANGE FIELD(#S_176STAT) TO(APPROVED);
IF_STATUS IS(*OKAY);
UPDATE FIELDS(*ALL) IN_FILE(SETORD);
ELSE;
INSERT FIELDS(*ALL) TO_FILE(SETORD);
ENDIF;
********** COMMENT();
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(DEL_ORDERS);
********** COMMENT();
********** COMMENT(Delete orders for shipped customer codes);
CHANGE FIELD(#S_176CCOD) TO(AAAAA);
SELECT FIELDS(#S_176STAT) FROM_FILE(SETORDL1) WITH_KEY(#S_176CCOD);
DELETE FROM_FILE(SETORDL1);
ENDSELECT;
********** COMMENT();
CHANGE FIELD(#S_176CCOD) TO(BBBBB);
SELECT FIELDS(#S_176STAT) FROM_FILE(SETORDL1) WITH_KEY(#S_176CCOD);
DELETE FROM_FILE(SETORDL1);
ENDSELECT;
********** COMMENT();
ENDROUTINE;
FUNCTION OPTIONS(*DIRECT);
********** COMMENT();
EXECUTE SUBROUTINE(INSER_CUST);
EXECUTE SUBROUTINE(DEL_ORDERS);
EXECUTE SUBROUTINE(INSER_ORDE);
RETURN;
********** COMMENT();
SUBROUTINE NAME(INSER_CUST);
********** COMMENT();
CHANGE FIELD(#S_176CCOD) TO(AAAAA);
FETCH FIELDS(*ALL) FROM_FILE(SETCUS) WITH_KEY(#S_176CCOD);
CHANGE FIELD(#S_176CNAM) TO('''James Alladin Gas Heaters''');
CHANGE FIELD(#S_176LIMI) TO(15000);
CHANGE FIELD(#S_176CRED) TO(14000);
EXECUTE SUBROUTINE(INSUPD_CUS);
********** COMMENT();
CHANGE FIELD(#S_176CCOD) TO(BBBBB);
FETCH FIELDS(*ALL) FROM_FILE(SETCUS) WITH_KEY(#S_176CCOD);
CHANGE FIELD(#S_176CNAM) TO('''W. Munny Car Accessories''');
CHANGE FIELD(#S_176LIMI) TO(50000);
CHANGE FIELD(#S_176CRED) TO(49000);
EXECUTE SUBROUTINE(INSUPD_CUS);
********** COMMENT();
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(INSUPD_CUS);
********** COMMENT();
IF_STATUS IS(*OKAY);
UPDATE FIELDS(*ALL) IN_FILE(SETCUS);
ELSE;
INSERT FIELDS(*ALL) TO_FILE(SETCUS);
ENDIF;
********** COMMENT();
ENDROUTINE;
********** COMMENT(*******************************************************);
SUBROUTINE NAME(INSER_ORDE);
********** COMMENT();
BEGIN_LOOP USING(#S_176ORNO) TO(3);
CHANGE FIELD(#S_176CCOD) TO(AAAAA);
FETCH FIELDS(*ALL) FROM_FILE(SETORD) WITH_KEY(#S_176ORNO #S_176CCOD);
CHANGE FIELD(#S_176OAMT) TO('#s_176OAMT + 5000');
EXECUTE SUBROUTINE(INSERT_ORD);
END_LOOP;
********** COMMENT();
BEGIN_LOOP USING(#S_176ORNO) FROM(4) TO(6);
CHANGE FIELD(#S_176CCOD) TO(BBBBB);
FETCH FIELDS(*ALL) FROM_FILE(SETORD) WITH_KEY(#S_176ORNO #S_176CCOD);
CHANGE FIELD(#S_176OAMT) TO('#s_176OAMT + 1000');
EXECUTE SUBROUTINE(INSERT_ORD);
END_LOOP;
********** COMMENT();
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(INSERT_ORD);
********** COMMENT();
CHANGE FIELD(#S_176STAT) TO(APPROVED);
IF_STATUS IS(*OKAY);
UPDATE FIELDS(*ALL) IN_FILE(SETORD);
ELSE;
INSERT FIELDS(*ALL) TO_FILE(SETORD);
ENDIF;
********** COMMENT();
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(DEL_ORDERS);
********** COMMENT();
********** COMMENT(Delete orders for shipped customer codes);
CHANGE FIELD(#S_176CCOD) TO(AAAAA);
SELECT FIELDS(#S_176STAT) FROM_FILE(SETORDL1) WITH_KEY(#S_176CCOD);
DELETE FROM_FILE(SETORDL1);
ENDSELECT;
********** COMMENT();
CHANGE FIELD(#S_176CCOD) TO(BBBBB);
SELECT FIELDS(#S_176STAT) FROM_FILE(SETORDL1) WITH_KEY(#S_176CCOD);
DELETE FROM_FILE(SETORDL1);
ENDSELECT;
********** COMMENT();
ENDROUTINE;