VisualAge Generator to Enterprise Generation Language Migration Guide

I/O error values UNQ and DUP

VisualAge Generator: UNQ and DUP are always soft errors for non-SQL and hard errors for SQL. UNQ and DUP are always set for SQL based on the -803 SQL code. If an I/O error routine is specified for the function, the error routine gets control for the following:

EGL: Duplicate is always a soft error and indicates the I/O was successful. Unique is always a hard error and indicates the I/O failed. Duplicate is not supported for SQL. The try block and onException statement are used for error handling. If an onException statement is specified for the I/O statement, the onException statement gets control for the following:

Associated part needed for migration: The record that is used in the statement.

Figure 49. I/O error values UNQ and DUP

Migrating with the associated part
Migrating without the associated part
Based on the first migration of this function, if the record is available, the migration tool does the following:
  • If the record is non-SQL, the migration tool changes DUP to duplicate and UNQ to unique.
  • If the record is SQL, the migration tool changes both DUP and UNQ to unique.
If the record is not available, the migration tool tries to determine the type of the record as follows:
  • If the statement specifies the same record as the function's I/O object, the migration tool checks to see if the function also has SQL clauses, or any SQL-specific information, such as Execution Time Statement Build, single row select, cursor with hold or an UPDATE/SETUPD function. If so, the migration tool assumes that the record is SQL and converts DUP and UNQ to unique.
  • In other situations such as the following, the migration tool cannot determine the record type:
    • If the record is used as the I/O object of the function but the function does not have SQL-specific information.
    • If the record is not used as the I/O object of the function.

    In the previous situations, and in other situations when the migration tool cannot determine the record type, the migration tool does the following:

    • Converts UNQ to unique.
    • Converts DUP to EZE_DUPLICATE and issues an error message.

Potential Problem: A problem only arises if the same record name has different definitions, one for SQL and one for non-SQL, most likely in different subsystems. If the non-SQL record is available when the function is migrated, then there will be an error if the function is used with an SQL record and checks for duplicate. If the SQL record is available when the function is migrated, then the additional information conveyed by the duplicate check will not be available for the non-SQL record.

Possible Solution: Copy the function and use the original function for SQL and the new function for non-SQL. Disadvantage: This has the potential to ripple back into functions that use the original function that checked for UNQ or DUP.

Potential Problem for SQL: None. DUP and UNQ were always set the same way and unique continues to be a hard error.

Potential Problem 1 for non-SQL: A problem arises if you do not set handleHardIOErrors (EZEFEC) = 1 for the program. In this case, because unique is now a hard error, the onException statement will not get control and the program will end.

Solution: Make sure your programs specify handleHardIOErrors = 1;

Potential Problem 2 for nonSQL: A problem also arises if you are explicitly testing for hardIOError (HRD). In this case, because unique is now a hard error, hardIOError will test true in WSED in some cases, even though it did not test true in the past on VisualAge Generator. Validation and preprocessing will not detect an error. However, the program might not run the same as it did in VisualAge Generator.

Possible Solution: You might need to reorder the testing of the I/O error values in your program logic.

Potential Problem 1: EZE_DUPLICATE is not valid in EGL.

Solution: Edit the function and change EZE_DUPLICATE to duplicate or unique based on the record type.

Other Potential Problems: The same potential problems and solutions as shown for Migrating with the associated part apply.


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