4.5 Building and Running the Application

You can now build (compile) your application, view a compiler listing and run your application. You have already defined the AS/400 server and file that is needed to build the application in a previous lesson.

Building Your Application

Follow these steps:

  1. To build the project into an executable application, select Project > Build > Windows NT/95/98 from the submenus.
  2. A message window appears to ask if your work should be saved before proceeding with the build.

    Click Save to continue.

  3. The VisualAge RPG-Build Windows NT/95/98 window appears while the build is being performed. A Sign-on to Server window appears. Enter your user ID and password. Click OK.

    Shortly afterwards, you are informed if the application was built successfully or if there were any problems. You will need to fix any errors before you can run the application. You should only receive Information messages which means the build should complete successfully.

Viewing the Compiler Listing

Remember that the RPG compiler resides on the workstation. The application logic and the presentation interface runs on the workstation. At any time, it is possible to view the files that make up your project including the compiler listing on your workstation.

Follow these steps:

  1. Select Project > Browse compile listing from the submenus.
  2. The compiler listing displays. Note the similarities between the VisualAge RPG compiler listing and the compiler output produced by the AS/400 RPG compiler.

  3. Close the compiler listing by double-clicking the left mouse button in the top left-hand corner of the window.

Running and Testing Your Application

You are now ready to run and test the application.

Follow these steps:

  1. Select Project > Run > and either Windows NT/95/98 or Java from the submenus or select the Run icon in the tool bar.
  2. The first window displays. Enter a valid customer number (such as 0016000). Notice that you had to move your cursor to the field before entering the number. This action is necessary since you did not give focus to this field. Normally, you would automatically place the cursor in the right position.
  3. Click OK. This action displays the second window Customer Information with the customer information filled in.
  4. If you enter a wrong customer number, nothing happens since you did not provide any code to handle errors. In the next exercise you will add some error handling code.

  5. Go to the Customer Information window and then click OK. The window disappears.
  6. Click OK again on the Customer Inquiry window. You will receive a run-time error because the SHOWWIN operation code is trying to create a window that has already been created. The next exercise shows you how to handle this error.
  7. Click EXIT to stop the application.

Click on to indicate that you've done all the steps.

This completes exercise 4. You have just added code to access AS/400 files and data and created a new window to display the AS/400 data. Now you are ready to add some error handling code to deal with the case where a wrong part number is entered.

But before you do, we recommend you do the Quiz.