Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / BCI433 Lab 7 (updated Fall 2020) Lab objectives: - Update a master file with adds/changes and deletes from a transaction file - Use a CLLE driver program to automate testing of the update program - View the journaled changes made to the master file   - employ a simple user defined function and then update the function solution with more efficient code   Requirements to pass the lab:   Successfully run the CLLE program updating data in a collection created by you and be able to show the add, update and delete journaled changes

BCI433 Lab 7 (updated Fall 2020) Lab objectives: - Update a master file with adds/changes and deletes from a transaction file - Use a CLLE driver program to automate testing of the update program - View the journaled changes made to the master file   - employ a simple user defined function and then update the function solution with more efficient code   Requirements to pass the lab:   Successfully run the CLLE program updating data in a collection created by you and be able to show the add, update and delete journaled changes

Business

BCI433 Lab 7 (updated Fall 2020)

Lab objectives:

- Update a master file with adds/changes and deletes from a transaction file

- Use a CLLE driver program to automate testing of the update program

- View the journaled changes made to the master file

 

- employ a simple user defined function and then update the function solution with more efficient code

 

Requirements to pass the lab:

 

Successfully run the CLLE program updating data in a collection created by you and be able to show the add, update and delete journaled changes.

 

Successfully run the CLLE driver program demonstrating user defined functions implemented in the WHATDAY program.

 

7 A. All the parts for this application will be handed out. The RPGLE program, the CLLE driver program, and the master and transaction files. You need to adapt this application so you can update a master file in your own collection

 

7B. All the parts for this application will be handed out. The display file code, RPGLE module code, function prototypes and user defined function are available in BCI433LIB. You just need to compile and put them together. The code for a driver CLLE program and an improved function will be given in class.

 

7A

 

Call RunLab7A

SALESSTAF2 – data comes from SALESSTAFF in BCI433LIB

 

 

 

Transaction File SALESTRANS in BCI433LIB indicates adds, changes and deletes to your SALESTAFF table

 

 

 

Report on what occurred when implementing the updates from the transaction file

 

 

 

 

 

SALESTAFF after the updates were applied by your program

 

 

 

 

All the spooled files generated with meaningful names.

 

 

 

 

 

 

The transactions are journaled

 

 

 

 

 

 

 

 

 

 

 

