Writing an Add/Change/Delete/Inquiry maintenance program

A basic program to add, delete and update records in a database file is more complicated than it should be.

Here is a straight-forward program that is a pretty good starting place for writing such a maintenance program. There is nothing dramatic about the program. It is just an easy to follow program that is being shown here to help inexperienced programmers.

It is fairly full featured. It includes feedback messages to the user to confirm that data was added or updated. It includes a message if the user hits F3 and no action was taken. Deletes require hitting F9 to confirm. There is also a selection "N", for next, which allows the user to navigate through the file.

There is no automatic download feature here. Simply cut and paste the code to your AS/400.

1)   Create the physical file. It is named CUST.
2)   Create the display file. It is named CUSTD01.
3)   Create the RPG program (RPG III) or Create the RPG program (RPG IV). It is named CUSTR01.

To run it, CALL CUSTR01.


Below is a visual of how the display screens will appear using the RPG program named CUSTR01.

Screen 1 - Inquiry Screen
------------------------------------------------------------------------------------
DMOUNT                    ADD/UPDATE/DELETE/INQUIRE            12/01/00
CUSTR01                                                        15:07:43
                                                                               
                                                                               
                                                                               
       (A)dd, (U)pdate, (D)elete (I)nquire, (N)ext   _                          
                                                                               
                           Cust#   ______                                            
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
             F3=EXIT                                                           
------------------------------------------------------------------------------------                                                                               
 

Screen 2 - Maintenance Screen
------------------------------------------------------------------------------------
DMOUNT                    CUSTOMER FILE MAINTENANCE            12/01/00 CUSTR01                              ADD                       15:08:33
                           Cust#    111222                                     
                                                                               
                                                                               
                                                                               
                                                                               
                           Name                                                
                           Address 1                                           
                           Address 2                                           
                           City                                                
                           State                                               
                           Zip           00000                                 
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
             F3=EXIT 
------------------------------------------------------------------------------------

 

Back to Basic 400 Skills   |   Main Page