
*IF NOT $true(osv$unix)
  PROCEDURE [INLINE] clp$convert_file_ref_to_string
*ELSE
  PROCEDURE [XREF] clp$convert_file_ref_to_string
*IFEND
    (    evaluated_file_reference: fst$evaluated_file_reference;
         include_open_position: boolean;
     VAR str: fst$path;
     VAR size: fst$path_size;
     VAR status: ost$status);

?? PUSH (LISTEXT := ON) ??
*IF NOT $true(osv$unix)

    VAR
      cycle_ref_size: fst$path_index,
      cycle_ref_value: string (5),
      cycle_string: ost$string,
      local_status: ost$status,
      i: fst$path_index,
      open_pos_size: 4 .. 5;

    status.normal := TRUE;

    size := evaluated_file_reference.path_structure_size;
    str := evaluated_file_reference.path_structure (1, size);
    str (1) := ':';
    i := $INTEGER (evaluated_file_reference.path_structure (1)) + 2;
    WHILE i < size DO
      str (i) := '.';
      i := i + $INTEGER (evaluated_file_reference.path_structure (i)) + 1;
    WHILEND;

    IF evaluated_file_reference.cycle_reference.specification <>
          fsc$cycle_omitted THEN
      CASE evaluated_file_reference.cycle_reference.specification OF
      = fsc$cycle_number =
        clp$convert_integer_to_string (evaluated_file_reference.
              cycle_reference.cycle_number, 10, FALSE, cycle_string,
              local_status);
        cycle_ref_size := cycle_string.size;
        cycle_ref_value := cycle_string.value (1, cycle_string.size);
      = fsc$high_cycle =
        cycle_ref_size := 5;
        cycle_ref_value := '$HIGH';
      = fsc$low_cycle =
        cycle_ref_size := 4;
        cycle_ref_value := '$LOW';
      = fsc$next_cycle =
        cycle_ref_size := 5;
        cycle_ref_value := '$NEXT';
      ELSE
        cycle_ref_size := fsc$max_path_size;
      CASEND;

      IF (i + cycle_ref_size) <= fsc$max_path_size THEN
        str (i) := '.';
        str (i + 1, cycle_ref_size) := cycle_ref_value;
        size := i + cycle_ref_size;
      ELSE
        osp$set_status_abnormal ('CL', cle$file_reference_too_long, '',
              status);
        RETURN;
      IFEND;
    IFEND;

    IF include_open_position AND evaluated_file_reference.path_handle_info.
          path_handle.open_position.specified THEN
      open_pos_size := clv$open_position_designator
            [evaluated_file_reference.path_handle_info.path_handle.
            open_position.value].size;
      IF size + open_pos_size + 2 <= fsc$max_path_size THEN
        str (size + 1) := '.';
        str (size + 2, open_pos_size) := clv$open_position_designator [
              evaluated_file_reference.path_handle_info.path_handle.
              open_position.value].value (1, open_pos_size);
        size := size + open_pos_size + 1;
      IFEND;
    IFEND;

  PROCEND clp$convert_file_ref_to_string;

*copyc cle$ecc_file_reference
*IFEND
*copyc fst$evaluated_file_reference
*copyc fst$path
*IF NOT $true(osv$unix)
*copyc fst$path_index
*IFEND
*copyc fst$path_size
*copyc ost$status
*IF NOT $true(osv$unix)
*copyc ost$string
*IFEND
?? POP ??
*IF NOT $true(osv$unix)
*copyc clp$convert_integer_to_string
*copyc clv$open_position_designator
*copyc osp$set_status_abnormal
*IFEND
