#####################################################################
# Action routine to Setup List_DB. This action routine should be
# called each time the List_DB is made permanent and visible.
######################################################################
action SetupList_DB is
# Call the OPEN_SelectStaff action routine to open the cursor for the
# select statement.
action OPEN_SelectStaff
if not (EDB2Error_BV) then
# Check for any errors after executing the OPEN_SelectStaff action
# routine. If no error occurred then continue. Call the
# FETCH_SelectStaff action routine to fetch the results into the ESL
# host variables.
action FETCH_SelectStaff
if not (EDB2Error_BV) then
# Check for any errors after executing the FETCH_SelectStaff action
# routine. If no error occured then continue.
clear List_TBL in List_DB
copy 1 to Rowid_IV
# Check to verify that an error condition of END_OF_DATA has not
# occcured.
while ((Esqlca.Sqlcode != END_OF_DATA) and
Esqlca.Sqlcode !=(CURSOR_CLOSED)) loop
# Insert results of multi-row select into table in List_DB.
add to List_TBL insert row
values NAME_SV, ID_IV
copy (Rowid_IV + 1) to Rowid_IV
# Call the FETCH_SelectStaff action routine to fetch the results into
# the ESL host variables.
action FETCH_SelectStaff
end loop
# Close the cursor when all the results are retrieved.
action CLOSE_SelectStaff
if not (EDB2Error_BV) then
# If you did not receive an error when closing the cursor then
# proceed. Display the List_DB to the user.
make List_DB visible
end if
end if
end if
# If the EDB2Error_BV is true call an action routine to display the
# error to the user. Action DisplayError can be any user written
# action routine which can display the appropriate error information
# to the user.
if (EDB2Error_BV) then
action DisplayError
end if