Documentation‎ > ‎

1 min. tutorial

  Next >>


Presentation

In this Tutorial we are going to add unit test on an existing COBOL routine: "PR-ORDER.cbl" (see code above).
This routine is in charge to add deliver taxes to a customer order depending on destination country and origin country.


PR-ORDER.cbl

 IDENTIFICATION DIVISION.
[...]
LINKAGE SECTION.
   01 COMMAND-ORDER.
       05 PRODUCT-INFORMATION.
            10 PRODUCT-CODE PIC X(8).
            10 PRODUCT-SIZE PIC 9(1).
            10 PRODUCT-PRICE PIC 9(4).          
       05 DELIVER-INFORMATION.
            10 FROM-COUNTRY PIC X(2).
            10 TO-COUNTRY PIC X(2).
            10 DELIVER-TAX PIC 9(4).
       05 ORDER-PRICE PIC 9(4).
  
   01 COUNTRY-LIST.
         05 ITALY  PIC X(2).
         05 FRANCE PIC X(2).

PROCEDURE DIVISION USING
COMMAND-ORDER COUNTRY-LIST.
    MOVE PRODUCT-PRICE TO ORDER-PRICE.
    * Set deliver-tax depending on origin and destination country  

    IF FROM-COUNTRY = FRANCE AND TO-COUNTRY=ITALY
      THEN
      MOVE 115 TO DELIVER-TAX     
    END-IF.    
   GOBACK.





 << Previous Next >>