PROCEDURE rap$get_system_level (
  os_version_file, ovf    : file = $required
  system_level, sl        : (VAR) name = $required
  status)

*IF $variable(wev$prod_doc,declared)<>'UNKNOWN'
"
"  Extract the value of the currently installed operating system
"  level by including the file specified by the parameter OVF.
"  Doing so creates three variables, BUILD_ID, VERSION_ID, and
"  LEVEL_ID, which contain build level and release level information.
"
*IFEND

  VAR
    level_string: string
    local_status : status
  VAREND

  $system.include_file f=os_version_file status=local_status
  IF local_status.normal THEN
    IF $variable(level_id, defined) THEN
      system_level = level_id
    ELSE
      level_string = $trim($substr(version_id,16,6))
      system_level = $name('level_'//level_string)
    IFEND
  ELSE
    EXIT procedure WITH local_status WHEN NOT local_status.normal
  IFEND

PROCEND rap$get_system_level
