VisualAge Generator to Enterprise Generation Language Migration Guide

I/O error routine

VisualAge Generator: A function that does file or database I/O can specify an I/O error routine. The I/O error routine can be a main function or a non-main function; the syntax is the same. VisualAge Generator determines at test or generation time whether the I/O error routine is a main function or non-main function for the program. When a main function is used as the I/O error routine, VisualAge Generator pops the function stack back to the top of the stack, starts the stack over again with only the (I/O error routine) main function on the stack, and then invokes the main function. When a non-main function is used as the I/O error routine, VisualAge Generator adds the non-main function to the current function stack and then invokes the function.

EGL: The try block and onException statement are used for error handling. The syntax for an onException statement supports the following:

Associated part needed for migration: The program with its list of main functions.

Figure 35. Ambiguous situations for functions--File and database I/O error routines

Migrating with the associated part
Migrating without the associated part
Based on the first migration of this function, if there is a program available, the migration tool does the following:
  • Changes an I/O error routine that specifies a program main function to:
    try
      I/O-Statement;
      onException  exit stack functionName;
    end 
    
  • Changes an I/O error routine that specifies a non-main function to:
    try
      I/O-Statement;
      onException functionName();
    end
    
If there is no program available, the migration tool does the following:
  • Assumes that the function named in an I/O error routine is a non-main function and changes it to the following:
    try
      I/O-Statement;
      onException functionName();
    end
    
  • Does not issue a warning message due to the high volume of messages that could be issued and the likelihood that messages will be ignored or hide other serious error messages.

Potential Problem: A problem arises if this function is used in a program where the I/O error routine differs in its use as a main or non-main function from the original program.

Note:
There will not be a message on the Tasks list. Preprocessing and generation will not detect an error. However, the program will not run the same as in VisualAge Generator. Instead of popping the stack as in VisualAge Generator, EGL will add the main function to the stack.

Possible Solution 1: If this situation arises, create a new version of this I/O function with the proper syntax for transferring to a main function. Note that this technique has the potential to ripple back into other functions that invoke the I/O function.

Possible Solution 2: If this situation arises, restructure the program so it does not use the equivalent of VAGen flow statements.

Potential Problem: A problem arises if this function is used in a program where the I/O error routine is a main function.

Note:
There will not be a message on the Tasks list. Preprocessing and generation will not detect an error. However, the program will not run the same as in VisualAge Generator. Instead of popping the stack as in VisualAge Generator, EGL will add the main function to the stack.

Possible Solutions: The same solutions listed for Migrating with the associated part apply.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]