Steps to successfully run lab 7A

 

  1. Create a source physical file called LAB7A

 

  1. Create a collection using parts of your id (mine is DM433B40 so I will use DM and B40. The U stands for update and is common for all ids.

 

CREATE COLLECTION DMUB40

 

3.  Copy the provided code in BCI433LIB/Lab7Code. The PRTF is called UPDREPORT and can be copied and compiled. The RPGLE program is called SLSTRNPGM and the CLLE program is called RUNLAB7.  Only a few lines of code need to be added to the CLLE driver program and the RPGLE program. Study these programs. The code has been supplied for both on the next pages and your teacher will supply the missing few lines in class. You will also need to change the CLLE code so it refers to your data, journal and output queue.

 

 

 

4.   After you enter the missing code and make the necessary edits, you will compile the CLLE and RPGLE programs.

 

 RPGLE program to apply the updates

 

 

      DCL-F UPDREPORT  PRINTER OflInd(*IN01);

    DCL-F SALESTRANS DISK(*EXT) KEYED USAGE(*INPUT)

        RENAME(SALESTRANS:SALESTRANR);

    DCL-F SALESSTAF2 DISK(*EXT) KEYED

        USAGE(*UPDATE : *OUTPUT : *DELETE);

 

    DCL-DS FullKey ;

         ADept    CHAR(3);

         ASalesId CHAR(4);

    END-DS FullKey;

 

    DCL-DS SalesTransDS;

         TDept;

         TSalesId;

         TFName;

         TLName;

         TCity;

         TAddress;

         TPCode;

  End-Ds SalesTransDs;

 

 

 

  DCL-DS SalesStaf2DS;

         Dept;

         SalesId;

         FName;

         LName;

         City;

         Address;

         PCode;

  End-Ds SalesStaf2Ds;

 

             WRITE  HEADING;

             READ   SALESTRANS;

             DOW    NOT %EOF;                                  

 

______________________________________________________

   

  ______________________________________________________

        

                 SELECT;

 

             WHEN  %FOUND(SALESSTAF2);

                 SELECT;

                     WHEN  TCODE = 'C';

                    EXSR CHGREC;

                 WHEN  TCODE = 'D';

                     EXSR DELREC;

                     OTHER;

                          EXSR ERROR;

                 ENDSL;

 

             WHEN NOT %FOUND(SALESSTAF2);

                     IF TCODE = 'A';

                     EXSR  ADDREC;

                 ELSE;

                 EXSR ERROR;

                 ENDIF;

 

             WHEN %ERROR;

                 EXSR  ERROR;

                 ENDSL;

 

 

 

                 IF *IN01 = *ON;

                 WRITE HEADING;

                 *IN01 = *OFF;

             ENDIF;

 

             WRITE  DETAIL;

             READ   SALESTRANS;

 

          ENDDO;

         *INLR = *ON;

         RETURN;

 

   BEGSR  ADDREC;

                   ______________________________________________

 

                   ______________________________________________

 

                   ______________________________________________

 

                 

 ENDSR;

 BEGSR  CHGREC;

 

                   ______________________________________________

 

                   ______________________________________________

 

                   ______________________________________________

 

                

 ENDSR;

 BEGSR  DELREC;

                   DELETE SALESTFR;

 ENDSR;

 

 BEGSR  ERROR;

        TFNAME = 'UPDATE/DELETE/CHANGE';

        TLNAME = 'E R R O R';

 ENDSR;

 

CLLE driver program

 

/* This program will not work until have it refer to your own collection and userprofile */

 

PGM

   DLTF DMUB40/SALESSTAF2

      MONMSG     MSGID(CPF2105)

 

______________________________________________________________________

 

______________________________________________________________________

 

______________________________________________________________________

 

______________________________________________________________________

  

 

   CLROUTQ DM433B40

 

   OVRPRTF FILE(QPQUPRFIL) SPLFNAME(BEFORE_UPD)

   RUNQRY *NONE DMUB40/SALESSTAF2 *PRINTER

 

   OVRPRTF FILE(QPQUPRFIL) SPLFNAME(SALESTRANS)

   RUNQRY *NONE BCI433LIB/SALESTRANS *PRINTER

 

   OVRPRTF FILE(QPRINT) SPLFNAME(UPDREPORT)

   OVRDBF SALESSTAF2 DMUB40/SALESSTAF2

   CALL SLSTRNPGM

 

   OVRPRTF FILE(QPQUPRFIL) SPLFNAME(AFTER_UPD)

   RUNQRY *NONE DMUB40/SALESSTAF2 *PRINTER

 

   DSPSPLF BEFORE_UPD

   DSPSPLF SALESTRANS

   DSPSPLF UPDREPORT

   DSPSPLF AFTER_UPD

 

WRKOUTQ DM433A40

 

   DSPJRN JRN(DMUB40/QSQJRN) FILE((DTUB40/SALESSTAF2))

 

ENDPGM

                  

 

 

 

 

 

 

User Defined Functions

 

 

 

 

You can copy DATEPROTOS, DAYDSP, DAYFUNCTS and DAYSRPG from BCI433LIB/USERDEFFUN.

 

A user defined function is created and used. DayNumName( ) accepts a one digit number and returns a day name word.  First this user defined function is set up using inline case structure as a simple solution and that code is entered in DAYFUNCTS. A better solution using an array will be discussed in class and will be entered in DAYFUNCTS2.

Input and Output records for DAYSRPG which relies on a user defined function

 

 

 

 

The module that relies on a user defined function is combined with the module that solves the user defined function into a working program called WHATDAY

DAYSRPG

    DCL-f DayDsp Workstn;      

 

//This will accept a passed parameter indicating type of solution used to determine the day name

________________________________________________________

________________________________________________________

________________________________________________________

// prototype copied in

 

____________________________________________________________________    

                                    

            EXFMT INPUT;                   

            DOW NOT(*IN03);                

            DayName = DayNumName(DayIn);

            *in99 = *on;                

            WRITE INPUT;               

            EXFMT OUTPUT;              

            *in99 = *off;               

            IF *IN03 = '0';            

                        DayIn = 0;               

                        EXFMT INPUT ;            

            ENDIF;                      

            ENDDO;                        

      *INLR = *ON;                  

      RETURN;                       

DAYPROTO  contains two prototypes

 

The Prototype for DayNumName

________________________________________________________

________________________________________________________

________________________________________________________

 

The Prototype for MonthNumName (not used in this lab)

Used to support a more sophisticated Day Name like

Sunday April 5, 2020

________________________________________________________

________________________________________________________

________________________________________________________

 

DayNumName and MonthNumName are not RPGLE functions. But, they can be created and then used by all programmers. The RPGLE compiler would reject

 

DayName = DayNumName(DayIn);

 

The prototype is telling the compiler to accept DayNumName as legitimate.

 

DAYFUNCTS

 

       ______________________________________________________  (no need for *INLR = *ON)

 

       _____________________________________________                                      (Get the Prototype code)

 

       _____________________________________________                                   ( the user defined function)

 

       _____________________________________________                                   (what is returned from the function)

 

       _____________________________________________                                   (what is input to the function)

 

       _____________________________________________

 

       _____________________________________________                                   (Local variable)

 

                                                                                                                                                            (Solve  the function)

                 SELECT;                                                                           

                     WHEN NUMBER = 1;                                                              

                     DAYNAME = 'Monday';                                                           

                     WHEN NUMBER = 2;                                                               

                     DAYNAME = 'Tuesday';                                                          

                     WHEN NUMBER = 3;                                                              

                     DAYNAME = 'Wednesday';                                                        

                     WHEN NUMBER = 4;                                                              

                     DAYNAME = 'Thursday';                                                          

                     WHEN NUMBER = 5;                                                              

                     DAYNAME = 'FRIDAY';                                                           

                     WHEN NUMBER = 6;                                                              

                     DAYNAME = 'Saturday';                                                         

                     WHEN NUMBER = 7;                                                               

                     DAYNAME = 'Sunday';                                                           

                     OTHER;                                                                        

                     DAYNAME = 'Unknown';                                                          

                 ENDSL;

 

                 ________________________________________                                                                           

            

                        __________________

                                                                    

      

 

 

DAYFUNCTS2

 

This program will be discussed in class. It will replace the in line case structure with a positional array lookup. It will not error check for an invalid number like the solution above did.

 

 

 

       RUNLAB7B

 

You need to code a CLLE driver program discussed in class to demonstrate this lab. The following screens will show.

 

1.  First screen shows the two modules in WHATDAY.

 

 

 

 

  1. Showing the code with the SELECT solution to determine the day name

 

 

 

 

 

  1. Employing the SELECT solution 3 was entered and then the enter key was pressed to get the result.

 

 

 

  1. Message shown with SNDUSRMSG

 

 

 

  1. Showing WHATDAY with the new module that uses the ARRAY solution

 

 

  1. Module code for DAYFUNCTS2

 

 

 

  1. Running the array module solution. Note we can bomb this by an out of range number. This is done on purpose. To distinguish between the two modules at run time.

 

 

 

 

Option 1

Low Cost Option
Download this past answer in few clicks

22.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE