DDM example 2: Description of ORDERENT program

 

Initially, the ORDERENT program exists only in library PGMLIB on the central server (in Philadelphia).

This program does the following items:

For the following examples, it is assumed that all users on the remote servers who need to access CUSTMAST in Philadelphia already have authority to do so, and that those who do not need authority do not have it. In these examples, the iSeries™ server in Chicago does not have a compiler.

If we want this program to be used at all the remote locations that also stock a physical inventory, the program needs to be sent to each of the remote servers. We can assume that each of the remote servers has its own inventory and primary files INVEN, DETAIL, and CUSTMST2 (which is a copy of CUSTMAST). How the program can be sent to a remote server is described in DDM example 2: Transfer a program to a target server.

By using the code examples, you agree to the terms of the Code license and disclaimer information.

   Pseudocode for ORDERENT Program
   •
   •
   •
DECLARE CUSTMAST CHANGE       * Declare file CUSTMAST and allow changing.
DECLARE CUSTMST2 READ       * Declare file CUSTMST2 as read only.
DECLARE INVEN CHANGE       * Declare inventory file INVEN and allow changing.
DECLARE DETAIL OUTPUT       * Declare file DETAIL as output only.
   •
   •
   •
Open CUSTMAST, CUSTMST2, INVEN, and DETAIL files       * Begin program.
   Show order entry display asking for CUSTNO.
         * Order entry operator enters CUSTNO.
   If function key, go to End.
   Read CUSTNO from display.
      For CUSTNO, return NAME, ADDR, and other       information from CUSTMST2 file.
   Show NAME, ADDR, and other information on display.
   LOOP: Display 'Item Number ___     Quantity Desired ____'.
         * Order entry operator enters item number and quantity.
      Read ITEMNO and Quantity Desired from display.
      If ITEMNO = 0 then go to LOOPEND.
         Change INVEN with ITEMNO and Quantity Desired.
         Write an item record to the DETAIL file.
      Go to LOOP.
   LOOPEND:  For CUSTNO, change CUSTMAST using              information in file INVEN.
   End       * Program has ended.
Close CUSTMAST, CUSTMST2, INVEN, and DETAIL files.
RETURN

 

Parent topic:

DDM example 2: ORDERENT application