
*copyc osd$default_pragmats
  MODULE rhm$map_pfm_code_to_rh_code ALIAS 'rhmpmc';

{ Select target 170 operating system.
*IF ($string($name(wev$target_operating_system))='NOS')

  ?VAR rhv$nos_be: boolean := FALSE ?;
*ELSE

  ?VAR rhv$nos_be: boolean := TRUE ?;
*IFEND

*copyc ZN7PPFM
*copyc RHC$NOSBE_PF_ERROR_CODES
*copyc RHC$CONSTANTS
*copyc RHC$CONDITION_LIMITS
?? SET (LIST:=ON) ??

{ MAP_PFM_CODE_TO_RH_CODE
{
{         The purpose of this procedure is to provide a mapping from the
{ given 170 permanent file manager error code to a remote host error code.
{
{         MAP_PFM_CODE_TO_RH_CODE (PFM_CODE,RH_CODE)
{
{ PFM_CODE: (input) This parameter contains the pfm error code which is
{           to be mapped into the remote host error code.
{
{ RH_CODE: (output) This parameter contains the remote host error code
{          which is the result of the mapping.
{

  PROCEDURE[XDCL] map_pfm_code_to_rh_code (
    pfm_code: 0..0ff(16);
    VAR rh_code: INTEGER);

? IF rhv$nos_be = FALSE THEN
    CASE pfm_code OF
    =n7c$pfm_ok= rh_code:=rhc$ok;
    =n7c$pfm_file_busy= rh_code:=rhe$cycle_busy;
    =n7c$pfm_file_not_found= rh_code:=rhe$missing_file;
    =n7c$pfm_file_too_long= rh_code:=rhe$permanent_file_too_large;
    =n7c$pfm_data_transfer_error,
     n7c$pfm_sys_mass_storage_error..n7c$pfm_sys_data_permit_error,
     n7c$pfm_sys_staging_error= rh_code:=rhe$file_io_error;
    =n7c$pfm_catalog_overflow_files= rh_code:=rhe$too_many_permanent_files;
    =n7c$pfm_catalog_overflow_size= rh_code:=rhe$too_much_pf_storage;
    =n7c$pfm_prus_not_available,
     n7c$pfm_sys_track_limit= rh_code:=rhe$mass_storage_unavailable;
    ELSE rh_code:=rhe$file_error;
    CASEND;
? ELSE
    CASE pfm_code OF
      = n7c$fdb_ok =
        rh_code := rhc$ok;
      = n7c$fdb_id_error =
        rh_code := rhe$id_error;
      = n7c$fdb_unknown_lfn =
        rh_code := rhe$unknown_lfn;
      = n7c$fdb_pfc_full =
        rh_code := rhe$pfc_full;
      = n7c$fdb_file_not_cataloged =
      rh_code := rhe$file_not_cataloged;
      = n7c$fdb_cycle_number_over_999 =
      rh_code := rhe$cycle_number_over_999;
      = n7c$fdb_pfd_full =
      rh_code := rhe$pfd_full;
      = n7c$fdb_cycle_incomplete =
      rh_code := rhe$cycle_incomplete;
      = n7c$fdb_file_archived =
      rh_code := rhe$file_archived;
      = n7c$fdb_ill_char_in_fdb_param =
       rh_code := rhe$ill_char_in_fdb_param;
      = n7c$fdb_file_dumped =
      rh_code := rhe$file_dumped;
      = n7c$fdb_no_apf_space =
      rh_code := rhe$no_apf_space;
      = n7c$fdb_permission_conflicts =
      rh_code := rhe$permission_conflicts;
      = n7c$fdb_rbt_chain_too_large =
      rh_code := rhe$rbt_chain_too_large;
      = n7c$fdb_unavailable_device =
      rh_code := rhe$unavailable_device;
      = n7c$fdb_file_not_available =
      rh_code := rhe$file_not_available;
      = n7c$fdb_pfm_stopped_by_system =
      rh_code := rhe$pfm_stopped_by_system;
      = n7c$fdb_incorrect_permission =
      rh_code := rhe$incorrect_permission;
    ELSE
      rh_code := rhe$io_error;
    CASEND;
 ? IFEND

  PROCEND map_pfm_code_to_rh_code;

  MODEND rhm$map_pfm_code_to_rh_code;
