Neil (nt) wrote,
Neil
nt

Still very busy at work. What a range of emotions today! Anxiety, anger, frustration during the day. Then complete relaxation and happiness after getting home and spending some time with L.

For lunch, I brought a sandwich and a Coke back to my desk. Sat down, popped the lid on the Coke, then tipped it over answering the phone. Soaked the sandwich, and spilled all over my desk and keyboard. Grrrrr!

I'm hoping that I get the long weekend off, but if I have to put in some time at work, so be it.

Below is an example of the type of code I write. I do more than write code, but that is the end result of all the meetings, analysis, design, etc. This is a small section of one program; the complete program is around 1500 lines.


ASSIGN v-all-contract-allo-amt = 0
       v-all-contract-allo-energy = 0.

for each b-sca-ord WHERE b-sca-ord.product = ip-product
                     AND b-sca-ord.del-point = ip-del-point
                     AND b-sca-ord.type = ip-type
                     AND b-sca-ord.single-del-pt = ip-single-del-pt
                     AND b-sca-ord.nom-found = ip-nom-found
                     AND b-sca-ord.signatory = ip-signatory
                     AND b-sca-ord.contract-priority = ip-priority
                     AND b-sca-ord.contract-no = (IF ip-contract-no <> 0 THEN
                                                     ip-contract-no
                                                  ELSE
                                                     b-sca-ord.contract-no)
                     AND b-sca-ord.shipper = (IF ip-shipper <> 0 THEN
                                                 ip-shipper
                                              ELSE
                                                 b-sca-ord.shipper)
                     AND b-sca-ord.sort-order = ip-sort-order
                   NO-LOCK BREAK BY b-sca-ord.contract-no:

   IF FIRST-OF(b-sca-ord.contract-no) THEN
      ASSIGN v-avs-amt = 0
             v-avs-energy = 0.

   IF NOT CAN-FIND(FIRST wk-used WHERE wk-used.stream-id = b-sca-ord.stream-id
                                   AND wk-used.OWNER = b-sca-ord.owner) THEN
   DO:
      for each t-owell WHERE t-owell.product = ip-product
                         AND t-owell.component = ip-component
                         AND t-owell.owner = b-sca-ord.owner
                         AND t-owell.stream-id = b-sca-ord.stream-id:
         v-avs-amt = v-avs-amt + t-owell.avs-amt[ip-amt-idx].
         v-avs-energy = v-avs-energy + t-owell.avs-energy[ip-amt-idx].
      end.
      CREATE wk-used.
      ASSIGN wk-used.stream-id = b-sca-ord.stream-id
             wk-used.OWNER = b-sca-ord.owner.
   END.

   IF LAST-OF(b-sca-ord.contract-no) THEN
   DO:
      find first t-csum WHERE t-csum.del-point = ip-del-point
                          AND t-csum.type = ip-type
                          AND t-csum.product = ip-product
                          AND t-csum.component = ip-component
                          AND t-csum.contract-no = b-sca-ord.contract-no
                        no-error.
      if available t-csum then
         ASSIGN v-all-contract-allo-amt = v-all-contract-allo-amt + min(v-avs-amt, t-csum.unallo-nom-amt)
                v-all-contract-allo-energy = v-all-contract-allo-energy + min(v-avs-energy, t-csum.unallo-nom-energy).
      ELSE
         assign v-all-contract-allo-amt = v-all-contract-allo-amt + v-avs-amt
                v-all-contract-allo-energy = v-all-contract-allo-energy + v-avs-energy.
      CREATE wk-contract.
      ASSIGN wk-contract.contract-no = b-sca-ord.contract-no
             wk-contract.avs-amt = v-avs-amt
             wk-contract.avs-energy = v-avs-energy
             wk-contract.unallo-nom-amt = (IF AVAILABLE t-csum THEN
                                              min(v-avs-amt, t-csum.unallo-nom-amt)
                                           ELSE
                                              v-avs-amt)
             wk-contract.unallo-nom-energy = (IF AVAILABLE t-csum THEN
                                                 min(v-avs-energy, t-csum.unallo-nom-energy)
                                              ELSE
                                                 v-avs-energy).
   END.
end.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic
  • 3 comments