Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / BCI433 Lab 10 Lab objectives:    - Create and Use user defined functions in a RPGLE program - Note Lab 10 has been simplified to allow you time to work on Lab 8   Requirements to pass the lab:   Successfully run the RUNLAB10 CLLE driver program demonstrating user defined functions implemented in the WHATDAY program

BCI433 Lab 10 Lab objectives:    - Create and Use user defined functions in a RPGLE program - Note Lab 10 has been simplified to allow you time to work on Lab 8   Requirements to pass the lab:   Successfully run the RUNLAB10 CLLE driver program demonstrating user defined functions implemented in the WHATDAY program

Computer Science

BCI433 Lab 10

Lab objectives: 

 

- Create and Use user defined functions in a RPGLE program

- Note Lab 10 has been simplified to allow you time to work on Lab 8

 

Requirements to pass the lab:

 

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

 

User Defined Functions

 

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

Partial code for DAYSRPG, DAYFUNCTS is available in BCI433LIB/LAB10W2020. All of the code for DAYDSP is available at that location. None of the code for RUNLAB10, DAYFUNCTS2 and DAYPROTO is available to copy, that code will be provided in class.

 

DAYSRPG

    DCL-f DayDsp Workstn;      

 

____________________________________________________________________    

                                    

            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. It can be set up so it will be impossible to send the day function a weekday number that did not exist (like 9) from the program using this function solution.

 

       RUNLAB10

Option 1

Low Cost Option
Download this past answer in few clicks

16.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE