PROCEDURE (HIDDEN) rap$check_for_deferred_products (
  deferred_products, dp: (VAR) boolean = $required
  )

*IF $variable(rav$proc_doc,declared)<>'UNKNOWN'

" PURPOSE:
"   This procedure returns a boolean value based on whether or not there are deferred products to be
"   activated.
"
" NOTES:
"
"   If the directory file is not present, then we assume the customer is
"   upgrading from a system which does not have INSS (pre 1.4.1) and
"   therefore their cannot be deferred products.
"
"   If the include file returns the incompatible sequence then we
"   can't read the directory.  Therefore their are no deferred products
"   that we can process.
*IFEND

  "$FORMAT=OFF
  VAR
    command_file: file = $unique($local)
    ignore_status: status
    local_status: status
    rav$system: (XREF) file
  VAREND
  "$FORMAT=ON"

IF NOT $file(rav$system.software_maintenance.installation_database.raf$idb_directory, permanent) THEN
  $value(deferred_products) = FALSE
  EXIT procedure
IFEND

COLLECT_TEXT o=command_file
  install_software
    IF rav$system <> :$system.$system THEN
      change_installation_defaults system_catalog=rav$system
    IFEND
    $value(deferred_products)=$deferred_subproducts
  quit
**
  $system.include_file f=command_file status=local_status
  $system.delete_file f=command_file status=ignore_status

  IF NOT local_status.normal THEN
    $value(deferred_products) = FALSE
    IF (($condition(local_status.condition)='RAE$INCOMPATIBLE_SEQUENCE_LEVEL') OR ..
       ($condition(local_status.condition)='CLE$WRONG_KIND_OF_VALUE')) THEN
      local_status.normal = TRUE
    IFEND
  IFEND

  EXIT procedure WITH local_status WHEN NOT local_status.normal

PROCEND rap$check_for_deferred_products
