?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE SCL Interpreter: Convert to string routines' ??
MODULE clm$convert_to_string;

{
{ PURPOSE:
{   This module contains the procedures that convert a data value, type
{   description, command/function declaration, or command/function parameters
{   to a string representation.
{

?? NEWTITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clc$max_integer
*copyc clc$max_keyword_values
*copyc clc$max_proc_names
*copyc clc$min_integer
*copyc cle$bad_data_rep_option
*copyc cle$bad_data_value
*copyc cle$bad_string_pattern
*copyc cle$ecc_parsing
*copyc cle$string_too_short
*copyc cle$work_area_overflow
*copyc clk$convert_value_to_string
*copyc clt$convert_to_string_request
*copyc clt$data_kinds
*copyc clt$data_representation
*copyc clt$data_representation_option
*copyc clt$data_value
*copyc clt$string_index
*copyc clt$string_size
*copyc clt$string_value
*copyc clt$symbolic_subrange_qualifier
*copyc clt$type_name
*copyc clt$work_area
*IF NOT $true(osv$unix)
*copyc cyd$run_time_error_condition
*ELSE
*copyc cyt$mips_signal_handler
*IFEND
*IF NOT $true(osv$unix)
*copyc fst$path
*copyc oss$job_paged_literal
*IFEND
*copyc ost$status
?? POP ??
*copyc clp$convert_char_to_graphic
*copyc clp$convert_date_time_to_string
*copyc clp$convert_integer_to_string
*IF NOT $true(osv$unix)
*copyc clp$convert_real_to_string
*IFEND
*copyc clp$convert_type_spec_to_desc
*copyc clp$evaluate_expression
*IF NOT $true(osv$unix)
*copyc clp$get_path_name
*copyc clp$longreal_classify
*IFEND
*copyc clp$recognize_cobol_name
*IF NOT $true(osv$unix)
*copyc clp$search_parameter_names
*IFEND
*copyc clp$sp_convert_to_string
*copyc clp$trimmed_string_size
*copyc clp$type_desc_is_for_old_union
*copyc clp$validate_name
*copyc clv$non_graphic
*copyc i#current_sequence_position
*IF NOT $true(osv$unix)
*copyc mmp$create_scratch_segment
*copyc mmp$delete_scratch_segment
*IFEND
*copyc osp$append_status_parameter
*IF NOT $true(osv$unix)
*copyc osp$disestablish_cond_handler
*copyc osp$establish_condition_handler
*IFEND
*copyc osp$format_message
*copyc osp$get_status_condition_name
*copyc osp$get_status_condition_string
*copyc osp$set_status_abnormal
*copyc osp$unpack_status_identifier
*copyc osv$upper_to_lower
*IF NOT $true(osv$unix)
*copyc pmp$continue_to_cause
*ELSE
*IFEND
?? EJECT ??

  VAR
    clv$retain_unprintable_char: [XREF] boolean;

  VAR
*IF NOT $true(osv$unix)
    clv$value_type_kinds: [XDCL, READ, oss$job_paged_literal] array [clt$data_kind] of
*ELSE
    clv$value_type_kinds: [XDCL, READ] array [clt$data_kind] of
*IFEND
          clt$type_kind := [clc$application_type, clc$array_type, clc$boolean_type, clc$cobol_name_type,
          clc$command_reference_type, clc$data_name_type, clc$date_time_type, * {clc$defered} ,
          clc$entry_point_reference_type, clc$file_type, clc$integer_type, clc$keyword_type, clc$list_type,
          clc$lock_type, clc$name_type, clc$network_title_type, clc$program_name_type, clc$range_type,
          clc$real_type, clc$record_type, clc$scu_line_identifier_type, clc$statistic_code_type,
          clc$status_type, clc$status_code_type, clc$string_type, clc$string_pattern_type,
*IF NOT $true(osv$unix)
          clc$time_increment_type, clc$time_zone_type, clc$type_specification_type, * {clc$unspecified} ];
*ELSE
          clc$time_increment_type, clc$time_zone_type, clc$type_specification_type, * {clc$unspecified},
          clc$unix_file_type];
*IFEND

  VAR
*IF NOT $true(osv$unix)
    clv$type_kind_names: [XDCL, READ, oss$job_paged_literal] array [clt$type_kind] of
*ELSE
    clv$type_kind_names: [XDCL, READ] array [clt$type_kind] of
*IFEND
          clt$type_name := ['APPLICATION', 'ARRAY', 'BOOLEAN', 'COBOL_NAME', 'COMMAND_REFERENCE', 'DATA_NAME',
          'DATE_TIME', 'ENTRY_POINT_REFERENCE', 'FILE', 'INTEGER', 'KEYWORD', 'LIST', 'LOCK', 'NAME',
          'NETWORK_TITLE', 'PROGRAM_NAME', 'RANGE', 'REAL', 'RECORD', 'LINE_IDENTIFIER', 'STATISTIC_CODE',
*IF NOT $true(osv$unix)
          'STATUS', 'STATUS_CODE', 'STRING', 'STRING_PATTERN', 'TIME_INCREMENT', 'TIME_ZONE',
          'TYPE_SPECIFICATION', 'ANY'];
*ELSE
          'STATUS', 'STATUS_CODE', 'STRING', 'STRING_PATTERN', 'TIME_INCREMENT', 'TIME_ZONE',
          'TYPE_SPECIFICATION', 'ANY', 'FILE', '', ''];
*IFEND

?? EJECT ??

  CONST
    continuation = '..',
    continuation_size = 2,
    nesting_indentation = 2,
    structure_indentation = 2;

  CONST
    comma_size = 2 {', '} ,
    left_parenthesis_size = 1 {'('} ,
    max_separator_size = comma_size,
    space_size = 1 {' '} ;

  TYPE
    break_info = record
      index: clt$string_size,
      indent: clt$string_size,
      mark_continuation: boolean,
    recend;

  TYPE
    separator_string = string ( * <= max_separator_size);

  VAR
*IF NOT $true(osv$unix)
    labeled_structures: [STATIC, oss$job_paged_literal, READ] clt$data_kinds :=
*ELSE
    labeled_structures: [STATIC, READ] clt$data_kinds :=
*IFEND
          [clc$array, clc$entry_point_reference, clc$list, clc$range, clc$record];

?? TITLE := 'clp$convert_data_to_string', EJECT ??
*copyc clh$convert_data_to_string

  PROCEDURE [XDCL, #GATE] clp$convert_data_to_string
    (    value: ^clt$data_value;
         representation_option: clt$data_representation_option;
         max_string: clt$string_size;
     VAR work_area {input, output} : ^clt$work_area;
     VAR data_representation: ^clt$data_representation;
     VAR status: ost$status);

    VAR
      request: clt$convert_to_string_request;


    request.initial_indentation := 0;
    request.continuation_indentation := 0;
    request.max_string := max_string;
    request.include_advanced_items := TRUE;
    request.include_hidden_items := TRUE;
    request.kind := clc$convert_data_value;
    request.representation_option := representation_option;
    request.value := value;
    clp$internal_convert_to_string (request, work_area, data_representation, status);

    IF status.condition = cle$work_area_overflow THEN
      status.text.size := 0;
      osp$append_status_parameter (osc$status_parameter_delimiter, 'clp$convert_data_to_string', status);
    IFEND;

  PROCEND clp$convert_data_to_string;
?? TITLE := 'clp$internal_convert_to_string', EJECT ??

  PROCEDURE [XDCL, #GATE] clp$internal_convert_to_string
    (    request: clt$convert_to_string_request;
     VAR work_area {input, output} : ^clt$work_area;
     VAR data_representation: ^clt$data_representation;
     VAR status: ost$status);

    VAR
      break: break_info,
      break_pending: boolean,
      colon_indent: clt$string_size,
      comma: string (comma_size),
      continuation_indentation: clt$string_size,
      convert_to_lower_case: boolean,
      first_pass: boolean,
*IF $true(osv$unix)
      handler_established: boolean,
*IFEND
      include_advanced_items: boolean,
      include_hidden_items: boolean,
      indent_amount: clt$string_size,
      initial_indentation: clt$string_size,
      label_indent_limit: clt$string_size,
      left_parenthesis: string (left_parenthesis_size),
      level_of_nesting: clt$string_size,
      local_status: ost$status,
*IF NOT $true(osv$unix)
      local_work_area: amt$segment_pointer,
*ELSE
      local_work_area: ^clt$work_area,
*IFEND
      max_string: clt$string_size,
      multi_line_format: boolean,
      representation_option: clt$data_representation_option,
      secondary_break: break_info,
      secondary_break_pending: boolean,
      space: string (space_size),
      space_remaining: integer,
      string_count: ^clt$data_representation_count,
      string_may_be_trimmed: boolean,
      string_ptr: ^clt$string_value,
      string_size: ^clt$string_size,
      string_started: boolean,
      symbolic_qualifiers_work_area: ^clt$work_area;

?? NEWTITLE := 'abort_handler', EJECT ??

    PROCEDURE abort_handler
*IF $true(osv$unix)
      (    signal_no: integer;
           code: integer;
           p_sigcontext: ^cyt$mips_sigcontext);
*ELSE
      (    condition: pmt$condition;
           ignore_condition_information: ^pmt$condition_information;
           ignore_save_area: ^ost$stack_frame_save_area;
       VAR handler_status: ost$status);


      CASE condition.selector OF

      = pmc$system_conditions =
        IF (condition.system_conditions * $pmt$system_conditions
              [pmc$instruction_specification, pmc$address_specification, pmc$access_violation,
              pmc$invalid_segment_ring_0, pmc$divide_fault, pmc$arithmetic_overflow, pmc$exponent_overflow,
              pmc$exponent_underflow, pmc$fp_significance_loss, pmc$fp_indefinite,
              pmc$arithmetic_significance, pmc$invalid_bdp_data]) <> $pmt$system_conditions [] THEN
          bad_data_value;
        IFEND;

      = pmc$user_defined_condition =
        IF condition.user_condition_name = cye$run_time_condition THEN
          bad_data_value;
        IFEND;

      = pmc$block_exit_processing =
*IFEND

*IF $true(osv$unix)
        IF local_work_area <> NIL THEN
          FREE local_work_area;
        IFEND;
*ELSE
        IF local_work_area.sequence_pointer <> NIL THEN
          mmp$delete_scratch_segment (local_work_area, handler_status);

{ ignore the delete segment status

          handler_status.normal := TRUE;
          local_work_area.sequence_pointer := NIL;
        IFEND;
*IFEND
        RETURN;

*IF NOT $true(osv$unix)
      ELSE
        ;
      CASEND;

      pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);
*IFEND

    PROCEND abort_handler;
?? TITLE := 'bad_data_value', EJECT ??

    PROCEDURE bad_data_value;


      osp$set_status_abnormal ('CL', cle$bad_data_value, '', status);
      EXIT clp$internal_convert_to_string;

    PROCEND bad_data_value;
?? TITLE := 'break_string', EJECT ??

    PROCEDURE break_string;

      VAR
        extra_chars: ^clt$string_value,
        i: clt$string_index,
        mark_continuation: boolean,
        put_enabled: boolean,
        save_indent_amount: clt$string_size;


      save_indent_amount := indent_amount;
      mark_continuation := representation_option = clc$data_source_representation;

      IF break.index = 0 THEN
        break := secondary_break;
      IFEND;

      IF break.index = 0 THEN
        PUSH extra_chars: [continuation_size];
        extra_chars^ (1, continuation_size) := string_ptr^ (string_size^ -continuation_size + 1,
              continuation_size);
        string_size^ := string_size^ -continuation_size;
        mark_continuation := TRUE;

      ELSEIF break.index < string_size^ THEN
        secondary_break.index := break.index;
        WHILE (secondary_break.index > 0) AND (string_ptr^ (secondary_break.index) = '.') DO
          secondary_break.index := secondary_break.index - 1;
        WHILEND;
        IF secondary_break.index > 0 THEN
          break.index := secondary_break.index;
        IFEND;

        PUSH extra_chars: [string_size^ -break.index];
        extra_chars^ := string_ptr^ (break.index + 1, STRLENGTH (extra_chars^));
        string_size^ := break.index;

        mark_continuation := break.mark_continuation;
        indent_amount := break.indent;

      ELSE
        PUSH extra_chars: [0];
      IFEND;

      IF mark_continuation THEN
        string_ptr^ (string_size^ +1, continuation_size) := continuation;
        string_size^ := string_size^ +continuation_size;
      IFEND;

      finish_string;
      start_string;

      put_enabled := FALSE;
      FOR i := 1 TO STRLENGTH (extra_chars^) DO
        IF extra_chars^ (i) <> ' ' THEN
          put_enabled := TRUE;
        IFEND;
        IF put_enabled THEN
          put_string (extra_chars^ (i));
        IFEND;
      FOREND;

      indent_amount := save_indent_amount;

    PROCEND break_string;
?? TITLE := 'convert_value_to_string', EJECT ??

    PROCEDURE convert_value_to_string
      (    value: ^clt$data_value);

      VAR
        indent_at_start_of_structure: clt$string_size;

?? NEWTITLE := 'convert_application_to_string', EJECT ??

      PROCEDURE convert_application_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$application);
        IFEND;

        put_trimmed_string (value^.application_value^);

      PROCEND convert_application_to_string;
?? TITLE := 'convert_array_to_string', EJECT ??

      PROCEDURE convert_array_to_string;

?? NEWTITLE := 'put_array_compressed_labels', EJECT ??

        PROCEDURE put_array_compressed_labels;

          VAR
            complex_elements: boolean,
            index: clt$array_bound,
            previous_indent_amount: clt$string_size,
            str: ost$string;


          level_of_nesting := level_of_nesting + 1;
          previous_indent_amount := indent_amount;
          complex_elements := FALSE;

        /check_complexity/
          FOR index := LOWERBOUND (value^.array_value^) TO UPPERBOUND (value^.array_value^) DO
            IF (value^.array_value^ [index] <> NIL) AND (value^.array_value^ [index]^.kind IN
                  labeled_structures) THEN
              complex_elements := TRUE;
              EXIT /check_complexity/;
            IFEND;
          FOREND /check_complexity/;

          IF complex_elements THEN
            start_string;
            FOR index := LOWERBOUND (value^.array_value^) TO UPPERBOUND (value^.array_value^) DO
              put_integer (index);
              put_string (': ');
              increment_indent (nesting_indentation);
              convert_value_to_string (value^.array_value^ [index]);
              finish_string;
              indent_amount := previous_indent_amount;
            FOREND;

          ELSE
            IF NOT string_started THEN
              start_string;
            IFEND;
            increment_indent (nesting_indentation);
            put_array_source;
            finish_string;
            indent_amount := previous_indent_amount;
          IFEND;

          level_of_nesting := level_of_nesting - 1;

        PROCEND put_array_compressed_labels;
?? OLDTITLE ??
?? NEWTITLE := 'put_array_elements', EJECT ??

        PROCEDURE put_array_elements;

          VAR
            index: clt$array_bound;


          FOR index := LOWERBOUND (value^.array_value^) TO UPPERBOUND (value^.array_value^) DO
            convert_value_to_string (value^.array_value^ [index]);
            finish_string;
          FOREND;

        PROCEND put_array_elements;
?? TITLE := 'put_array_labeled_elements', EJECT ??

        PROCEDURE put_array_labeled_elements;

          VAR
            index: clt$field_number,
            previous_indent_amount: clt$string_size,
            str: ost$string;


          IF level_of_nesting > 0 THEN
            increment_indent (nesting_indentation);
          IFEND;

          level_of_nesting := level_of_nesting + 1;
          previous_indent_amount := indent_amount;
          IF first_pass THEN
            FOR index := LOWERBOUND (value^.array_value^) TO UPPERBOUND (value^.array_value^) DO
              clp$convert_integer_to_string (index, 10, FALSE, str, status);
              IF NOT status.normal THEN
                EXIT clp$internal_convert_to_string;
              IFEND;
              increment_colon_indent (str.size + 1);
              IF (value^.array_value^ [index] <> NIL) AND (value^.array_value^ [index]^.kind IN
                    labeled_structures) THEN
                convert_value_to_string (value^.array_value^ [index]);
                indent_amount := previous_indent_amount;
              IFEND;
            FOREND;
          ELSE
            start_string;
            FOR index := LOWERBOUND (value^.array_value^) TO UPPERBOUND (value^.array_value^) DO
              put_integer (index);
              IF (value^.array_value^ [index] = NIL) OR NOT (value^.array_value^ [index]^.kind IN
                    labeled_structures) THEN
                put_blanks_and_colon;
                set_indent_amount;
              IFEND;
              convert_value_to_string (value^.array_value^ [index]);
              finish_string;
              indent_amount := previous_indent_amount;
            FOREND;
          IFEND;

          level_of_nesting := level_of_nesting - 1;

        PROCEND put_array_labeled_elements;
?? TITLE := 'put_array_source', EJECT ??

        PROCEDURE put_array_source;

          VAR
            index: clt$array_bound;


          put_string ('(');
          FOR index := LOWERBOUND (value^.array_value^) TO UPPERBOUND (value^.array_value^) DO
            convert_value_to_string (value^.array_value^ [index]);
            IF index <> UPPERBOUND (value^.array_value^) THEN
              put_string (', ');
              set_break_position;
            IFEND;
          FOREND;
          put_string (')');

        PROCEND put_array_source;
?? TITLE := 'put_array_structure', EJECT ??

        PROCEDURE put_array_structure;

          VAR
            index: clt$array_bound,
            previous_indent_amount: clt$string_size;


          start_structure;

          previous_indent_amount := indent_amount;
          FOR index := LOWERBOUND (value^.array_value^) TO UPPERBOUND (value^.array_value^) DO
            put_integer (index);
            put_string (': ');
            set_indent_amount;
            convert_value_to_string (value^.array_value^ [index]);
            finish_string;
            indent_amount := previous_indent_amount;
          FOREND;

          finish_structure;

        PROCEND put_array_structure;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$data_elem_representation =
          put_array_elements;
        = clc$data_source_representation =
          put_array_source;
        = clc$data_struct_representation =
          put_array_structure;
        = clc$labeled_elem_representation =
          put_array_labeled_elements;
        = clc$compressed_labeled_elem_rep =
          put_array_compressed_labels;
        CASEND;

      PROCEND convert_array_to_string;
?? TITLE := 'convert_boolean_to_string', EJECT ??

      PROCEDURE convert_boolean_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$boolean);
        IFEND;

        put_boolean (value^.boolean_value.value, value^.boolean_value.kind);

      PROCEND convert_boolean_to_string;
?? TITLE := 'convert_cobol_name_to_string', EJECT ??

      PROCEDURE convert_cobol_name_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$cobol_name);
        IFEND;

        put_string_translated (value^.cobol_name_value);

      PROCEND convert_cobol_name_to_string;
?? TITLE := 'convert_command_ref_to_string', EJECT ??

      PROCEDURE convert_command_ref_to_string;

?? NEWTITLE := 'put_command_ref_structure', EJECT ??

        PROCEDURE put_command_ref_structure;

          VAR
            previous_indent_amount: clt$string_size;


          start_structure;

          put_string ('NAME: ');
          put_type_identification (clc$name);
          put_trimmed_string (value^.command_reference_value^.name);
          finish_string;

          put_string ('FORM: ');
          put_type_identification (clc$keyword);
          CASE value^.command_reference_value^.form OF

          = clc$name_only_command_ref =
            put_string ('NAME_ONLY');

          = clc$skip_1st_entry_command_ref =
            put_string ('SKIP_FIRST_ENTRY');

          = clc$system_command_ref =
            put_string ('SYSTEM');

          = clc$utility_command_ref =
            put_string ('UTILITY');
            finish_string;
            put_string ('UTILITY: ');
            put_type_identification (clc$name);
            put_trimmed_string (value^.command_reference_value^.utility);

          = clc$module_or_file_command_ref =
            put_string ('MODULE_OR_FILE');
            finish_string;
            put_string ('LIBRARY_OR_CATALOG: ');
            put_type_identification (clc$file);
            previous_indent_amount := indent_amount;
            set_indent_amount;
            put_file_reference (value^.command_reference_value^.library_or_catalog);
            indent_amount := previous_indent_amount;

          = clc$file_cycle_command_ref =
            put_string ('FILE_CYCLE');
            finish_string;
            put_string ('LIBRARY_OR_CATALOG: ');
            put_type_identification (clc$file);
            previous_indent_amount := indent_amount;
            set_indent_amount;
            put_file_reference (value^.command_reference_value^.catalog);
            indent_amount := previous_indent_amount;
            finish_string;
            put_string ('CYCLE_NUMBER: ');
            put_type_identification (clc$integer);
            put_integer (value^.command_reference_value^.cycle_number);

          CASEND;
          finish_string;

          finish_structure;

        PROCEND put_command_ref_structure;
?? TITLE := 'put_command_ref_labeled_elems', EJECT ??

        PROCEDURE put_command_ref_labeled_elems;


          VAR
            lower_case_name: ost$name,
            utility: clt$utility_name;

          #TRANSLATE (osv$upper_to_lower, value^.command_reference_value^.name, lower_case_name);

          CASE value^.command_reference_value^.form OF

          = clc$name_only_command_ref =
            put_trimmed_string (lower_case_name);

          = clc$skip_1st_entry_command_ref =
            put_string ('/');
            put_trimmed_string (lower_case_name);

          = clc$system_command_ref =
            put_string ('$system.');
            put_trimmed_string (lower_case_name);

          = clc$utility_command_ref =
            #TRANSLATE (osv$upper_to_lower, value^.command_reference_value^.utility, utility);
            put_trimmed_string (utility);
            put_string ('.');
            put_trimmed_string (lower_case_name);

          = clc$module_or_file_command_ref =
            put_file_reference (value^.command_reference_value^.library_or_catalog);
            put_string ('.');
            put_trimmed_string (lower_case_name);

          = clc$file_cycle_command_ref =
            put_file_reference (value^.command_reference_value^.catalog);
            put_string ('.');
            put_trimmed_string (lower_case_name);
            put_string ('.');
            put_integer (value^.command_reference_value^.cycle_number);

          CASEND;

        PROCEND put_command_ref_labeled_elems;
?? TITLE := 'put_command_ref_value', EJECT ??

        PROCEDURE put_command_ref_value;


          CASE value^.command_reference_value^.form OF

          = clc$name_only_command_ref =
            put_trimmed_string (value^.command_reference_value^.name);

          = clc$skip_1st_entry_command_ref =
            put_string ('/');
            put_trimmed_string (value^.command_reference_value^.name);

          = clc$system_command_ref =
            put_string ('$SYSTEM.');
            put_trimmed_string (value^.command_reference_value^.name);

          = clc$utility_command_ref =
            put_trimmed_string (value^.command_reference_value^.utility);
            put_string ('.');
            put_trimmed_string (value^.command_reference_value^.name);

          = clc$module_or_file_command_ref =
            put_file_reference (value^.command_reference_value^.library_or_catalog);
            put_string ('.');
            put_trimmed_string (value^.command_reference_value^.name);

          = clc$file_cycle_command_ref =
            put_file_reference (value^.command_reference_value^.catalog);
            put_string ('.');
            put_trimmed_string (value^.command_reference_value^.name);
            put_string ('.');
            put_integer (value^.command_reference_value^.cycle_number);

          CASEND;

        PROCEND put_command_ref_value;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$compressed_labeled_elem_rep, clc$data_elem_representation, clc$data_source_representation =
          put_command_ref_value;
        = clc$labeled_elem_representation =
          put_command_ref_labeled_elems;
        = clc$data_struct_representation =
          put_command_ref_structure;
        CASEND;

      PROCEND convert_command_ref_to_string;
?? TITLE := 'convert_data_name_to_string', EJECT ??

      PROCEDURE convert_data_name_to_string;

        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$data_name);
        IFEND;

        put_string_translated (value^.data_name_value);

      PROCEND convert_data_name_to_string;
?? TITLE := 'convert_date_time_to_string', EJECT ??

      PROCEDURE convert_date_time_to_string;

?? NEWTITLE := 'put_date_time_element', EJECT ??

        PROCEDURE put_date_time_element;

          VAR
            str: ost$string;


          clp$convert_date_time_to_string (value^.date_time_value, '', str, status);
          IF NOT status.normal THEN
            EXIT clp$internal_convert_to_string;
          IFEND;

          put_string (str.value (1, str.size));

        PROCEND put_date_time_element;
?? TITLE := 'put_date_time_source', EJECT ??

        PROCEDURE put_date_time_source;

          CONST
            default_format_string_size = 11,
            default_date_format_size = 8,
            default_time_format_index = 10,
            default_time_format_size = 2;

          VAR
*IF NOT $true(osv$unix)
            default_format_string: [STATIC, READ, oss$job_paged_literal] string
*ELSE
            default_format_string: [STATIC, READ] string
*IFEND
                  (default_format_string_size) := 'Y4-M2-D2.MS',
            format_string: ^clt$date_time_form_string,
            str: ost$string;


          IF value^.date_time_value.date_specified THEN
            IF value^.date_time_value.time_specified THEN
              format_string := ^default_format_string;
            ELSE
              format_string := ^default_format_string (1, default_date_format_size);
            IFEND;
          ELSE
            format_string := ^default_format_string (default_time_format_index, default_time_format_size);
          IFEND;

          clp$convert_date_time_to_string (value^.date_time_value, format_string^, str, status);
          IF NOT status.normal THEN
            EXIT clp$internal_convert_to_string;
          IFEND;

          put_string (str.value (1, str.size));

        PROCEND put_date_time_source;
?? TITLE := 'put_date_time_structure', EJECT ??

        PROCEDURE put_date_time_structure;


          start_structure;

          IF value^.date_time_value.date_specified THEN
            put_string ('YEAR: ');
            put_type_identification (clc$integer);
            put_integer (value^.date_time_value.value.year + 1900);
            finish_string;
            put_string ('MONTH: ');
            put_type_identification (clc$integer);
            put_integer (value^.date_time_value.value.month);
            finish_string;
            put_string ('DAY: ');
            put_type_identification (clc$integer);
            put_integer (value^.date_time_value.value.day);
            finish_string;
          IFEND;

          IF value^.date_time_value.time_specified THEN
            put_string ('HOUR: ');
            put_type_identification (clc$integer);
            put_integer (value^.date_time_value.value.hour);
            finish_string;
            put_string ('MINUTE: ');
            put_type_identification (clc$integer);
            put_integer (value^.date_time_value.value.minute);
            finish_string;
            put_string ('SECOND: ');
            put_type_identification (clc$integer);
            put_integer (value^.date_time_value.value.second);
            finish_string;
            put_string ('MILLISECOND: ');
            put_type_identification (clc$integer);
            put_integer (value^.date_time_value.value.millisecond);
            finish_string;
          IFEND;

          finish_structure;

        PROCEND put_date_time_structure;
?? OLDTITLE, EJECT ??

        IF (NOT value^.date_time_value.date_specified) AND (NOT value^.date_time_value.time_specified) THEN
          bad_data_value;
        IFEND;

        CASE representation_option OF
        = clc$compressed_labeled_elem_rep, clc$data_elem_representation, clc$labeled_elem_representation =
          put_date_time_element;
        = clc$data_source_representation =
          put_date_time_source;
        = clc$data_struct_representation =
          put_date_time_structure;
        CASEND;

      PROCEND convert_date_time_to_string;
?? TITLE := 'convert_deferred_val_to_string', EJECT ??

      PROCEDURE convert_deferred_val_to_string;

        VAR
          previous_representation_option: clt$data_representation_option,
          result: ^clt$data_value,
          saved_local_work_area: ^clt$work_area;


        IF representation_option = clc$data_elem_representation THEN
          set_up_local_work_area;
*IF NOT $true(osv$unix)
          saved_local_work_area := local_work_area.sequence_pointer;
*ELSE
          saved_local_work_area := local_work_area;
*IFEND

          clp$evaluate_expression (value^.deferred_value^, value^.deferred_type,
*IF NOT $true(osv$unix)
                local_work_area.sequence_pointer, result, status);
*ELSE
                local_work_area, result, status);
*IFEND
          IF NOT status.normal THEN
            EXIT clp$internal_convert_to_string;
          IFEND;

          convert_value_to_string (result);

*IF NOT $true(osv$unix)
          local_work_area.sequence_pointer := saved_local_work_area;
*ELSE
          local_work_area := saved_local_work_area;
*IFEND

        ELSE
          IF representation_option = clc$data_struct_representation THEN
            put_string_translated ('"DEFER" ');
          IFEND;

          previous_representation_option := representation_option;
          representation_option := clc$data_source_representation;

          put_string (value^.deferred_value^);

          representation_option := previous_representation_option;
        IFEND;

      PROCEND convert_deferred_val_to_string;
*IF NOT $true(osv$unix)
?? TITLE := 'convert_entry_point_ref_to_str', EJECT ??

      PROCEDURE convert_entry_point_ref_to_str;

?? NEWTITLE := 'put_entry_point', EJECT ??

        PROCEDURE put_entry_point;


          IF value^.entry_point_reference_value^.entry_point = osc$null_name THEN
            put_string ('none');
          ELSE
            put_program_name (value^.entry_point_reference_value^.entry_point, FALSE,
                  clc$data_source_representation);
          IFEND;

        PROCEND put_entry_point;
?? TITLE := 'put_entry_point_labeled_elems', EJECT ??

        PROCEDURE put_entry_point_labeled_elems;

          VAR
            previous_indent_amount: clt$string_size;


          IF level_of_nesting > 0 THEN
            increment_indent (nesting_indentation);
          IFEND;

          IF first_pass THEN
            increment_colon_indent (STRLENGTH ('ENTRY_POINT '));
            IF value^.entry_point_reference_value^.object_library <> '' THEN
              increment_colon_indent (STRLENGTH ('OBJECT_LIBRARY '));
            IFEND;
          ELSE
            start_string;
            put_field_name_as_label ('ENTRY_POINT                    ');
            put_blanks_and_colon;
            put_entry_point;
            finish_string;
            IF value^.entry_point_reference_value^.object_library <> '' THEN
              put_field_name_as_label ('OBJECT_LIBRARY                 ');
              put_blanks_and_colon;
              previous_indent_amount := indent_amount;
              set_indent_amount;
              put_file_reference (value^.entry_point_reference_value^.object_library);
              indent_amount := previous_indent_amount;
              finish_string;
            IFEND;
          IFEND;

        PROCEND put_entry_point_labeled_elems;
?? TITLE := 'put_entry_point_structure', EJECT ??

        PROCEDURE put_entry_point_structure;

          VAR
            previous_indent_amount: clt$string_size;


          start_structure;

          put_string ('ENTRY_POINT: ');
          put_type_identification (clc$program_name);
          put_entry_point;
          finish_string;
          IF value^.entry_point_reference_value^.object_library <> '' THEN
            put_string ('OBJECT_LIBRARY: ');
            put_type_identification (clc$file);
            previous_indent_amount := indent_amount;
            set_indent_amount;
            put_file_reference (value^.entry_point_reference_value^.object_library);
            indent_amount := previous_indent_amount;
            finish_string;
          IFEND;

          finish_structure;

        PROCEND put_entry_point_structure;
?? TITLE := 'put_entry_point_value', EJECT ??

        PROCEDURE put_entry_point_value;


          IF value^.entry_point_reference_value^.object_library <> '' THEN
            put_trimmed_string (value^.entry_point_reference_value^.object_library);
            put_string ('.');
          IFEND;
          put_entry_point;

        PROCEND put_entry_point_value;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$compressed_labeled_elem_rep, clc$data_elem_representation, clc$data_source_representation =
          put_entry_point_value;
        = clc$data_struct_representation =
          put_entry_point_structure;
        = clc$labeled_elem_representation =
          put_entry_point_labeled_elems;
        CASEND;

      PROCEND convert_entry_point_ref_to_str;
*IFEND
?? TITLE := 'convert_file_to_string', EJECT ??

      PROCEDURE convert_file_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$file);
        IFEND;

        put_file_reference (value^.file_value^);

      PROCEND convert_file_to_string;
?? TITLE := 'convert_integer_to_string', EJECT ??

      PROCEDURE convert_integer_to_string;

        VAR
          str: ost$string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$integer);
        IFEND;

        clp$convert_integer_to_string (value^.integer_value.value, value^.integer_value.radix,
              value^.integer_value.radix_specified, str, status);
        IF NOT status.normal THEN
          EXIT clp$internal_convert_to_string;
        IFEND;
        put_string (str.value (1, str.size));

      PROCEND convert_integer_to_string;
?? TITLE := 'convert_keyword_to_string', EJECT ??

      PROCEDURE convert_keyword_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$keyword);
        IFEND;

        put_string_translated (value^.keyword_value);

      PROCEND convert_keyword_to_string;
?? TITLE := 'convert_list_to_string', EJECT ??

      PROCEDURE convert_list_to_string;

?? NEWTITLE := 'put_list_compressed_labels', EJECT ??

        PROCEDURE put_list_compressed_labels;

          VAR
            node: ^clt$data_value,
            node_number: clt$list_size,
            previous_indent_amount: clt$string_size,
            str: ost$string;


          IF (value^.link = NIL) AND (value^.element_value = NIL) THEN
            IF NOT string_started THEN
              start_string;
            IFEND;
            put_blanks_and_colon;
            put_string ('"empty list"');
            finish_string;
            RETURN;
          IFEND;


          level_of_nesting := level_of_nesting + 1;
          node := value;
          node_number := 0;
          previous_indent_amount := indent_amount;
          WHILE (node <> NIL) AND NOT (node^.element_value^.kind IN labeled_structures) DO
            node := node^.link;
          WHILEND;
          IF node = NIL THEN
            IF NOT string_started THEN
              start_string;
            IFEND;
            increment_indent (nesting_indentation);
            put_list_source;
            finish_string;
            indent_amount := previous_indent_amount;
          ELSE
            start_string;
            node := value;
            WHILE node <> NIL DO
              node_number := node_number + 1;
              put_integer (node_number);
              put_string (': ');
              increment_indent (nesting_indentation);
              convert_value_to_string (node^.element_value);
              finish_string;
              node := node^.link;
              indent_amount := previous_indent_amount;
            WHILEND;
          IFEND;

          level_of_nesting := level_of_nesting - 1;

        PROCEND put_list_compressed_labels;
?? OLDTITLE ??
?? NEWTITLE := 'put_list_elements', EJECT ??

        PROCEDURE put_list_elements;

          VAR
            node: ^clt$data_value;


          IF (value^.link = NIL) AND (value^.element_value = NIL) THEN
            put_string_translated ('"EMPTY LIST"');
            finish_string;
            RETURN;
          IFEND;

          node := value;
          WHILE node <> NIL DO
            convert_value_to_string (node^.element_value);
            finish_string;
            node := node^.link;
          WHILEND;

        PROCEND put_list_elements;
?? TITLE := 'put_list_labeled_elements', EJECT ??

        PROCEDURE put_list_labeled_elements;

          VAR
            node: ^clt$data_value,
            node_number: clt$list_size,
            previous_indent_amount: clt$string_size,
            str: ost$string;


          IF (value^.link = NIL) AND (value^.element_value = NIL) THEN
            IF NOT first_pass THEN
              IF NOT string_started THEN
                start_string;
              IFEND;
              put_blanks_and_colon;
              put_string ('"empty list"');
              finish_string;
            IFEND;
            RETURN;
          IFEND;

          IF level_of_nesting > 0 THEN
            increment_indent (nesting_indentation);
          IFEND;

          level_of_nesting := level_of_nesting + 1;
          node := value;
          node_number := 0;
          previous_indent_amount := indent_amount;
          IF first_pass THEN
            WHILE node <> NIL DO
              node_number := node_number + 1;
              IF node^.element_value^.kind IN labeled_structures THEN
                clp$convert_integer_to_string (node_number, 10, FALSE, str, status);
                IF NOT status.normal THEN
                  EXIT clp$internal_convert_to_string;
                IFEND;
                increment_colon_indent (str.size + 1);
                convert_value_to_string (node^.element_value);
                indent_amount := previous_indent_amount;
              IFEND;
              node := node^.link;
            WHILEND;
          ELSE
            WHILE (node <> NIL) AND NOT (node^.element_value^.kind IN labeled_structures) DO
              node := node^.link;
            WHILEND;
            IF node = NIL THEN
              IF NOT string_started THEN
                start_string;
              IFEND;
              put_blanks_and_colon;
              set_indent_amount;
              put_list_source;
              finish_string;
            ELSE
              start_string;
              node := value;
              WHILE node <> NIL DO
                node_number := node_number + 1;
                put_integer (node_number);
                IF NOT (node^.element_value^.kind IN labeled_structures) THEN
                  put_blanks_and_colon;
                IFEND;
                convert_value_to_string (node^.element_value);
                finish_string;
                indent_amount := previous_indent_amount;
                node := node^.link;
              WHILEND;
            IFEND;
          IFEND;

          level_of_nesting := level_of_nesting - 1;

        PROCEND put_list_labeled_elements;
?? TITLE := 'put_list_source', EJECT ??

        PROCEDURE put_list_source;

          VAR
            node: ^clt$data_value,
            parentheses_needed: boolean;


          node := value;

        /determine_parentheses_needed/
          WHILE TRUE DO
            IF node = NIL THEN
              parentheses_needed := TRUE;
              EXIT /determine_parentheses_needed/;
            ELSEIF node^.generated_via_list_rest THEN
              parentheses_needed := FALSE;
              EXIT /determine_parentheses_needed/;
            ELSEIF (node^.link <> NIL) OR (node^.element_value = NIL) THEN
              parentheses_needed := TRUE;
              EXIT /determine_parentheses_needed/;
            ELSE
              CASE node^.element_value^.kind OF
              = clc$list =
                node := node^.element_value;
              = clc$array, clc$deferred, clc$record =
                parentheses_needed := TRUE;
                EXIT /determine_parentheses_needed/;
              ELSE
                parentheses_needed := FALSE;
                EXIT /determine_parentheses_needed/;
              CASEND;
            IFEND;
          WHILEND /determine_parentheses_needed/;

          IF parentheses_needed THEN
            put_string ('(');
          IFEND;

          IF (value^.link <> NIL) OR (value^.element_value <> NIL) THEN
            node := value;
            WHILE node <> NIL DO
              convert_value_to_string (node^.element_value);
              IF node^.link <> NIL THEN
                put_string (', ');
                set_break_position;
              IFEND;
              node := node^.link;
            WHILEND;
          ELSEIF NOT parentheses_needed THEN
            put_string_translated ('"EMPTY LIST"');
          IFEND;

          IF parentheses_needed THEN
            put_string (')');
          IFEND;

        PROCEND put_list_source;
?? TITLE := 'put_list_structure', EJECT ??

        PROCEDURE put_list_structure;

          VAR
            node: ^clt$data_value,
            node_number: clt$list_size,
            previous_indent_amount: clt$string_size;


          IF (value^.link = NIL) AND (value^.element_value = NIL) THEN
            put_string ('"EMPTY LIST"');
            finish_string;
            RETURN;
          IFEND;

          start_structure;

          node := value;
          node_number := 0;
          previous_indent_amount := indent_amount;
          WHILE node <> NIL DO
            node_number := node_number + 1;
            put_integer (node_number);
            put_string (': ');
            set_indent_amount;
            convert_value_to_string (node^.element_value);
            finish_string;
            indent_amount := previous_indent_amount;
            node := node^.link;
          WHILEND;

          finish_structure;

        PROCEND put_list_structure;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$data_elem_representation =
          put_list_elements;
        = clc$data_source_representation =
          put_list_source;
        = clc$data_struct_representation =
          put_list_structure;
        = clc$labeled_elem_representation =
          put_list_labeled_elements;
        = clc$compressed_labeled_elem_rep =
          put_list_compressed_labels;
        CASEND;

      PROCEND convert_list_to_string;
?? TITLE := 'convert_lock_to_string', EJECT ??

      PROCEDURE convert_lock_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$lock);
        IFEND;

        CASE value^.lock_value^.state OF
        = clc$lock_clear =
          put_string_translated ('"LOCK CLEAR"');
        = clc$lock_set =
          put_string_translated ('"LOCK SET"');
        = clc$lock_expired =
          put_string_translated ('"LOCK EXPIRED"');
        ELSE
          bad_data_value;
        CASEND;

      PROCEND convert_lock_to_string;
?? TITLE := 'convert_name_to_string', EJECT ??

      PROCEDURE convert_name_to_string;

        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$name);
        IFEND;

        put_string_translated (value^.name_value);

      PROCEND convert_name_to_string;
?? TITLE := 'convert_network_title_to_string', EJECT ??

      PROCEDURE convert_network_title_to_string;

        VAR
          previous_indent_amount: clt$string_size;


        CASE representation_option OF
        = clc$compressed_labeled_elem_rep, clc$data_elem_representation, clc$labeled_elem_representation =
          put_trimmed_string (value^.network_title_value^);
        = clc$data_source_representation =
          put_source_string (value^.network_title_value^);
        = clc$data_struct_representation =
          put_type_identification (clc$network_title);
          previous_indent_amount := indent_amount;
          set_indent_amount;
          put_source_string (value^.network_title_value^);
          indent_amount := previous_indent_amount;
        CASEND;

      PROCEND convert_network_title_to_string;
?? TITLE := 'convert_program_name_to_string', EJECT ??

      PROCEDURE convert_program_name_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$program_name);
        IFEND;

        put_program_name (value^.program_name_value, TRUE, representation_option);

      PROCEND convert_program_name_to_string;
?? TITLE := 'convert_range_to_string', EJECT ??

      PROCEDURE convert_range_to_string;

?? NEWTITLE := 'put_range_elements', EJECT ??

        PROCEDURE put_range_elements;


          convert_value_to_string (value^.low_value);
          finish_string;
          convert_value_to_string (value^.high_value);
          finish_string;

        PROCEND put_range_elements;
?? TITLE := 'put_range_labeled_elements', EJECT ??

        PROCEDURE put_range_labeled_elements;

          VAR
            previous_indent_amount: clt$string_size;


          IF level_of_nesting > 0 THEN
            increment_indent (nesting_indentation);
          IFEND;

          level_of_nesting := level_of_nesting + 1;
          previous_indent_amount := indent_amount;
          IF first_pass THEN
            IF value^.high_value <> value^.low_value THEN
              increment_colon_indent (STRLENGTH ('HIGH '));
              IF value^.low_value^.kind IN labeled_structures THEN
                convert_value_to_string (value^.low_value);
                indent_amount := previous_indent_amount;
              IFEND;
            ELSE
              increment_colon_indent (STRLENGTH ('LOW, HIGH '));
            IFEND;
            IF value^.high_value^.kind IN labeled_structures THEN
              convert_value_to_string (value^.high_value);
              indent_amount := previous_indent_amount;
            IFEND;
          ELSE
            start_string;
            IF value^.high_value <> value^.low_value THEN
              put_field_name_as_label ('LOW                            ');
              IF NOT (value^.low_value^.kind IN labeled_structures) THEN
                put_blanks_and_colon;
                set_indent_amount;
              IFEND;
              convert_value_to_string (value^.low_value);
              finish_string;
              indent_amount := previous_indent_amount;
              put_field_name_as_label ('HIGH                           ');
            ELSE
              put_field_name_as_label ('LOW, HIGH                      ');
            IFEND;
            IF NOT (value^.high_value^.kind IN labeled_structures) THEN
              put_blanks_and_colon;
              set_indent_amount;
            IFEND;
            convert_value_to_string (value^.high_value);
            finish_string;
            indent_amount := previous_indent_amount;
          IFEND;

          level_of_nesting := level_of_nesting - 1;

        PROCEND put_range_labeled_elements;
?? TITLE := 'put_range_source', EJECT ??

        PROCEDURE put_range_source;


          convert_value_to_string (value^.low_value);
          IF value^.high_value <> value^.low_value THEN
            put_string ('..');
            convert_value_to_string (value^.high_value);
          IFEND;

        PROCEND put_range_source;
?? TITLE := 'put_range_structure', EJECT ??

        PROCEDURE put_range_structure;

          VAR
            previous_indent_amount: clt$string_size;


          start_structure;

          previous_indent_amount := indent_amount;
          IF value^.high_value <> value^.low_value THEN
            put_string ('LOW: ');
          ELSE
            put_string ('LOW, HIGH: ');
          IFEND;
          convert_value_to_string (value^.low_value);
          finish_string;
          indent_amount := previous_indent_amount;
          IF value^.high_value <> value^.low_value THEN
            put_string ('HIGH: ');
            convert_value_to_string (value^.high_value);
            finish_string;
            indent_amount := previous_indent_amount;
          IFEND;

          finish_structure;

        PROCEND put_range_structure;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$data_elem_representation =
          put_range_elements;
        = clc$compressed_labeled_elem_rep, clc$data_source_representation =
          put_range_source;
        = clc$data_struct_representation =
          put_range_structure;
        = clc$labeled_elem_representation =
          put_range_labeled_elements;
        CASEND;

      PROCEND convert_range_to_string;
*IF NOT $true(osv$unix)
?? TITLE := 'convert_real_to_string', EJECT ??

      PROCEDURE convert_real_to_string;

        VAR
          str: ost$string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$real);
        IFEND;

        clp$convert_real_to_string (value^.real_value.value, value^.real_value.number_of_digits, str, status);
        IF NOT status.normal THEN
          EXIT clp$internal_convert_to_string;
        IFEND;
        put_string (str.value (1, str.size));

      PROCEND convert_real_to_string;
*IFEND
?? TITLE := 'convert_record_to_string', EJECT ??

      PROCEDURE convert_record_to_string;

?? NEWTITLE := 'put_record_compressed_labels', EJECT ??

        PROCEDURE put_record_compressed_labels;

          VAR
            index: clt$field_number,
            initial_indent_amount: clt$string_size,
            record_indent_amount: clt$string_size;


          level_of_nesting := level_of_nesting + 1;
          IF NOT string_started THEN
            start_string;
          IFEND;
          initial_indent_amount := indent_amount;
          record_indent_amount := indent_amount;
          indent_amount := record_indent_amount;
          FOR index := 1 TO UPPERBOUND (value^.field_values^) DO
            IF (index > 1) AND string_started THEN
              IF (value^.field_values^ [index].value <> NIL) AND
                    (value^.field_values^ [index].value^.kind IN labeled_structures) THEN
                start_string;
              ELSE
                put_string (', ');
                set_break_position;
              IFEND;
            IFEND;
            put_field_name_as_label (value^.field_values^ [index].name);
            put_string (': ');
            increment_indent (nesting_indentation);
            convert_value_to_string (value^.field_values^ [index].value);
            indent_amount := record_indent_amount;
          FOREND;
          indent_amount := initial_indent_amount;
          finish_string;

          level_of_nesting := level_of_nesting - 1;

        PROCEND put_record_compressed_labels;
?? OLDTITLE ??
?? NEWTITLE := 'put_record_fields', EJECT ??

        PROCEDURE put_record_fields;

          VAR
            index: clt$field_number;


          FOR index := 1 TO UPPERBOUND (value^.field_values^) DO
            convert_value_to_string (value^.field_values^ [index].value);
            finish_string;
          FOREND;

        PROCEND put_record_fields;
?? TITLE := 'put_record_labeled_elements', EJECT ??

        PROCEDURE put_record_labeled_elements;

          VAR
            index: clt$field_number,
            previous_indent_amount: clt$string_size;


          IF level_of_nesting > 0 THEN
            increment_indent (nesting_indentation);
          IFEND;

          level_of_nesting := level_of_nesting + 1;
          previous_indent_amount := indent_amount;
          IF first_pass THEN
            FOR index := 1 TO UPPERBOUND (value^.field_values^) DO
              increment_colon_indent (clp$trimmed_string_size (value^.field_values^ [index].name) + 1);
              IF (value^.field_values^ [index].value <> NIL) AND
                    (value^.field_values^ [index].value^.kind IN labeled_structures) THEN
                convert_value_to_string (value^.field_values^ [index].value);
                indent_amount := previous_indent_amount;
              IFEND;
            FOREND;
          ELSE
            start_string;
            FOR index := 1 TO UPPERBOUND (value^.field_values^) DO
              put_field_name_as_label (value^.field_values^ [index].name);
              IF (value^.field_values^ [index].value = NIL) OR NOT (value^.field_values^ [index].
                    value^.kind IN labeled_structures) THEN
                put_blanks_and_colon;
                set_indent_amount;
              IFEND;
              convert_value_to_string (value^.field_values^ [index].value);
              finish_string;
              indent_amount := previous_indent_amount;
            FOREND;
          IFEND;

          level_of_nesting := level_of_nesting - 1;

        PROCEND put_record_labeled_elements;

?? TITLE := 'put_record_source', EJECT ??

        PROCEDURE put_record_source;

          VAR
            index: clt$field_number,
            last_index: clt$field_number;


          last_index := UPPERBOUND (value^.field_values^);
          WHILE (last_index > 1) AND (value^.field_values^ [last_index].value = NIL) DO
            last_index := last_index - 1;
          WHILEND;

          put_string ('(');
          FOR index := 1 TO last_index DO
            convert_value_to_string (value^.field_values^ [index].value);
            IF index <> last_index THEN
              put_string (', ');
              set_break_position;
            IFEND;
          FOREND;
          put_string (')');

        PROCEND put_record_source;
?? TITLE := 'put_record_structure', EJECT ??

        PROCEDURE put_record_structure;

          VAR
            index: clt$field_number,
            previous_indent_amount: clt$string_size;


          start_structure;

          previous_indent_amount := indent_amount;
          FOR index := 1 TO UPPERBOUND (value^.field_values^) DO
            put_trimmed_string (value^.field_values^ [index].name);
            put_string (': ');
            set_indent_amount;
            convert_value_to_string (value^.field_values^ [index].value);
            finish_string;
            indent_amount := previous_indent_amount;
          FOREND;

          finish_structure;

        PROCEND put_record_structure;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$data_elem_representation =
          put_record_fields;
        = clc$data_source_representation =
          put_record_source;
        = clc$data_struct_representation =
          put_record_structure;
        = clc$labeled_elem_representation =
          put_record_labeled_elements;
        = clc$compressed_labeled_elem_rep =
          put_record_compressed_labels;
        CASEND;

      PROCEND convert_record_to_string;
?? TITLE := 'convert_scu_line_id_to_string', EJECT ??

      PROCEDURE convert_scu_line_id_to_string;

?? NEWTITLE := 'put_scu_line_id_labeled_elems', EJECT ??

        PROCEDURE put_scu_line_id_labeled_elems;


          VAR
            line_id_mod_name: clt$scu_modification_name;

          #TRANSLATE (osv$upper_to_lower, value^.scu_line_identifier_value.modification_name,
                line_id_mod_name);
          put_trimmed_string (line_id_mod_name);
          put_string ('.');
          put_integer (value^.scu_line_identifier_value.sequence_number);

        PROCEND put_scu_line_id_labeled_elems;
?? TITLE := 'put_scu_line_id_structure', EJECT ??

        PROCEDURE put_scu_line_id_structure;


          start_structure;

          put_string ('MODIFICATION_NAME: ');
          put_type_identification (clc$name);
          put_trimmed_string (value^.scu_line_identifier_value.modification_name);
          finish_string;
          put_string ('SEQUENCE_NUMBER: ');
          put_type_identification (clc$integer);
          put_integer (value^.scu_line_identifier_value.sequence_number);
          finish_string;

          finish_structure;

        PROCEND put_scu_line_id_structure;
?? TITLE := 'put_scu_line_id_value', EJECT ??

        PROCEDURE put_scu_line_id_value;


          put_trimmed_string (value^.scu_line_identifier_value.modification_name);
          put_string ('.');
          put_integer (value^.scu_line_identifier_value.sequence_number);

        PROCEND put_scu_line_id_value;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$compressed_labeled_elem_rep, clc$data_elem_representation, clc$data_source_representation =
          put_scu_line_id_value;
        = clc$labeled_elem_representation =
          put_scu_line_id_labeled_elems;
        = clc$data_struct_representation =
          put_scu_line_id_structure;
        CASEND;

      PROCEND convert_scu_line_id_to_string;
?? TITLE := 'convert_statistic_code_to_str', EJECT ??

      PROCEDURE convert_statistic_code_to_str;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$statistic_code);
        IFEND;

        put_status_code (FALSE, value^.statistic_code_value);

      PROCEND convert_statistic_code_to_str;
?? TITLE := 'convert_status_to_string', EJECT ??

      PROCEDURE convert_status_to_string;

?? NEWTITLE := 'put_status_message', EJECT ??

        PROCEDURE put_status_message;

          VAR
            i: ost$status_message_line_count,
            message: ost$status_message,
            message_area: ^ost$status_message,
            message_line_count: ^ost$status_message_line_count,
            message_line_size: ^ost$status_message_line_size,
            message_line: ^string ( * );


          osp$format_message (value^.status_value^, osc$current_message_level, osc$max_string_size, message,
                status);
          IF NOT status.normal THEN
            EXIT clp$internal_convert_to_string;
          IFEND;
          message_area := ^message;
          RESET message_area;
          NEXT message_line_count IN message_area;
          IF message_line_count^ = 0 THEN
            put_string_translated ('NORMAL STATUS');
          ELSE
            FOR i := 1 TO message_line_count^ DO
              NEXT message_line_size IN message_area;
              NEXT message_line: [message_line_size^] IN message_area;
              put_string (message_line^ (2, * ));
              finish_string;
            FOREND;
          IFEND;

        PROCEND put_status_message;
?? TITLE := 'put_status_source', EJECT ??

        PROCEDURE put_status_source;

          VAR
            identifier: ost$status_identifier,
            parameter_delimiter: char,
            parameter_index: ost$string_index,
            str: ost$string,
            text_index: ost$string_index;


          IF value^.status_value^.normal THEN
            put_string_translated ('$STATUS(TRUE)');
            RETURN;
          IFEND;

          put_string_translated ('$STATUS(FALSE');
          put_string (', ');
          set_break_position;

          osp$unpack_status_identifier (value^.status_value^.condition, identifier);
          put_source_string (identifier);
          put_string (', ');
          set_break_position;

          put_status_code (TRUE, value^.status_value^.condition);

          IF value^.status_value^.text.size > 0 THEN
            put_string (', ');
            set_break_position;

            parameter_delimiter := value^.status_value^.text.value (1);
            IF parameter_delimiter <> osc$status_parameter_delimiter THEN
              put_source_string (value^.status_value^.text.value (1, value^.status_value^.text.size));
            ELSE
              parameter_index := 2;
              FOR text_index := 2 TO value^.status_value^.text.size DO
                IF value^.status_value^.text.value (text_index) = parameter_delimiter THEN
                  put_source_string (value^.status_value^.text.value
                        (parameter_index, text_index - parameter_index));
                  parameter_index := text_index + 1;
                  put_string (', ');
                  set_break_position;
                IFEND;
              FOREND;
              put_source_string (value^.status_value^.text.value
                    (parameter_index, value^.status_value^.text.size + 1 - parameter_index));
            IFEND;
          IFEND;

          put_string (')');

        PROCEND put_status_source;
?? TITLE := 'put_status_structure', EJECT ??

        PROCEDURE put_status_structure;

          VAR
            name: ost$status_condition_name,
            previous_indent_amount: clt$string_size;


          start_structure;

          put_string ('NORMAL: ');
          put_type_identification (clc$boolean);
          IF value^.status_value^.normal THEN
            put_string ('TRUE');
          ELSE
            put_string ('FALSE');
            finish_string;

            put_string ('CONDITION: ');
            put_type_identification (clc$status_code);
            put_status_code (TRUE, value^.status_value^.condition);
            finish_string;

            previous_indent_amount := indent_amount;
            put_string ('TEXT: ');
            put_type_identification (clc$string);
            set_indent_amount;
            put_source_string (value^.status_value^.text.value (1, value^.status_value^.text.size));
            indent_amount := previous_indent_amount;
          IFEND;
          finish_string;

          finish_structure;

        PROCEND put_status_structure;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$data_elem_representation =
          put_status_message;
        = clc$compressed_labeled_elem_rep, clc$data_source_representation, clc$labeled_elem_representation =
          put_status_source;
        = clc$data_struct_representation =
          put_status_structure;
        CASEND;

      PROCEND convert_status_to_string;
?? TITLE := 'convert_status_code_to_string', EJECT ??

      PROCEDURE convert_status_code_to_string;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$status_code);
        IFEND;

        put_status_code (TRUE, value^.status_code_value);

      PROCEND convert_status_code_to_string;
?? TITLE := 'convert_string_value_to_string', EJECT ??

      PROCEDURE convert_string_value_to_string;

        VAR
          previous_indent_amount: clt$string_size;


        CASE representation_option OF
        = clc$data_elem_representation =
          put_string (value^.string_value^);
          string_may_be_trimmed := FALSE;
        = clc$compressed_labeled_elem_rep, clc$data_source_representation, clc$labeled_elem_representation =
          put_source_string (value^.string_value^);
        = clc$data_struct_representation =
          put_type_identification (clc$string);
          previous_indent_amount := indent_amount;
          set_indent_amount;
          put_source_string (value^.string_value^);
          indent_amount := previous_indent_amount;
        CASEND;

      PROCEND convert_string_value_to_string;
?? TITLE := 'convert_string_pat_to_string', EJECT ??

      PROCEDURE convert_string_pat_to_string;

        VAR
          previous_representation_option: clt$data_representation_option,
          saved_local_work_area: ^clt$work_area,
          str: ^clt$string_value;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$string_pattern);
        IFEND;

        set_up_local_work_area;
*IF NOT $true(osv$unix)
        saved_local_work_area := local_work_area.sequence_pointer;
*ELSE
        saved_local_work_area := local_work_area;
*IFEND

*IF NOT $true(osv$unix)
        clp$sp_convert_to_string (value^.string_pattern_value, local_work_area.sequence_pointer, str, status);
*ELSE
        clp$sp_convert_to_string (value^.string_pattern_value, local_work_area, str, status);
*IFEND
        IF NOT status.normal THEN
          IF status.condition <> cle$bad_string_pattern THEN
            EXIT clp$internal_convert_to_string;
          IFEND;
          status.normal := TRUE;
          put_string_translated ('BAD STRING_PATTERN VALUE.');
          RETURN;
        IFEND;

        previous_representation_option := representation_option;
        representation_option := clc$data_source_representation;

        put_string (str^);

        representation_option := previous_representation_option;

*IF NOT $true(osv$unix)
        local_work_area.sequence_pointer := saved_local_work_area;
*ELSE
        local_work_area := saved_local_work_area;
*IFEND

      PROCEND convert_string_pat_to_string;
?? TITLE := 'convert_time_incr_to_string', EJECT ??

      PROCEDURE convert_time_incr_to_string;

?? NEWTITLE := 'put_time_incr_element', EJECT ??

        PROCEDURE put_time_incr_element
          (    element: integer);


          IF element < 0 THEN
            put_string ('(');
          IFEND;

          put_integer (element);

          IF element < 0 THEN
            put_string (')');
          IFEND;

        PROCEND put_time_incr_element;
?? TITLE := 'put_time_incr_structure', EJECT ??

        PROCEDURE put_time_incr_structure;


          start_structure;

          put_string ('YEARS: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_increment_value^.year);
          finish_string;
          put_string ('MONTHS: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_increment_value^.month);
          finish_string;
          put_string ('DAYS: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_increment_value^.day);
          finish_string;

          put_string ('HOURS: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_increment_value^.hour);
          finish_string;
          put_string ('MINUTES: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_increment_value^.minute);
          finish_string;
          put_string ('SECONDS: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_increment_value^.second);
          finish_string;
          put_string ('MILLISECONDS: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_increment_value^.millisecond);
          finish_string;

          finish_structure;

        PROCEND put_time_incr_structure;
?? TITLE := 'put_time_incr_value', EJECT ??

        PROCEDURE put_time_incr_value;


          put_time_incr_element (value^.time_increment_value^.year);
          put_string ('-');
          put_time_incr_element (value^.time_increment_value^.month);
          put_string ('-');
          put_time_incr_element (value^.time_increment_value^.day);

          put_string ('.');

          put_time_incr_element (value^.time_increment_value^.hour);
          put_string (':');
          put_time_incr_element (value^.time_increment_value^.minute);
          put_string (':');
          put_time_incr_element (value^.time_increment_value^.second);
          put_string ('.');
          put_time_incr_element (value^.time_increment_value^.millisecond);

        PROCEND put_time_incr_value;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$compressed_labeled_elem_rep, clc$data_elem_representation, clc$data_source_representation,
              clc$labeled_elem_representation =
          put_time_incr_value;
        = clc$data_struct_representation =
          put_time_incr_structure;
        CASEND;

      PROCEND convert_time_incr_to_string;
?? TITLE := 'convert_time_zone_to_string', EJECT ??

      PROCEDURE convert_time_zone_to_string;

?? NEWTITLE := 'put_time_zone_structure', EJECT ??

        PROCEDURE put_time_zone_structure;


          start_structure;

          put_string ('HOURS_FROM_GMT: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_zone_value.hours_from_gmt);
          finish_string;
          put_string ('MINUTES_OFFSET: ');
          put_type_identification (clc$integer);
          put_integer (value^.time_zone_value.minutes_offset);
          finish_string;
          put_string ('DAYLIGHT_SAVING_TIME: ');
          put_type_identification (clc$boolean);
          put_boolean (value^.time_zone_value.daylight_saving_time, clc$true_false_boolean);
          finish_string;

          finish_structure;

        PROCEND put_time_zone_structure;
?? TITLE := 'put_time_zone_value', EJECT ??

        PROCEDURE put_time_zone_value;


          put_integer (value^.time_zone_value.hours_from_gmt);
          put_string (':');
          put_integer (value^.time_zone_value.minutes_offset);
          put_string ('.');
          IF value^.time_zone_value.daylight_saving_time THEN
            put_string_translated ('DAYLIGHT_SAVING_TIME');
          ELSE
            put_string_translated ('STANDARD_TIME');
          IFEND;

        PROCEND put_time_zone_value;
?? OLDTITLE, EJECT ??

        CASE representation_option OF
        = clc$compressed_labeled_elem_rep, clc$data_elem_representation, clc$data_source_representation,
              clc$labeled_elem_representation =
          put_time_zone_value;
        = clc$data_struct_representation =
          put_time_zone_structure;
        CASEND;

      PROCEND convert_time_zone_to_string;
?? TITLE := 'convert_type_spec_to_string', EJECT ??

      PROCEDURE convert_type_spec_to_string;

        VAR
          saved_local_work_area: ^clt$work_area,
          type_description: clt$type_description;


        IF representation_option = clc$data_struct_representation THEN
          put_type_identification (clc$type_specification);
        IFEND;

        set_up_local_work_area;
*IF NOT $true(osv$unix)
        saved_local_work_area := local_work_area.sequence_pointer;
*ELSE
        saved_local_work_area := local_work_area;
*IFEND

*IF NOT $true(osv$unix)
        clp$convert_type_spec_to_desc (value^.type_specification_value, local_work_area.sequence_pointer,
*ELSE
        clp$convert_type_spec_to_desc (value^.type_specification_value, local_work_area,
*IFEND
              type_description, status);
        IF NOT status.normal THEN
          EXIT clp$internal_convert_to_string;
        IFEND;

        put_type (FALSE, TRUE, multi_line_format, type_description);

*IF NOT $true(osv$unix)
        local_work_area.sequence_pointer := saved_local_work_area;
*ELSE
        local_work_area := saved_local_work_area;
*IFEND

      PROCEND convert_type_spec_to_string;
?? TITLE := 'finish_structure', EJECT ??

      PROCEDURE finish_structure;


        indent_amount := indent_at_start_of_structure;
        start_string;
        put_string ('"');
        put_type_name;
        put_string (' END"');
        finish_string;

      PROCEND finish_structure;
?? TITLE := 'increment_colon_indent', EJECT ??

      PROCEDURE increment_colon_indent
        (    increment: clt$string_size);

        IF indent_amount + increment > colon_indent THEN
          IF (indent_amount + increment) <= (max_string DIV 2) THEN
            colon_indent := indent_amount + increment;
          ELSE
            colon_indent := max_string DIV 2;
            IF colon_indent > increment THEN
              indent_amount := ((colon_indent - increment) DIV 2) * 2;
            ELSE
              indent_amount := initial_indentation;
            IFEND;
            IF indent_amount < label_indent_limit THEN
              label_indent_limit := indent_amount;
            IFEND;
          IFEND;
        IFEND;

      PROCEND increment_colon_indent;
?? TITLE := 'put_blanks_and_colon', EJECT ??

      PROCEDURE put_blanks_and_colon;


        IF colon_indent > string_size^ THEN
          string_ptr^ (string_size^ +1, colon_indent - string_size^) := ' ';
          string_size^ := colon_indent + 2;
          string_ptr^ (string_size^ -1, 2) := ': ';
        IFEND;

      PROCEND put_blanks_and_colon;
?? TITLE := 'put_boolean', EJECT ??

      VAR
*IF NOT $true(osv$unix)
        booleans: [STATIC, READ, oss$job_paged_literal] array [boolean] of array [clt$boolean_kinds] of
*ELSE
        booleans: [STATIC, READ] array [boolean] of array [clt$boolean_kinds] of
*IFEND
              string (5) := [['FALSE', 'NO', 'OFF'], ['TRUE', 'YES', 'ON']],
*IF NOT $true(osv$unix)
        lower_case_booleans: [STATIC, READ, oss$job_paged_literal] array [boolean] of
*ELSE
        lower_case_booleans: [STATIC, READ] array [boolean] of
*IFEND
              array [clt$boolean_kinds] of string (5) := [['false', 'no', 'off'], ['true', 'yes', 'on']];

?? SKIP := 3 ??

      PROCEDURE [INLINE] put_boolean
        (    boolean_value: boolean;
             boolean_kind: clt$boolean_kinds);


        IF (boolean_value < FALSE) OR (boolean_value > TRUE) OR
              (boolean_kind < LOWERVALUE (clt$boolean_kinds)) OR
              (boolean_kind > UPPERVALUE (clt$boolean_kinds)) THEN
          bad_data_value;
        IFEND;

        IF convert_to_lower_case THEN
          put_trimmed_string (lower_case_booleans [boolean_value] [boolean_kind]);
        ELSE
          put_trimmed_string (booleans [boolean_value] [boolean_kind]);
        IFEND;

      PROCEND put_boolean;
?? TITLE := 'put_field_name_as_label', EJECT ??

      PROCEDURE put_field_name_as_label
        (    field_name: ost$name);

        VAR
          i: 1 .. osc$max_name_size,
          label: string (osc$max_name_size),
          label_size: 0 .. osc$max_name_size,
          new_word: boolean;


        label_size := osc$max_name_size;
        new_word := TRUE;

      /make_label/
        FOR i := 1 TO osc$max_name_size DO
          IF field_name (i) = ' ' THEN
            IF field_name (i + 1, * ) = ' ' THEN
              label_size := i - 1;
              EXIT /make_label/;
            IFEND;
            label (i) := ' ';
            new_word := TRUE;
          ELSEIF field_name (i) = '_' THEN
            label (i) := '_';
            new_word := TRUE;
          ELSEIF new_word THEN
            label (i) := field_name (i);
            new_word := FALSE;
          ELSE
            label (i) := osv$upper_to_lower ($INTEGER (field_name (i)) + 1);
          IFEND;
        FOREND /make_label/;

        put_string (label (1, label_size));

      PROCEND put_field_name_as_label;
?? TITLE := 'put_program_name', EJECT ??

      PROCEDURE put_program_name
        (    program_name: pmt$program_name;
             check_for_cobol_name: boolean;
             representation_option: clt$data_representation_option);

        VAR
          ignore_is_only_cobol_name: boolean,
          is_cobol_name: boolean,
          is_scl_name: boolean,
          name_size: ost$name_size,
          translated_name: ost$name;


        name_size := clp$trimmed_string_size (program_name);
        #TRANSLATE (osv$lower_to_upper, program_name, translated_name);
        IF program_name = translated_name THEN

          clp$validate_name (program_name, translated_name, is_scl_name);
          IF is_scl_name THEN
            put_string (program_name (1, name_size));
            RETURN;
          IFEND;

          IF check_for_cobol_name THEN
            clp$recognize_cobol_name (program_name, name_size, ignore_is_only_cobol_name, is_cobol_name);
            IF is_cobol_name THEN
              put_string (program_name (1, name_size));
              RETURN;
            IFEND;
          IFEND;

        IFEND;

        IF representation_option = clc$data_elem_representation THEN
          put_string (program_name (1, name_size));
        ELSE
          put_source_string (program_name (1, name_size));
        IFEND;

      PROCEND put_program_name;
?? TITLE := 'put_source_string', EJECT ??

      PROCEDURE put_source_string
        (    s: clt$string_value);

        VAR
          graphic: ost$string,
          i: clt$string_index,
          in_$char: boolean,
          in_string: boolean,
          previous_representation_option: clt$data_representation_option;


        IF STRLENGTH (s) = 0 THEN
          put_string ('''''');
          RETURN;
        IFEND;

        previous_representation_option := representation_option;
        representation_option := clc$data_source_representation;

        #SCAN (clv$non_graphic, s, i, in_$char);
        IF in_$char THEN
          put_string_translated ('$CHAR(');
        IFEND;

        in_string := FALSE;
        FOR i := 1 TO STRLENGTH (s) DO
          CASE s (i) OF

          = ' ' .. '~' =
            IF NOT in_string THEN
              IF (i > 1) AND in_$char THEN
                put_string (' ');
                set_secondary_break_position;
              IFEND;
              put_string ('''');
              in_string := TRUE;
            IFEND;
            IF s (i) = '''' THEN
              put_string ('''');
            IFEND;
            put_string (s (i));

          ELSE
            IF i > 1 THEN
              IF in_string THEN
                put_string ('''');
                in_string := FALSE;
              IFEND;
              put_string (' ');
              set_secondary_break_position;
            IFEND;
            clp$convert_char_to_graphic (s (i), graphic, status);
            IF NOT status.normal THEN
              EXIT clp$internal_convert_to_string;
            IFEND;
            put_string (graphic.value (1, graphic.size));
          CASEND;
        FOREND;

        IF in_string THEN
          put_string ('''');
        IFEND;

        IF in_$char THEN
          put_string (')');
        IFEND;

        representation_option := previous_representation_option;

      PROCEND put_source_string;
?? TITLE := 'put_status_code', EJECT ??

      PROCEDURE put_status_code
        (    is_status_code: boolean;
             code: ost$status_condition_code);

        VAR
          identifier_is_valid: boolean,
          name: ost$status_condition_name,
          name_is_valid: boolean,
          str: ost$string,
          validated_identifier: ost$name;

        name_is_valid := FALSE;
        IF is_status_code THEN
          osp$get_status_condition_name (code, name, status);
          IF status.normal AND (name <> 'UNKNOWN_CONDITION') THEN
            IF representation_option = clc$data_source_representation THEN
              put_trimmed_string (name);
              RETURN;
            IFEND;
            name_is_valid := TRUE;
          IFEND;
          status.normal := TRUE;
        IFEND;

        osp$get_status_condition_string (code, str, status);
        IF status.normal THEN
          clp$validate_name (str.value (1, STRLENGTH (ost$status_identifier)), validated_identifier,
                identifier_is_valid);
          IF NOT identifier_is_valid THEN
            str.size := 0;
          IFEND;
        ELSE
          status.normal := TRUE;
          str.size := 0;
        IFEND;

        IF str.size > 0 THEN
          IF representation_option = clc$data_source_representation THEN
            put_string ('''');
          IFEND;
          put_string (str.value (1, str.size));
          IF representation_option = clc$data_source_representation THEN
            put_string ('''');
          IFEND;
        ELSE
          put_integer (code);
        IFEND;

        IF name_is_valid THEN
          put_string (' "');
          put_string_translated (name);
          put_string ('"');
        IFEND;

      PROCEND put_status_code;
?? TITLE := 'put_type_name', EJECT ??

      PROCEDURE [INLINE] put_type_name;

        VAR
          name: clt$type_name;


        IF value^.kind <> clc$date_time THEN
          name := clv$type_kind_names [clv$value_type_kinds [value^.kind]];
        ELSEIF value^.date_time_value.date_specified AND value^.date_time_value.time_specified THEN
          name := 'DATE_TIME';
        ELSEIF value^.date_time_value.date_specified THEN
          name := 'DATE';
        ELSEIF value^.date_time_value.time_specified THEN
          name := 'TIME';
        ELSE
          name := 'UNRECOGNIZABLE_DATE_TIME_VALUE';
        IFEND;
        put_trimmed_string (name);

      PROCEND put_type_name;
?? TITLE := 'start_structure', EJECT ??

      PROCEDURE start_structure;


        put_string ('"');
        put_type_name;
        put_string ('"  ');

        indent_at_start_of_structure := indent_amount;
        increment_indent (structure_indentation);
        start_string;

      PROCEND start_structure;
?? OLDTITLE, EJECT ??

      IF value = NIL THEN
        IF convert_to_lower_case THEN
          put_string ('"uninitialized value"');
        ELSE
          put_string ('"UNINITIALIZED VALUE"');
        IFEND;
        RETURN;
      IFEND;

      WHILE TRUE DO
        CASE value^.kind OF
        = clc$application =
          convert_application_to_string;
        = clc$array =
          convert_array_to_string;
        = clc$boolean =
          convert_boolean_to_string;
        = clc$cobol_name =
          convert_cobol_name_to_string;
        = clc$command_reference =
          convert_command_ref_to_string;
        = clc$data_name =
          convert_data_name_to_string;
        = clc$date_time =
          convert_date_time_to_string;
        = clc$deferred =
          convert_deferred_val_to_string;
*IF NOT $true(osv$unix)
        = clc$entry_point_reference =
          convert_entry_point_ref_to_str;
*IFEND
*IF NOT $true(osv$unix)
        = clc$file =
*ELSE
        = clc$unix_file, clc$nos_ve_file =
*IFEND
          convert_file_to_string;
        = clc$integer =
          convert_integer_to_string;
        = clc$keyword =
          convert_keyword_to_string;
        = clc$list =
          convert_list_to_string;
        = clc$lock =
          convert_lock_to_string;
        = clc$name =
          convert_name_to_string;
        = clc$network_title =
          convert_network_title_to_string;
        = clc$program_name =
          convert_program_name_to_string;
        = clc$range =
          convert_range_to_string;
*IF NOT $true(osv$unix)
        = clc$real =
          convert_real_to_string;
*IFEND
        = clc$record =
          convert_record_to_string;
        = clc$scu_line_identifier =
          convert_scu_line_id_to_string;
        = clc$statistic_code =
          convert_statistic_code_to_str;
        = clc$status =
          convert_status_to_string;
        = clc$status_code =
          convert_status_code_to_string;
        = clc$string =
          convert_string_value_to_string;
        = clc$string_pattern =
          convert_string_pat_to_string;
        = clc$time_increment =
          convert_time_incr_to_string;
        = clc$time_zone =
          convert_time_zone_to_string;
        = clc$type_specification =
          convert_type_spec_to_string;
        = clc$unspecified =
          IF convert_to_lower_case THEN
            put_string ('"unspecified value"');
          ELSE
            put_string ('"UNSPECIFIED VALUE"');
          IFEND;
        ELSE
          IF convert_to_lower_case THEN
            put_string ('"unrecognizable value"');
          ELSE
            put_string ('"UNRECOGNIZABLE VALUE"');
          IFEND;
        CASEND;
        IF (representation_option <> clc$labeled_elem_representation) OR
              (level_of_nesting > 0) OR (NOT (value^.kind IN labeled_structures)) OR (NOT first_pass) THEN
          RETURN;
        IFEND;
        first_pass := FALSE;
      WHILEND;

    PROCEND convert_value_to_string;
?? TITLE := 'finish_representation', EJECT ??

    PROCEDURE finish_representation;

      VAR
*IF $true(osv$unix)
        kludge_data_representation: ^array [*] of cell,
*IFEND
        final_position: integer;


      IF string_started THEN
        finish_string;
      IFEND;

      final_position := i#current_sequence_position (work_area);
      RESET work_area TO string_count;
*IF $true(osv$unix)
      NEXT kludge_data_representation: [1 .. (final_position - i#current_sequence_position (work_area))] IN
            work_area;
      data_representation := #SEQ (kludge_data_representation^);
*ELSE
      NEXT data_representation: [[REP final_position - i#current_sequence_position (work_area) OF cell]] IN
            work_area;
*IFEND
      RESET data_representation;

    PROCEND finish_representation;
?? TITLE := 'finish_string', EJECT ??

    PROCEDURE finish_string;


      IF NOT string_started THEN
        RETURN;
      IFEND;

      IF string_may_be_trimmed THEN
        WHILE (string_size^ > 0) AND (string_ptr^ (string_size^) = ' ') DO
          string_size^ := string_size^ -1;
        WHILEND;
      IFEND;

      RESET work_area TO string_ptr;
      NEXT string_ptr: [string_size^] IN work_area;
      space_remaining := space_remaining - #SIZE (string_ptr^);

      string_started := FALSE;

    PROCEND finish_string;
?? TITLE := 'increment_indent', EJECT ??

    PROCEDURE [INLINE] increment_indent
      (    increment: clt$string_size);

      VAR
        max_indent_amount: clt$string_size;


      IF representation_option = clc$labeled_elem_representation THEN
        max_indent_amount := label_indent_limit;
      ELSE
        max_indent_amount := STRLENGTH (string_ptr^) DIV 2;
      IFEND;

      IF (indent_amount + increment) <= max_indent_amount THEN
        indent_amount := indent_amount + increment;
      ELSE
        indent_amount := max_indent_amount;
      IFEND;

    PROCEND increment_indent;
*IF NOT $true(osv$unix)
?? TITLE := 'put_evaluated_parameters', EJECT ??

    PROCEDURE put_evaluated_parameters
      (    initial_text: ^clt$command_line;
           include_secure_parameters: boolean;
           pdt: clt$unbundled_pdt;
           pvt: ^clt$parameter_value_table;
           parameter_substitutions: ^clt$parameter_substitutions);

      VAR
        first_parameter: boolean,
        parameter_number: clt$parameter_number,
        parameter_put: boolean,
        parameters_skipped: clt$parameter_count,
        sorted_substitutions: ^array [1 .. * ] of record
          case substitute: boolean of
          = TRUE =
            text: ^clt$expression_text,
          casend,
        recend,
        text: ^clt$expression_text,
        value: ^clt$data_value;

?? NEWTITLE := 'put_parameter', EJECT ??

      PROCEDURE put_parameter;

        VAR
          lower_case_name: ost$name;


        IF first_parameter THEN
          first_parameter := FALSE;
          IF pdt.header^.command_or_function = clc$function THEN
            put_string ('(');
            IF parameters_skipped > 0 THEN
              WHILE parameters_skipped > 1 DO
                put_string (',');
                parameters_skipped := parameters_skipped - 1;
              WHILEND;
              put_string (', ');
            IFEND;
          ELSEIF initial_text <> NIL THEN
            put_string (' ');
          IFEND;
        ELSE
          IF (pdt.header^.command_or_function = clc$function) AND (parameters_skipped > 0) THEN
            WHILE parameters_skipped >= 1 DO
              put_string (',');
              parameters_skipped := parameters_skipped - 1;
            WHILEND;
          IFEND;
          put_string (', ');
        IFEND;

        IF pdt.header^.command_or_function = clc$command THEN
          #TRANSLATE (osv$upper_to_lower, pdt.names^ [pdt.parameters^ [parameter_number].name_index].name,
                lower_case_name);
          put_trimmed_string (lower_case_name);
          put_string ('=');
        IFEND;

        IF value <> NIL THEN
          convert_value_to_string (value);
        ELSE
          put_string (text^);
        IFEND;

      PROCEND put_parameter;
?? TITLE := 'sort_parameter_substitutions', EJECT ??

      PROCEDURE [INLINE] sort_parameter_substitutions;

        VAR
          found: boolean,
          i: clt$parameter_name_index,
          index: clt$parameter_name_index;


        FOR i := 1 TO UPPERBOUND (sorted_substitutions^) DO
          sorted_substitutions^ [i].substitute := FALSE;
        FOREND;

        FOR i := 1 TO UPPERBOUND (parameter_substitutions^) DO
          clp$search_parameter_names (parameter_substitutions^ [i].name, pdt.names, index, found);
          IF NOT found THEN
            osp$set_status_abnormal ('CL', cle$unknown_parameter_name, parameter_substitutions^ [i].name,
                  status);
            EXIT put_evaluated_parameters;
          IFEND;
          sorted_substitutions^ [pdt.names^ [index].position].substitute := TRUE;
          sorted_substitutions^ [pdt.names^ [index].position].text := parameter_substitutions^ [i].text;
        FOREND

      PROCEND sort_parameter_substitutions;
?? OLDTITLE, EJECT ??

      IF initial_text <> NIL THEN
        put_trimmed_string (initial_text^);
      IFEND;

      IF pdt.header^.number_of_parameters > 0 THEN
        IF parameter_substitutions = NIL THEN
          sorted_substitutions := NIL;
        ELSE
          PUSH sorted_substitutions: [1 .. pdt.header^.number_of_parameters];
          sort_parameter_substitutions;
        IFEND;

        first_parameter := TRUE;
        parameter_put := FALSE;
        parameter_number := 1;
        parameters_skipped := 0;
        WHILE parameter_number <= pdt.header^.number_of_parameters DO
          text := NIL;
          value := NIL;
          IF (pdt.parameters^ [parameter_number].security = clc$non_secure_parameter) OR
                include_secure_parameters THEN
            IF (sorted_substitutions <> NIL) AND sorted_substitutions^ [parameter_number].substitute THEN
              text := sorted_substitutions^ [parameter_number].text;
            ELSEIF pvt^ [parameter_number].specified THEN
              IF pvt^ [parameter_number].passing_method = clc$pass_by_value THEN
                value := pvt^ [parameter_number].value;
              ELSE
                text := pvt^ [parameter_number].variable;
              IFEND;
            IFEND;
          IFEND;
          IF (value = NIL) AND (text = NIL) THEN
            parameters_skipped := parameters_skipped + 1;
          ELSE

            put_parameter;

            parameter_put := TRUE;
            parameters_skipped := 0;
          IFEND;
          parameter_number := parameter_number + 1;
        WHILEND;

        IF parameter_put AND (pdt.header^.command_or_function = clc$function) THEN
          put_string (')');
        IFEND;
      IFEND;

    PROCEND put_evaluated_parameters;
*IFEND
?? TITLE := 'put_file_reference', EJECT ??

    PROCEDURE put_file_reference
      (    file_reference: fst$file_reference);

      CONST
        first_character_of_full_path = ':';

      VAR
        file_path: ^fst$path;

*IF NOT $true(osv$unix)
      IF (STRLENGTH (file_reference) > 1) AND (file_reference (1) = first_character_of_full_path) THEN
*IFEND
        put_string_translated (file_reference);
*IF NOT $true(osv$unix)
      ELSE
        PUSH file_path;
        clp$get_path_name (file_reference, osc$full_message_level, file_path^);
        put_string_translated (file_path^);
      IFEND;
*IFEND

    PROCEND put_file_reference;
?? TITLE := 'put_integer', EJECT ??

    PROCEDURE put_integer
      (    int: integer);

      VAR
        str: ost$string;


      clp$convert_integer_to_string (int, 10, FALSE, str, status);
      IF NOT status.normal THEN
        EXIT clp$internal_convert_to_string;
      IFEND;
      put_string (str.value (1, str.size));

    PROCEND put_integer;
*IF NOT $true(osv$unix)
?? TITLE := 'put_old_pdt', EJECT ??

    PROCEDURE put_old_pdt
      (    multi_line_format: boolean;
           proc_or_pdt: ost$name;
           proc_names: clt$proc_names;
           pdt: clt$parameter_descriptor_table;
           symbolic_parameters: ^clt$symbolic_parameters);

      VAR
        lower_case_name: ost$name,
        parameter_name: clt$parameter_name,
        parameter_name_index: clt$parameter_name_index,
        parameter_number: clt$parameter_number,
        status_parameter_number: 0 .. clc$max_parameters;

?? NEWTITLE := 'put_parameter', EJECT ??

      PROCEDURE put_parameter
        (    parameter: clt$parameter_descriptor);

?? NEWTITLE := 'put_parameter_default', EJECT ??

        PROCEDURE put_parameter_default;

          VAR
            default_size: clt$expression_text_size,
            previous_indent_amount: clt$string_size;


          put_string (' = ');

          CASE parameter.required_or_optional.selector OF
          = clc$required =
            put_string ('$required');
            RETURN;
          = clc$optional =
            put_string ('$optional');
            RETURN;
          = clc$optional_with_default =
            ;
          ELSE
            put_string ('"UNRECOGNIZABLE DEFAULT OPTION" ');
            RETURN;
          CASEND;

          previous_indent_amount := indent_amount;
          default_size := STRLENGTH (parameter.required_or_optional.default^);

          IF default_size > 0 THEN
            IF multi_line_format AND ((string_size^ +default_size) > max_string) AND
                  (default_size <= (max_string - continuation_indentation)) THEN
              IF default_size > (max_string - indent_amount) THEN
                indent_amount := max_string - default_size;
              IFEND;
{ If the string size of the parameter name + string size of default parameter
{ value is greater than page width size specified on the command then break
{ the string appending the continuation marks.
              break_string;
            IFEND;
            put_string (parameter.required_or_optional.default^);
          IFEND;

          indent_amount := previous_indent_amount;

        PROCEND put_parameter_default;
?? TITLE := 'put_parameter_names', EJECT ??

        PROCEDURE put_parameter_names;

          VAR
            lower_case_name: ost$name,
            i: 1 .. clc$max_parameter_names + 1;


          i := parameter_name_index;
          REPEAT
            #TRANSLATE (osv$upper_to_lower, pdt.names^ [i].name, lower_case_name);
            IF i = parameter_name_index THEN
              parameter_name := pdt.names^ [i].name;
            ELSE
              put_string (', ');
            IFEND;
            put_trimmed_string (lower_case_name);
            i := i + 1;
          UNTIL NOT ((i <= UPPERBOUND (pdt.names^)) AND (pdt.names^ [i].number = parameter_number));
          parameter_name_index := i;

        PROCEND put_parameter_names;
?? OLDTITLE, EJECT ??

        VAR
          i: 1 .. clc$max_keyword_values,
          list_specified: boolean,
          max_qualifier_text: ^string ( * ),
          max_value_sets_text: ^string ( * ),
          max_values_per_set_text: ^string ( * ),
          min_qualifier_text: ^string ( * ),
          min_value_sets_text: ^string ( * ),
          min_values_per_set_text: ^string ( * ),
          previous_indent_amount: clt$string_size,
          separator: ^separator_string,
          sub_list_specified: boolean;


        IF multi_line_format THEN
          previous_indent_amount := indent_amount;
          increment_indent (continuation_indentation);
        IFEND;

        put_parameter_names;

        IF (parameter_name = 'STATUS') AND (parameter.value_kind_specifier.kind = clc$variable_reference) AND
              (parameter.value_kind_specifier.variable_kind = clc$status_value) THEN
          status_parameter_number := parameter_number;
          RETURN;
        IFEND;

        put_string (': ');

        IF multi_line_format THEN
          indent_amount := previous_indent_amount;
          increment_indent (nesting_indentation);
        IFEND;

        IF symbolic_parameter = NIL THEN
          min_value_sets_text := NIL;
          max_value_sets_text := NIL;
          min_values_per_set_text := NIL;
          max_values_per_set_text := NIL;
          min_qualifier_text := NIL;
          max_qualifier_text := NIL;
        ELSE
          min_value_sets_text := symbolic_parameter^.min_value_sets;
          max_value_sets_text := symbolic_parameter^.max_value_sets;
          min_values_per_set_text := symbolic_parameter^.min_values_per_set;
          max_values_per_set_text := symbolic_parameter^.max_values_per_set;
          min_qualifier_text := symbolic_parameter^.value_kind_qualifier_low;
          max_qualifier_text := symbolic_parameter^.value_kind_qualifier_high;
        IFEND;

        sub_list_specified := (parameter.max_values_per_set > 1) OR (max_values_per_set_text <> NIL);
        IF (parameter.max_value_sets > 1) OR (parameter.max_values_per_set > 1) OR
              (max_value_sets_text <> NIL) OR sub_list_specified THEN
          put_string ('list');
          IF (parameter.min_value_sets > 1) OR (parameter.max_value_sets < clc$max_value_sets) OR
                (max_value_sets_text <> NIL) OR sub_list_specified THEN
            put_string (' ');
            IF min_value_sets_text <> NIL THEN
              put_string (min_value_sets_text^);
            ELSEIF parameter.min_value_sets = clc$max_value_sets THEN
              put_string ('$max_value_sets');
            ELSE
              put_integer (parameter.min_value_sets);
            IFEND;

            IF (parameter.max_value_sets <> parameter.min_value_sets) OR
                  (max_value_sets_text <> min_value_sets_text) THEN
              put_string ('..');
              IF max_value_sets_text <> NIL THEN
                put_string (max_value_sets_text^);
              ELSEIF parameter.max_value_sets = clc$max_value_sets THEN
                put_string ('$max_value_sets');
              ELSE
                put_integer (parameter.max_value_sets);
              IFEND;
            IFEND;
          IFEND;

          IF (parameter.max_values_per_set > 1) OR (max_values_per_set_text <> NIL) THEN
            put_string (', ');
            IF min_values_per_set_text <> NIL THEN
              put_string (min_values_per_set_text^);
            ELSEIF parameter.min_values_per_set = clc$max_values_per_set THEN
              put_string ('$max_values');
            ELSE
              put_integer (parameter.min_values_per_set);
            IFEND;

            IF (parameter.max_values_per_set <> parameter.min_values_per_set) OR
                  (max_values_per_set_text <> min_values_per_set_text) THEN
              put_string ('..');
              IF max_values_per_set_text <> NIL THEN
                put_string (max_values_per_set_text^);
              ELSEIF parameter.max_values_per_set = clc$max_values_per_set THEN
                put_string ('$max_values');
              ELSE
                put_integer (parameter.max_values_per_set);
              IFEND;
            IFEND;
          IFEND;

          IF parameter.value_range_allowed = clc$value_range_allowed THEN
            put_string (' range of ');
          ELSE
            put_string (' of ');
          IFEND;
          set_break_position;

        ELSEIF parameter.value_range_allowed = clc$value_range_allowed THEN
          put_string ('range of ');
          set_break_position;
        IFEND;

        CASE parameter.value_kind_specifier.kind OF

        = clc$keyword_value =
          { handled below } ;

        = clc$any_value =
          put_string ('any');

        = clc$variable_reference =
          IF parameter.value_kind_specifier.array_allowed = clc$array_allowed THEN
            put_string ('array of ');
          ELSE
            put_string ('var of ');
          IFEND;
          set_break_position;
          CASE parameter.value_kind_specifier.variable_kind OF
          = clc$string_value =
            put_string ('string');
          = clc$real_value =
            put_string ('real');
          = clc$integer_value =
            put_string ('integer');
          = clc$boolean_value =
            put_string ('boolean');
          = clc$status_value =
            put_string ('status');
          = clc$any_value =
            put_string ('any');
          ELSE
            put_string ('BAD VARIABLE KIND');
          CASEND;

        = clc$application_value =
          #TRANSLATE (osv$upper_to_lower, parameter.value_kind_specifier.value_name, lower_case_name);
          put_trimmed_string (lower_case_name);
          CASE parameter.value_kind_specifier.scanner.kind OF
          = clc$unlinked_av_scanner =
            #TRANSLATE (osv$upper_to_lower, parameter.value_kind_specifier.scanner.name, lower_case_name);
            put_string (' ');
            put_trimmed_string (lower_case_name);
          ELSE
           ;
          CASEND;

        = clc$file_value =
          put_string ('file');

        = clc$name_value =
          put_string ('name');
          IF (parameter.value_kind_specifier.min_name_size > 1) OR
                (parameter.value_kind_specifier.max_name_size < osc$max_name_size) OR
                (max_qualifier_text <> NIL) THEN
            put_string (' ');
            IF min_qualifier_text <> NIL THEN
              IF min_qualifier_text <> max_qualifier_text THEN
                put_string (min_qualifier_text^);
              ELSE
                put_string ('1');
              IFEND;
            ELSEIF parameter.value_kind_specifier.min_name_size = osc$max_name_size THEN
              put_string ('$max_name');
            ELSE
              put_integer (parameter.value_kind_specifier.min_name_size);
            IFEND;
            put_string ('..');
            IF max_qualifier_text <> NIL THEN
              put_string (max_qualifier_text^);
            ELSEIF parameter.value_kind_specifier.max_name_size = osc$max_name_size THEN
              put_string ('$max_name');
            ELSE
              put_integer (parameter.value_kind_specifier.max_name_size);
            IFEND;
          IFEND;

        = clc$string_value =
          put_string ('string');
          IF (parameter.value_kind_specifier.min_string_size > 0) OR
                (parameter.value_kind_specifier.max_string_size < osc$max_string_size) OR
                (max_qualifier_text <> NIL) THEN
            put_string (' ');
            IF min_qualifier_text <> NIL THEN
              put_string (min_qualifier_text^);
            ELSE
              put_integer (parameter.value_kind_specifier.min_string_size);
            IFEND;

            IF (parameter.value_kind_specifier.max_string_size <>
                  parameter.value_kind_specifier.min_string_size) OR
                  (max_qualifier_text <> min_qualifier_text) THEN
              put_string ('..');
              IF max_qualifier_text <> NIL THEN
                put_string (max_qualifier_text^);
              ELSE
                put_integer (parameter.value_kind_specifier.max_string_size);
              IFEND;
            IFEND;
          IFEND;

        = clc$integer_value =
          put_string ('integer');
          IF (parameter.value_kind_specifier.min_integer_value > clc$min_integer) OR
                (parameter.value_kind_specifier.max_integer_value < clc$max_integer) OR
                (max_qualifier_text <> NIL) THEN
            put_string (' ');
            IF min_qualifier_text <> NIL THEN
              put_string (min_qualifier_text^);
            ELSEIF parameter.value_kind_specifier.min_integer_value = clc$min_integer THEN
              put_string ('$min_integer');
            ELSE
              put_integer (parameter.value_kind_specifier.min_integer_value);
            IFEND;
            put_string ('..');
            IF max_qualifier_text <> NIL THEN
              put_string (max_qualifier_text^);
            ELSEIF parameter.value_kind_specifier.max_integer_value = clc$max_integer THEN
              put_string ('$max_integer');
            ELSE
              put_integer (parameter.value_kind_specifier.max_integer_value);
            IFEND;
          IFEND;

        = clc$real_value =
          put_string ('real');

        = clc$boolean_value =
          put_string ('boolean');

        = clc$status_value =
          put_string ('status');

        ELSE
          put_string ('"BAD VALUE KIND"');
        CASEND;

        IF parameter.value_kind_specifier.keyword_values <> NIL THEN
          #TRANSLATE (osv$upper_to_lower, parameter.value_kind_specifier.keyword_values^ [1],
                lower_case_name);
          IF parameter.value_kind_specifier.kind <> clc$keyword_value THEN
            put_string (' or ');
            set_break_position;
          IFEND;
          put_string ('key ');
          put_trimmed_string (lower_case_name);
          FOR i := 2 TO UPPERBOUND (parameter.value_kind_specifier.keyword_values^) DO
            #TRANSLATE (osv$upper_to_lower, parameter.value_kind_specifier.keyword_values^ [i],
                  lower_case_name);
            put_string (', ');
            put_trimmed_string (lower_case_name);
          FOREND;
        IFEND;

        put_parameter_default;

        IF multi_line_format THEN
          indent_amount := previous_indent_amount
        IFEND;

      PROCEND put_parameter;
?? TITLE := 'put_pdt_names', EJECT ??

      PROCEDURE put_pdt_names;

        VAR
          index: 1 .. clc$max_proc_names;


        #TRANSLATE (osv$upper_to_lower, proc_names [1], lower_case_name);
        put_trimmed_string (lower_case_name);

        FOR index := 2 TO UPPERBOUND (proc_names) DO
          put_string (', ');

          #TRANSLATE (osv$upper_to_lower, proc_names [index], lower_case_name);
          put_trimmed_string (lower_case_name);
        FOREND;

      PROCEND put_pdt_names;
?? OLDTITLE, EJECT ??

      VAR
        previous_indent_amount: clt$string_size,
        symbolic_parameter: ^clt$symbolic_parameter;


      IF multi_line_format THEN
        start_string;
        previous_indent_amount := indent_amount;
        increment_indent (continuation_indentation);
      IFEND;

      IF proc_or_pdt <> osc$null_name THEN
        put_trimmed_string (proc_or_pdt);
        put_string (' ');
      IFEND;

      put_pdt_names;

      IF pdt.parameters <> NIL THEN
        put_string (' (');

        IF multi_line_format THEN
          indent_amount := previous_indent_amount;
          increment_indent (nesting_indentation);
        IFEND;

        status_parameter_number := 0;
        parameter_name_index := 1;

      /put_parameters/
        FOR parameter_number := 1 TO UPPERBOUND (pdt.parameters^) DO
          IF multi_line_format THEN
            start_string;
          ELSEIF parameter_number > 1 THEN
            put_string ('; ');
          IFEND;

          IF symbolic_parameters = NIL THEN
            symbolic_parameter := NIL;
          ELSE
            symbolic_parameter := ^symbolic_parameters^ [parameter_number];
          IFEND;
          put_parameter (pdt.parameters^ [parameter_number]);
        FOREND /put_parameters/;

        IF multi_line_format AND (status_parameter_number <> UPPERBOUND (pdt.parameters^)) THEN
          start_string;
        IFEND;

        put_string (')');
      IFEND;

      IF multi_line_format THEN
        indent_amount := previous_indent_amount;
        finish_string;
      IFEND;

    PROCEND put_old_pdt;
*IFEND
?? TITLE := 'put_pdt', EJECT ??

    PROCEDURE put_pdt
      (    multi_line_format: boolean;
           parameter_starts_line: boolean;
           individual_parameter: boolean;
           individual_parameter_number: clt$parameter_number;
           include_header: boolean;
           include_implementation_info: boolean;
           command_or_function_name: pmt$program_name;
           aliases: ^array [1 .. * ] of pmt$program_name;
           availability: clt$named_entry_availability;
           command_or_function_scope: clt$command_or_function_scope;
           pdt: clt$unbundled_pdt;
           pvt: ^clt$parameter_value_table);

      VAR
        lower_case_name: ost$name,
        parameter_number: clt$parameter_number;

?? NEWTITLE := 'put_parameter', EJECT ??

      PROCEDURE put_parameter;

?? NEWTITLE := 'put_parameter_attributes', EJECT ??

        PROCEDURE put_parameter_attributes;

          VAR
            separator: ^separator_string;


          separator := ^left_parenthesis;

          IF pdt.parameters^ [parameter_number].passing_method = clc$pass_by_reference THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('VAR');
          IFEND;

          IF NOT (clc$specify_positionally IN pdt.parameters^ [parameter_number].specification_methods) THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('BY_NAME');
          IFEND;

          IF include_implementation_info AND (pdt.parameters^ [parameter_number].evaluation_method =
                clc$deferred_evaluation) THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('DEFER');
          IFEND;

          IF include_implementation_info AND (pdt.parameters^ [parameter_number].checking_level =
                clc$extended_parameter_checking) THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('CHECK');
          IFEND;

          CASE pdt.parameters^ [parameter_number].availability OF
          = clc$advanced_usage_entry =
            put_string (separator^);
            separator := ^comma;
            put_string ('ADVANCED');
          = clc$hidden_entry =
            put_string (separator^);
            separator := ^comma;
            put_string ('HIDDEN');
          ELSE
            ;
          CASEND;

          IF pdt.parameters^ [parameter_number].security = clc$secure_parameter THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('SECURE');
          IFEND;

          IF pdt.type_descriptions^ [parameter_number].name <> NIL THEN
            put_string (separator^);
            separator := ^comma;
            #TRANSLATE (osv$upper_to_lower, pdt.type_descriptions^ [parameter_number].name^, lower_case_name);
            put_string (lower_case_name (1, STRLENGTH (pdt.type_descriptions^ [parameter_number].name^)));
          IFEND;

          IF separator = ^comma THEN
            put_string (') ');
          IFEND;

        PROCEND put_parameter_attributes;
?? TITLE := 'put_parameter_default', EJECT ??

        PROCEDURE put_parameter_default;

          VAR
            default_size: clt$expression_text_size,
            previous_indent_amount: clt$string_size,
            use_parameter_value: boolean;


          previous_indent_amount := indent_amount;

          put_string (' = ');

          IF pvt = NIL THEN
            use_parameter_value := FALSE;
          ELSEIF pvt^ [parameter_number].passing_method = clc$pass_by_value THEN
            use_parameter_value := pvt^ [parameter_number].value <> NIL;
          ELSE { pvt^ [parameter_number].passing_method = clc$pass_by_reference
            use_parameter_value := pvt^ [parameter_number].variable <> NIL;
          IFEND;

          IF use_parameter_value THEN
            IF pvt^ [parameter_number].passing_method = clc$pass_by_value THEN
              convert_value_to_string (pvt^ [parameter_number].value);
            ELSE { pvt^ [parameter_number].passing_method = clc$pass_by_reference
              put_string (pvt^ [parameter_number].variable^);
            IFEND;
          ELSE
            CASE pdt.parameters^ [parameter_number].requirement OF
            = clc$required_parameter =
              put_string ('$required');
              RETURN;
            = clc$optional_parameter =
              put_string ('$optional');
              RETURN;
            = clc$optional_default_parameter =
              ;
            = clc$confirm_default_parameter =
              put_string ('$confirm ');
            ELSE
              put_string ('"UNRECOGNIZABLE DEFAULT OPTION" ');
            CASEND;

            IF pdt.parameters^ [parameter_number].default_name_size > 0 THEN
*IF $true(osv$unix)
              put_trimmed_string (pdt.default_names^ [parameter_number]^);
*ELSE
              #TRANSLATE (osv$upper_to_lower, pdt.default_names^ [parameter_number]^, lower_case_name);
              put_trimmed_string (lower_case_name);
*IFEND
              put_string (', ');
            IFEND;

            default_size := pdt.parameters^ [parameter_number].default_value_size;

            IF default_size > 0 THEN
              IF multi_line_format AND ((string_size^ +default_size) > max_string) AND
                    (default_size <= (max_string - continuation_indentation)) THEN
                IF default_size > (max_string - indent_amount) THEN
                  indent_amount := max_string - default_size;
                IFEND;
                start_string;
              IFEND;
              put_string (pdt.default_values^ [parameter_number]^);
            IFEND;
          IFEND;

          indent_amount := previous_indent_amount;

        PROCEND put_parameter_default;
?? TITLE := 'put_parameter_names', EJECT ??

        PROCEDURE put_parameter_names;

          VAR
            abbreviation_index: clt$parameter_name_count,
            alias_count: clt$parameter_name_count,
            alias_index: clt$parameter_name_count,
            index: clt$parameter_name_index,
            nominal_index: clt$parameter_name_count;


          nominal_index := 0;
          alias_count := 0;
          alias_index := 0;
          abbreviation_index := 0;

        /search_for_number/
          FOR index := 1 TO UPPERBOUND (pdt.names^) DO
            IF pdt.names^ [index].position = parameter_number THEN
              CASE pdt.names^ [index].class OF

              = clc$nominal_entry =
                IF nominal_index = 0 THEN
                  nominal_index := index;
                ELSE
                  put_string ('"DUPLICATE NOMINAL PARAMETER NAME"');
                  EXIT put_pdt;
                IFEND;

              = clc$alias_entry =
                IF alias_index = 0 THEN
                  alias_index := index;
                IFEND;
                alias_count := alias_count + 1;

              = clc$abbreviation_entry =
                IF abbreviation_index = 0 THEN
                  abbreviation_index := index;
                ELSE
                  put_string ('"DUPLICATE PARAMETER ABBREVIATION"');
                  EXIT put_pdt;
                IFEND;

              ELSE
                put_string ('"BAD PARAMETER NAME DESCRIPTION"');
                EXIT put_pdt;
              CASEND;
            IFEND;
          FOREND /search_for_number/;

          IF nominal_index = 0 THEN
            put_string ('"MISSING PARAMETER NAME"');
            EXIT put_pdt;
          IFEND;

          #TRANSLATE (osv$upper_to_lower, pdt.names^ [nominal_index].name, lower_case_name);
          put_trimmed_string (lower_case_name);

          IF alias_index > 0 THEN

          /put_alias/
            FOR index := alias_index TO pdt.header^.number_of_parameter_names DO
              IF (pdt.names^ [index].position = parameter_number) AND
                    (pdt.names^ [index].class = clc$alias_entry) THEN
                put_string (', ');
                #TRANSLATE (osv$upper_to_lower, pdt.names^ [index].name, lower_case_name);
                put_trimmed_string (lower_case_name);
                IF alias_count <= 1 THEN
                  EXIT /put_alias/;
                IFEND;
                alias_count := alias_count - 1;
              IFEND;
            FOREND /put_alias/;
          IFEND;

          IF abbreviation_index > 0 THEN
            put_string (', ');
            #TRANSLATE (osv$upper_to_lower, pdt.names^ [abbreviation_index].name, lower_case_name);
            put_trimmed_string (lower_case_name);
          IFEND;

        PROCEND put_parameter_names;
?? OLDTITLE, EJECT ??

        VAR
          previous_indent_amount: clt$string_size,
          separator: ^separator_string;


        IF multi_line_format OR parameter_starts_line THEN
          previous_indent_amount := indent_amount;
          increment_indent (continuation_indentation);
        IFEND;

        put_parameter_names;

        IF (parameter_number <> pdt.header^.status_parameter_number) OR (NOT include_implementation_info) THEN
          put_string (': ');

          put_parameter_attributes;

          IF multi_line_format THEN
            indent_amount := previous_indent_amount;
            increment_indent (nesting_indentation);
          IFEND;

          put_type (TRUE, include_implementation_info, multi_line_format,
                pdt.type_descriptions^ [parameter_number]);

          put_parameter_default;
        IFEND;

        IF multi_line_format OR parameter_starts_line THEN
          indent_amount := previous_indent_amount
        IFEND;

      PROCEND put_parameter;
?? TITLE := 'put_pdt_header', EJECT ??

      PROCEDURE put_pdt_header;

        VAR
          include_help_module_name: boolean,
          separator: ^separator_string;


        IF pdt.header^.command_or_function = clc$command THEN
          put_string ('PROCEDURE ');
        ELSE
          put_string ('FUNCTION ');
        IFEND;

        separator := ^left_parenthesis;

        CASE command_or_function_scope OF
        = clc$local_command_or_function =
          put_string (separator^);
          separator := ^comma;
          put_string ('LOCAL');
        = clc$gate_command_or_function =
          put_string (separator^);
          separator := ^comma;
          put_string ('GATE');
        = clc$xdcl_command_or_function =
          ;
        ELSE
          put_string (separator^);
          separator := ^comma;
          put_string ('UNRECOGNIZABLE_SCOPE');
        CASEND;

        CASE availability OF
        = clc$advanced_usage_entry =
          put_string (separator^);
          separator := ^comma;
          put_string ('ADVANCED');
        = clc$hidden_entry =
          put_string (separator^);
          separator := ^comma;
          put_string ('HIDDEN');
        ELSE
          ;
        CASEND;

        IF pdt.header^.help_module_name = osc$null_name THEN
          include_help_module_name := FALSE;
        ELSEIF aliases <> NIL THEN
          include_help_module_name := pdt.header^.help_module_name <> aliases^ [UPPERBOUND (aliases^)];
        ELSE
          include_help_module_name := pdt.header^.help_module_name <> command_or_function_name;
        IFEND;
        IF include_help_module_name THEN
          put_string (separator^);
          separator := ^comma;
          #TRANSLATE (osv$upper_to_lower, pdt.header^.help_module_name, lower_case_name);
          put_trimmed_string (lower_case_name);
        IFEND;

        IF separator = ^comma THEN
          put_string (') ');
        IFEND;

      PROCEND put_pdt_header;
?? TITLE := 'put_pdt_names', EJECT ??

      PROCEDURE put_pdt_names;

        VAR
          index: 1 .. clc$max_proc_names;


        #TRANSLATE (osv$upper_to_lower, command_or_function_name, lower_case_name);
        put_trimmed_string (lower_case_name);

        IF aliases <> NIL THEN
          FOR index := 1 TO UPPERBOUND (aliases^) DO
            put_string (', ');

            #TRANSLATE (osv$upper_to_lower, aliases^ [index], lower_case_name);
            put_trimmed_string (lower_case_name);
          FOREND;
        IFEND;

      PROCEND put_pdt_names;
?? OLDTITLE, EJECT ??

      VAR
        previous_indent_amount: clt$string_size;


      IF multi_line_format OR parameter_starts_line THEN
        start_string;
        previous_indent_amount := indent_amount;
        increment_indent (continuation_indentation);
      IFEND;

      IF individual_parameter THEN
        parameter_number := individual_parameter_number;
        put_parameter;
      ELSE

        IF include_header THEN
          put_pdt_header;
        IFEND;

        IF command_or_function_name <> osc$null_name THEN
          put_pdt_names;
        IFEND;

        IF pdt.header^.number_of_parameters > 0 THEN
          IF command_or_function_name <> osc$null_name THEN
            put_string (' (');
            IF multi_line_format OR parameter_starts_line THEN
              indent_amount := previous_indent_amount;
              increment_indent (nesting_indentation);
              start_string;
            IFEND;
          ELSEIF multi_line_format OR parameter_starts_line THEN
            indent_amount := previous_indent_amount;
          IFEND;

        /put_parameters/
          FOR parameter_number := 1 TO pdt.header^.number_of_parameters DO

            CASE pdt.parameters^ [parameter_number].availability OF
            = clc$advanced_usage_entry =
              IF NOT include_advanced_items THEN
                CYCLE /put_parameters/;
              IFEND;
            = clc$hidden_entry =
              IF NOT include_hidden_items THEN
                CYCLE /put_parameters/;
              IFEND;
            ELSE
              ;
            CASEND;

            IF parameter_number > 1 THEN
              IF multi_line_format OR parameter_starts_line THEN
                start_string;
              ELSE
                put_string ('; ');
              IFEND;
            IFEND;

            put_parameter;
          FOREND /put_parameters/;

          IF command_or_function_name <> osc$null_name THEN
            IF multi_line_format AND (pdt.header^.status_parameter_number <> pdt.header^.number_of_parameters)
                  THEN
              start_string;
            IFEND;
            put_string (')');
          IFEND;
        IFEND;
      IFEND;

      IF multi_line_format THEN
        indent_amount := previous_indent_amount;
        finish_string;
      IFEND;

    PROCEND put_pdt;
*IF NOT $true(osv$unix)
?? TITLE := 'put_real', EJECT ??

    PROCEDURE put_real
      (    real_number: longreal);

      VAR
        str: ost$string;


      clp$convert_real_to_string (real_number, clc$max_real_number_digits, str, status);
      IF NOT status.normal THEN
        EXIT clp$internal_convert_to_string;
      IFEND;
      put_string (str.value (1, str.size));

    PROCEND put_real;
*IFEND
?? TITLE := 'put_string', EJECT ??

    PROCEDURE put_string
      (    s: clt$string_value);

      VAR
        i: clt$string_index,
        truncate_leading_spaces: boolean;

      IF STRLENGTH (s) = 0 THEN
        IF NOT string_started THEN
          start_string;
        IFEND;
        RETURN;
      IFEND;

      truncate_leading_spaces := FALSE;
      FOR i := 1 TO STRLENGTH (s) DO
        IF NOT string_started THEN
          start_string;
        ELSEIF string_size^ >= STRLENGTH (string_ptr^) THEN
          IF STRLENGTH (string_ptr^) < max_string THEN
            work_area_overflow;
          IFEND;
          break_string;
          truncate_leading_spaces := indent_amount > 0;
        IFEND;

        string_size^ := string_size^ +1;
        CASE s (i) OF

        = $CHAR (0) .. $CHAR (31), $CHAR (127) =
          IF clv$retain_unprintable_char THEN
            string_ptr^ (string_size^) := s (i);
          ELSE
            string_ptr^ (string_size^) := '?';
          IFEND;
          IF NOT break_pending THEN
            IF representation_option = clc$data_source_representation THEN
              IF string_size^ < (STRLENGTH (string_ptr^) - continuation_size) THEN
                break.index := string_size^;
                break.mark_continuation := TRUE;
                break.indent := indent_amount;
              IFEND;
            ELSE
              IF string_size^ < STRLENGTH (string_ptr^) THEN
                break.index := string_size^;
                break.mark_continuation := FALSE;
                break.indent := indent_amount;
              IFEND;
            IFEND;
          IFEND;

        = 'A' .. 'Z', 'a' .. 'z', '0' .. '9', '$', '#', '@', '[', '\', ']', '^', '`', '{', '|', '}', '~' =
          string_ptr^ (string_size^) := s (i);

        = '_', '.', '(', ':' =
          string_ptr^ (string_size^) := s (i);
          IF NOT secondary_break_pending THEN
            secondary_break.index := string_size^;
            secondary_break.mark_continuation := (representation_option = clc$data_source_representation);
            secondary_break.indent := indent_amount;
          IFEND;

        ELSE
          IF (s(i) = ' ') AND truncate_leading_spaces AND (string_ptr^ (string_size^ - 1) = ' ') THEN
            string_size^ := string_size^ - 1;
          ELSE
            string_ptr^ (string_size^) := s (i);
            IF NOT break_pending THEN
              IF representation_option = clc$data_source_representation THEN
                IF string_size^ < (STRLENGTH (string_ptr^) - continuation_size) THEN
                  break.index := string_size^;
                  break.mark_continuation := TRUE;
                  break.indent := indent_amount;
                IFEND;
              ELSE
                IF string_size^ < STRLENGTH (string_ptr^) THEN
                  break.index := string_size^;
                  break.mark_continuation := FALSE;
                  break.indent := indent_amount;
                IFEND;
              IFEND;
            IFEND;
          IFEND;

        CASEND;
      FOREND;

      string_may_be_trimmed := TRUE;

    PROCEND put_string;
?? TITLE := 'put_string_translated', EJECT ??

    PROCEDURE [INLINE] put_string_translated
      (    s: clt$string_value);

      VAR
        size: clt$string_size,
        translated_string: ^clt$string_value;

      size := STRLENGTH (s);
      WHILE (size > 0) AND (s (size) = ' ') DO
        size := size - 1;
      WHILEND;
      translated_string := ^s (1, size);

      IF convert_to_lower_case THEN
        PUSH translated_string: [size];
        #TRANSLATE (osv$upper_to_lower, s (1, size), translated_string^);
      IFEND;

      put_string (translated_string^);

    PROCEND put_string_translated;
?? TITLE := 'put_trimmed_string', EJECT ??

    PROCEDURE [INLINE] put_trimmed_string
      (    s: clt$string_value);

      VAR
        size: clt$string_size;


      size := STRLENGTH (s);
      WHILE (size > 0) AND (s (size) = ' ') DO
        size := size - 1;
      WHILEND;

      put_string (s (1, size));

    PROCEND put_trimmed_string;
?? TITLE := 'put_type', EJECT ??

    PROCEDURE put_type
      (    parameter_type: boolean;
           include_implementation_info: boolean;
           multi_line_format: boolean;
           type_description: clt$type_description);

?? NEWTITLE := 'put_application_type', EJECT ??

      PROCEDURE put_application_type;


        put_string ('application');
        IF type_description.balance_brackets THEN
          put_string (' balance_brackets');
        IFEND;

      PROCEND put_application_type;
?? TITLE := 'put_array_type', EJECT ??

      PROCEDURE put_array_type;

        VAR
          lowerbound_text: ^clt$expression_text,
          symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier,
          upperbound_text: ^clt$expression_text;


        put_string ('array');

        IF type_description.array_bounds_defined THEN
          IF symbolic_qualifiers_work_area = NIL THEN
            lowerbound_text := NIL;
            upperbound_text := NIL;
          ELSE
            NEXT symbolic_subrange_qualifier IN symbolic_qualifiers_work_area;
            IF symbolic_subrange_qualifier^.low_text_size = 0 THEN
              lowerbound_text := NIL;
            ELSE
              NEXT lowerbound_text: [symbolic_subrange_qualifier^.low_text_size] IN
                    symbolic_qualifiers_work_area;
            IFEND;
            IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
              upperbound_text := lowerbound_text;
            ELSE
              NEXT upperbound_text: [symbolic_subrange_qualifier^.high_text_size] IN
                    symbolic_qualifiers_work_area;
            IFEND;
          IFEND;

          put_string (' ');

          IF lowerbound_text <> NIL THEN
            put_string (lowerbound_text^);
          ELSE
            put_integer (type_description.bounds.lower);
          IFEND;

          put_string ('..');

          IF upperbound_text <> NIL THEN
            put_string (upperbound_text^);
          ELSE
            put_integer (type_description.bounds.upper);
          IFEND;
        IFEND;

        IF type_description.array_element_type_description <> NIL THEN
          put_string (' of ');
          set_break_position;
          put_type (FALSE, include_implementation_info, multi_line_format,
                type_description.array_element_type_description^);
        IFEND;

      PROCEND put_array_type;
?? TITLE := 'put_date_time_type', EJECT ??

      PROCEDURE put_date_time_type;

        VAR
          separator: ^separator_string;


        IF type_description.date_and_or_time = $clt$date_and_or_time [clc$date, clc$time] THEN
          put_string ('date_time');
        ELSEIF type_description.date_and_or_time = $clt$date_and_or_time [clc$date] THEN
          put_string ('date');
        ELSEIF type_description.date_and_or_time = $clt$date_and_or_time [clc$time] THEN
          put_string ('time');
        ELSE
          put_string ('UNRECOGNIZABLE_DATE_TIME_TYPE');
        IFEND;

        IF type_description.tenses <> $clt$date_time_tenses [clc$past, clc$present, clc$future] THEN
          separator := ^space;

          IF clc$past IN type_description.tenses THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('past');
          IFEND;
          IF clc$present IN type_description.tenses THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('present');
          IFEND;
          IF clc$future IN type_description.tenses THEN
            put_string (separator^);
            separator := ^comma;
            put_string ('future');
          IFEND;
        IFEND;

      PROCEND put_date_time_type;
?? TITLE := 'put_integer_type', EJECT ??

      PROCEDURE put_integer_type;

        CONST
          default_radix = 10;

        VAR
          max_integer_text: ^clt$expression_text,
          min_integer_text: ^clt$expression_text,
          symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


        IF symbolic_qualifiers_work_area = NIL THEN
          min_integer_text := NIL;
          max_integer_text := NIL;
        ELSE
          NEXT symbolic_subrange_qualifier IN symbolic_qualifiers_work_area;
          IF symbolic_subrange_qualifier^.low_text_size = 0 THEN
            min_integer_text := NIL;
          ELSE
            NEXT min_integer_text: [symbolic_subrange_qualifier^.low_text_size] IN
                  symbolic_qualifiers_work_area;
          IFEND;
          IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
            max_integer_text := min_integer_text;
          ELSE
            NEXT max_integer_text: [symbolic_subrange_qualifier^.high_text_size] IN
                  symbolic_qualifiers_work_area;
          IFEND;
        IFEND;

        put_string ('integer');

        IF (min_integer_text <> NIL) OR (max_integer_text <> NIL) OR
              (type_description.min_integer_value > clc$min_integer) OR
              (type_description.max_integer_value < clc$max_integer) THEN
          put_string (' ');

          IF min_integer_text <> NIL THEN
            put_string (min_integer_text^);
          ELSEIF type_description.min_integer_value = clc$min_integer THEN
            put_string ('$min_integer');
          ELSEIF type_description.min_integer_value = clc$max_integer THEN
            put_string ('$max_integer');
          ELSE
            put_integer (type_description.min_integer_value);
          IFEND;

          put_string ('..');

          IF max_integer_text <> NIL THEN
            put_string (max_integer_text^);
          ELSEIF type_description.max_integer_value = clc$min_integer THEN
            put_string ('$min_integer');
          ELSEIF type_description.max_integer_value = clc$max_integer THEN
            put_string ('$max_integer');
          ELSE
            put_integer (type_description.max_integer_value);
          IFEND;
        IFEND;

        IF type_description.default_radix <> default_radix THEN
          put_string (' ');
          put_string ('radix ');
          put_integer (type_description.default_radix);
        IFEND;

      PROCEND put_integer_type;
?? TITLE := 'put_keyword_type', EJECT ??

      PROCEDURE put_keyword_type;

        VAR
          first_group_ordinal: clt$named_entry_ordinal,
          first_keyword_in_group: boolean,
          index: 1 .. clc$max_keywords,
          keyword: clt$keyword,
          keywords: ^clt$keyword_specifications,
          keyword_in_group: boolean,
          keyword_size: ost$name_size,
          last_keyword_in_group: boolean,
          new_keyword: boolean,
          new_line_desired: boolean,
          previous_indent_amount: clt$string_size;

?? NEWTITLE := 'sort_keywords', EJECT ??

{
{ This routine sorts the keywords according to:
{
{     1)     availability   (normal, advanced, hidden)
{     2)     class          (nominal, alias, abbreviation)
{     3)     ordinal
{

        PROCEDURE [INLINE] sort_keywords;

          VAR
            current: -clc$max_keywords .. clc$max_keywords,
            do_swap: boolean,
            gap: 1 .. clc$max_keywords,
            start: 1 .. clc$max_keywords,
            swap: clt$keyword_specification;


          gap := UPPERBOUND (keywords^);
          WHILE gap > 1 DO
            gap := 2 * (gap DIV 4) + 1;
            FOR start := 1 TO UPPERBOUND (keywords^) - gap DO
              current := start;

            /inner_loop/
              WHILE current > 0 DO
                CASE keywords^ [current].availability OF
                = clc$normal_usage_entry =
                  do_swap := FALSE;
                = clc$advanced_usage_entry =
                  do_swap := keywords^ [current + gap].availability = clc$normal_usage_entry;
                ELSE { clc$hidden_entry }
                  do_swap := keywords^ [current + gap].availability <> clc$hidden_entry;
                CASEND;
                IF (NOT do_swap) AND (keywords^ [current].availability =
                      keywords^ [current + gap].availability) THEN
                  IF keywords^ [current].ordinal > keywords^ [current + gap].ordinal THEN
                    do_swap := TRUE;
                  ELSEIF (keywords^ [current].ordinal = keywords^ [current + gap].ordinal) AND
                        (keywords^ [current].class > keywords^ [current + gap].class) THEN
                    do_swap := TRUE;
                  IFEND;
                IFEND;
                IF NOT do_swap THEN
                  EXIT /inner_loop/;
                IFEND;

                swap := keywords^ [current];
                keywords^ [current] := keywords^ [current + gap];
                keywords^ [current + gap] := swap;
                current := current - gap;
              WHILEND /inner_loop/;
            FOREND;
          WHILEND;

        PROCEND sort_keywords;
?? OLDTITLE, EJECT ??

        put_string ('key');

        IF multi_line_format THEN
          previous_indent_amount := indent_amount;
          increment_indent (nesting_indentation);
        IFEND;

        PUSH keywords: [1 .. UPPERBOUND (type_description.keyword_specifications^)];
        keywords^ := type_description.keyword_specifications^;
        sort_keywords;

      /put_keys/
        FOR index := 1 TO UPPERBOUND (keywords^) DO
          IF (keywords^ [index].availability = clc$advanced_usage_entry) AND (NOT include_advanced_items) THEN
            CYCLE /put_keys/;
          ELSEIF (keywords^ [index].availability = clc$hidden_entry) AND (NOT include_hidden_items) THEN
            EXIT /put_keys/;
          IFEND;

          #TRANSLATE (osv$upper_to_lower, keywords^ [index].keyword, keyword);
          keyword_size := clp$trimmed_string_size (keyword);
          new_keyword := (index = 1) OR (keywords^ [index].ordinal <> keywords^ [index - 1].ordinal);
          keyword_in_group := ((index < UPPERBOUND (keywords^)) AND
                (keywords^ [index].ordinal = keywords^ [index + 1].ordinal)) OR
                ((index > 1) AND (keywords^ [index].ordinal = keywords^ [index - 1].ordinal));
          first_keyword_in_group := new_keyword AND keyword_in_group;
          last_keyword_in_group := keyword_in_group AND ((index = UPPERBOUND (keywords^)) OR
                (keywords^ [index].ordinal <> keywords^ [index + 1].ordinal));

          IF new_keyword THEN
            new_line_desired := FALSE;

            IF (keywords^ [index].availability = clc$normal_usage_entry) AND (index = 1) THEN
              first_group_ordinal := keywords^ [index].ordinal;
              new_line_desired := TRUE;

            ELSEIF (keywords^ [index].availability = clc$advanced_usage_entry) AND
                  (keywords^ [index - 1].availability <> clc$advanced_usage_entry) THEN
              first_group_ordinal := keywords^ [index].ordinal;
              IF multi_line_format THEN
                indent_amount := previous_indent_amount;
                start_string;
              ELSE
                put_string (', ');
                set_break_position;
              IFEND;
              put_string ('advanced_key');
              IF multi_line_format THEN
                increment_indent (nesting_indentation);
              IFEND;
              new_line_desired := TRUE;

            ELSEIF (keywords^ [index].availability = clc$hidden_entry) AND
                  (keywords^ [index - 1].availability <> clc$hidden_entry) THEN
              first_group_ordinal := keywords^ [index].ordinal;
              IF multi_line_format THEN
                indent_amount := previous_indent_amount;
                start_string;
              ELSE
                put_string (', ');
                set_break_position;
              IFEND;
              put_string ('hidden_key');
              IF multi_line_format THEN
                increment_indent (nesting_indentation);
              IFEND;
              new_line_desired := TRUE;

            ELSEIF first_keyword_in_group OR ((string_size^ +2 + keyword_size) > max_string) THEN
              new_line_desired := TRUE;
            IFEND;

            IF NOT keyword_in_group THEN
              first_keyword_in_group := (keyword = 'key') OR (keyword = 'advanced_key') OR (keyword =
                    'hidden_key') OR (keyword = 'keyend');
              IF first_keyword_in_group THEN
                last_keyword_in_group := TRUE;
                new_line_desired := TRUE;
              IFEND;
            IFEND;

            IF multi_line_format AND new_line_desired THEN
              start_string;
            ELSEIF string_started THEN
              IF keywords^ [index].ordinal <> first_group_ordinal THEN
                put_string (', ');
              ELSE
                put_string (' ');
              IFEND;
              set_break_position;
            IFEND;

          ELSE
            put_string (', ');
            set_secondary_break_position;
          IFEND;

          IF first_keyword_in_group THEN
            put_string ('(');
          IFEND;

          put_string (keyword (1, keyword_size));

          IF last_keyword_in_group THEN
            put_string (')');
            IF multi_line_format THEN
              finish_string;
            IFEND;
          IFEND;
        FOREND /put_keys/;

        IF multi_line_format THEN
          indent_amount := previous_indent_amount;
          start_string;
        ELSE
          put_string (', ');
          set_break_position;
        IFEND;

        put_string ('keyend');

      PROCEND put_keyword_type;
?? TITLE := 'put_list_type', EJECT ??

      PROCEDURE put_list_type;

        VAR
          default_min_list_size: 0 .. 1,
          max_list_text: ^clt$expression_text,
          min_list_text: ^clt$expression_text,
          symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


        IF symbolic_qualifiers_work_area = NIL THEN
          min_list_text := NIL;
          max_list_text := NIL;
        ELSE
          NEXT symbolic_subrange_qualifier IN symbolic_qualifiers_work_area;
          IF symbolic_subrange_qualifier^.low_text_size = 0 THEN
            min_list_text := NIL;
          ELSE
            NEXT min_list_text: [symbolic_subrange_qualifier^.low_text_size] IN symbolic_qualifiers_work_area;
          IFEND;
          IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
            max_list_text := min_list_text;
          ELSE
            NEXT max_list_text: [symbolic_subrange_qualifier^.high_text_size] IN
                  symbolic_qualifiers_work_area;
          IFEND;
        IFEND;

        put_string ('list');

        IF type_description.list_rest THEN
          put_string (' rest');
        IFEND;

        IF include_implementation_info AND type_description.defer_expansion THEN
          put_string (' defer_expansion');
        IFEND;

        default_min_list_size := $INTEGER (parameter_type);

        IF (min_list_text <> NIL) OR (max_list_text <> NIL) OR
              (type_description.min_list_size <> default_min_list_size) OR
              (type_description.max_list_size <> clc$max_list_size) THEN
          put_string (' ');

          IF min_list_text <> NIL THEN
            put_string (min_list_text^);
          ELSEIF type_description.min_list_size = clc$max_list_size THEN
            put_string ('$max_list');
          ELSE
            put_integer (type_description.min_list_size);
          IFEND;

          put_string ('..');

          IF max_list_text <> NIL THEN
            put_string (max_list_text^);
          ELSEIF type_description.max_list_size = clc$max_list_size THEN
            put_string ('$max_list');
          ELSE
            put_integer (type_description.max_list_size);
          IFEND;
        IFEND;

        IF type_description.list_element_type_description <> NIL THEN
          put_string (' of ');
          set_break_position;
          put_type (FALSE, include_implementation_info, multi_line_format,
                type_description.list_element_type_description^);
        IFEND;

      PROCEND put_list_type;
?? TITLE := 'put_name_type', EJECT ??

      PROCEDURE put_name_type;

        VAR
          max_name_text: ^clt$expression_text,
          min_name_text: ^clt$expression_text,
          symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


        IF symbolic_qualifiers_work_area = NIL THEN
          min_name_text := NIL;
          max_name_text := NIL;
        ELSE
          NEXT symbolic_subrange_qualifier IN symbolic_qualifiers_work_area;
          IF symbolic_subrange_qualifier^.low_text_size = 0 THEN
            min_name_text := NIL;
          ELSE
            NEXT min_name_text: [symbolic_subrange_qualifier^.low_text_size] IN symbolic_qualifiers_work_area;
          IFEND;
          IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
            max_name_text := min_name_text;
          ELSE
            NEXT max_name_text: [symbolic_subrange_qualifier^.high_text_size] IN
                  symbolic_qualifiers_work_area;
          IFEND;
        IFEND;

        put_string ('name');

        IF (min_name_text <> NIL) OR (max_name_text <> NIL) OR (type_description.min_name_size > 1) OR
              (type_description.max_name_size < osc$max_name_size) THEN
          put_string (' ');

          IF min_name_text <> NIL THEN
            IF min_name_text <> max_name_text THEN
              put_string (min_name_text^);
            ELSE
              put_string ('1');
            IFEND;
          ELSEIF type_description.min_name_size = osc$max_name_size THEN
            put_string ('$max_name');
          ELSE
            put_integer (type_description.min_name_size);
          IFEND;

          put_string ('..');

          IF max_name_text <> NIL THEN
            put_string (max_name_text^);
          ELSEIF type_description.max_name_size = osc$max_name_size THEN
            put_string ('$max_name');
          ELSE
            put_integer (type_description.max_name_size);
          IFEND;
        IFEND;

      PROCEND put_name_type;
?? TITLE := 'put_range_type', EJECT ??

      PROCEDURE put_range_type;


        put_string ('range');

        IF type_description.range_element_type_description <> NIL THEN
          put_string (' of ');
          set_break_position;
          put_type (FALSE, include_implementation_info, multi_line_format,
                type_description.range_element_type_description^);
        IFEND;

      PROCEND put_range_type;
*IF NOT $true(osv$unix)
?? TITLE := 'put_real_type', EJECT ??

      PROCEDURE put_real_type;


        put_string ('real');

        IF (clp$longreal_classify (type_description.min_real_value.long_real) <>
              clc$real_negative_infinite) OR (clp$longreal_classify
              (type_description.max_real_value.long_real) <> clc$real_positive_infinite) THEN
          put_string (' ');

          put_real (type_description.min_real_value.long_real);

          put_string ('..');

          put_real (type_description.max_real_value.long_real);
        IFEND;

      PROCEND put_real_type;
*IFEND
?? TITLE := 'put_record_type', EJECT ??

      PROCEDURE put_record_type;

        VAR
          field_name: clt$field_name,
          index: clt$field_number,
          previous_indent_amount: clt$string_size;


        put_string ('record');

        IF multi_line_format THEN
          previous_indent_amount := indent_amount;
          increment_indent (nesting_indentation);
        IFEND;

        FOR index := 1 TO type_description.fields_pdt^.header^.number_of_parameters DO
          IF multi_line_format THEN
            start_string;
          ELSE
            IF index > 1 THEN
              put_string ('; ');
            ELSE
              put_string (' ');
            IFEND;
            set_break_position;
          IFEND;

          #TRANSLATE (osv$upper_to_lower, type_description.fields_pdt^.names^ [index].name, field_name);
          put_trimmed_string (field_name);
          put_string (': ');

          put_type (FALSE, include_implementation_info, multi_line_format,
                type_description.fields_pdt^.type_descriptions^ [index]);

          IF type_description.fields_pdt^.parameters^ [index].requirement = clc$optional_field THEN
            put_string (' = $optional');
          IFEND;
        FOREND;

        IF multi_line_format THEN
          indent_amount := previous_indent_amount;
          start_string;
        ELSE
          put_string ('; ');
          set_break_position;
        IFEND;

        put_string ('recend');

      PROCEND put_record_type;
?? TITLE := 'put_string_type', EJECT ??

      PROCEDURE put_string_type;

        VAR
          max_string_text: ^clt$expression_text,
          min_string_text: ^clt$expression_text,
          symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


        IF symbolic_qualifiers_work_area = NIL THEN
          min_string_text := NIL;
          max_string_text := NIL;
        ELSE
          NEXT symbolic_subrange_qualifier IN symbolic_qualifiers_work_area;
          IF symbolic_subrange_qualifier^.low_text_size = 0 THEN
            min_string_text := NIL;
          ELSE
            NEXT min_string_text: [symbolic_subrange_qualifier^.low_text_size] IN
                  symbolic_qualifiers_work_area;
          IFEND;
          IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
            max_string_text := min_string_text;
          ELSE
            NEXT max_string_text: [symbolic_subrange_qualifier^.high_text_size] IN
                  symbolic_qualifiers_work_area;
          IFEND;
        IFEND;

        put_string ('string');

        IF type_description.literal THEN
          put_string (' literal');
        IFEND;

        IF (min_string_text <> NIL) OR (max_string_text <> NIL) OR (type_description.min_string_size > 0) OR
              (type_description.max_string_size < clc$max_string_size) THEN
          put_string (' ');

          IF min_string_text <> NIL THEN
            put_string (min_string_text^);
          ELSEIF type_description.min_string_size = clc$max_string_size THEN
            put_string ('$max_string');
          ELSE
            put_integer (type_description.min_string_size);
          IFEND;

          IF (max_string_text <> min_string_text) OR (type_description.max_string_size <>
                type_description.min_string_size) THEN
            put_string ('..');

            IF max_string_text <> NIL THEN
              put_string (max_string_text^);
            ELSEIF type_description.max_string_size = clc$max_string_size THEN
              put_string ('$max_string');
            ELSE
              put_integer (type_description.max_string_size);
            IFEND;
          IFEND;
        IFEND;

      PROCEND put_string_type;
?? TITLE := 'put_union_type', EJECT ??

      PROCEDURE put_union_type;

        VAR
          index: clt$union_member_number,
          previous_indent_amount: clt$string_size;


        put_string ('any');

        IF (type_description.member_descriptions <> NIL) AND
              ((symbolic_qualifiers_work_area <> NIL) OR (NOT clp$type_desc_is_for_old_union
              (^type_description))) THEN
          put_string (' of');
          IF multi_line_format THEN
            previous_indent_amount := indent_amount;
            increment_indent (nesting_indentation);
          IFEND;

          FOR index := 1 TO UPPERBOUND (type_description.member_descriptions^) DO
            IF multi_line_format THEN
              start_string;
            ELSEIF index > 1 THEN
              put_string ('; ');
            ELSE
              put_string (' ');
            IFEND;
            set_break_position;
            put_type (parameter_type, include_implementation_info, multi_line_format,
                  type_description.member_descriptions^ [index]);
          FOREND;

          IF multi_line_format THEN
            indent_amount := previous_indent_amount;
            start_string;
          ELSE
            put_string ('; ');
            set_break_position;
          IFEND;

          put_string ('anyend');
        IFEND;

      PROCEND put_union_type;
?? OLDTITLE, EJECT ??

      VAR
        type_name: clt$type_name;


      IF (NOT parameter_type) AND (type_description.name <> NIL) THEN
        put_string ('"');
        #TRANSLATE (osv$upper_to_lower, type_description.name^, type_name);
        put_string (type_name (1, STRLENGTH (type_description.name^)));
        put_string ('" ');
      IFEND;

      CASE type_description.kind OF

      = clc$application_type =
        put_application_type;

      = clc$array_type =
        put_array_type;

      = clc$boolean_type =
        put_string ('boolean');

      = clc$cobol_name_type =
        put_string ('cobol_name');

      = clc$command_reference_type =
        put_string ('command_reference');

      = clc$data_name_type =
        put_string ('data_name');

      = clc$date_time_type =
        put_date_time_type;

      = clc$entry_point_reference_type =
        put_string ('entry_point_reference');

      = clc$file_type =
        put_string ('file');

      = clc$integer_type =
        put_integer_type;

      = clc$keyword_type =
        put_keyword_type;

      = clc$list_type =
        put_list_type;

      = clc$lock_type =
        put_string ('lock');

      = clc$name_type =
        put_name_type;

      = clc$program_name_type =
        put_string ('program_name');

      = clc$range_type =
        put_range_type;

*IF NOT $true(osv$unix)
      = clc$real_type =
        put_real_type;
*IFEND

      = clc$record_type =
        put_record_type;

      = clc$scu_line_identifier_type =
        put_string ('line_identifier');

      = clc$statistic_code_type =
        put_string ('statistic_code');

      = clc$status_type =
        put_string ('status');

      = clc$status_code_type =
        put_string ('status_code');

      = clc$string_type =
        put_string_type;

      = clc$string_pattern_type =
        put_string ('string_pattern');

      = clc$time_increment_type =
        put_string ('time_increment');

      = clc$time_zone_type =
        put_string ('time_zone');

      = clc$type_specification_type =
        put_string ('type');

      = clc$union_type =
        put_union_type;

      ELSE
        put_string ('UNRECOGNIZABLE_TYPE');
      CASEND;

    PROCEND put_type;
?? TITLE := 'put_type_identification', EJECT ??

    PROCEDURE put_type_identification
      (    value_kind: clt$data_kind);


      put_string ('"');
      put_trimmed_string (clv$type_kind_names [clv$value_type_kinds [value_kind]]);
      put_string ('"  ');

    PROCEND put_type_identification;
?? TITLE := 'set_break_position', EJECT ??

    PROCEDURE [INLINE] set_break_position;


      IF string_started THEN
        IF (representation_option = clc$data_source_representation) AND
              (string_size^ >= (STRLENGTH (string_ptr^) - continuation_size)) THEN
          break_string;
        ELSE
          break.index := string_size^;
          break.mark_continuation := (representation_option = clc$data_source_representation);
          break.indent := indent_amount;
          break_pending := TRUE;
        IFEND;
      IFEND;

    PROCEND set_break_position;
?? TITLE := 'set_indent_amount', EJECT ??

    PROCEDURE [INLINE] set_indent_amount;


      IF string_started THEN
        IF string_size^ <= (STRLENGTH (string_ptr^) DIV 2) THEN
          indent_amount := string_size^;
        ELSE
          indent_amount := STRLENGTH (string_ptr^) DIV 2;
        IFEND;
      ELSE
        indent_amount := initial_indentation;
      IFEND;

    PROCEND set_indent_amount;
?? TITLE := 'set_secondary_break_position', EJECT ??

    PROCEDURE [INLINE] set_secondary_break_position;


      IF string_started THEN
        secondary_break.index := string_size^;
        secondary_break.mark_continuation := (representation_option = clc$data_source_representation);
        secondary_break.indent := indent_amount;
        secondary_break_pending := TRUE;
      IFEND;

    PROCEND set_secondary_break_position;
?? TITLE := 'set_up_local_work_area', EJECT ??

    PROCEDURE set_up_local_work_area;


*IF NOT $true(osv$unix)
      IF local_work_area.sequence_pointer = NIL THEN
        mmp$create_scratch_segment (amc$sequence_pointer, mmc$as_random, local_work_area, status);
        IF NOT status.normal THEN
          local_work_area.sequence_pointer := NIL;
          EXIT clp$internal_convert_to_string;
        IFEND;
      IFEND;
*ELSE
      IF local_work_area = NIL THEN
        ALLOCATE local_work_area: [[REP 1000000(16) OF cell]];
        RESET local_work_area;
      IFEND;
*IFEND

    PROCEND set_up_local_work_area;
?? TITLE := 'start_representation', EJECT ??

    PROCEDURE start_representation;


      data_representation := NIL;

      NEXT string_count IN work_area;
      IF string_count = NIL THEN
        work_area_overflow;
      IFEND;
      string_count^ := 0;

      space_remaining := #SIZE (work_area^) - i#current_sequence_position (work_area);

      string_started := FALSE;

    PROCEND start_representation;
?? TITLE := 'start_string', EJECT ??

    PROCEDURE start_string;

      VAR
        size: clt$string_size;


      IF string_started THEN
        finish_string;
      IFEND;

      IF space_remaining <= #SIZE (clt$string_size) THEN
        work_area_overflow;
      IFEND;
      NEXT string_size IN work_area;
      space_remaining := space_remaining - #SIZE (clt$string_size);

      IF max_string <= space_remaining THEN
        size := max_string;
      ELSE
        size := space_remaining;
        indent_amount := initial_indentation;
      IFEND;
      NEXT string_ptr: [size] IN work_area;

      string_size^ := indent_amount;
      string_ptr^ (1, indent_amount) := '';

      break_pending := FALSE;
      break.index := 0;
      secondary_break_pending := FALSE;
      secondary_break.index := 0;

      string_count^ := string_count^ +1;
      string_started := TRUE;
      string_may_be_trimmed := TRUE;

    PROCEND start_string;
?? TITLE := 'work_area_overflow', EJECT ??

    PROCEDURE work_area_overflow;


      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
      EXIT clp$internal_convert_to_string;

    PROCEND work_area_overflow;
?? OLDTITLE, EJECT ??

    status.normal := TRUE;

    IF (request.kind = clc$convert_data_value) AND ((request.representation_option <
          LOWERVALUE (clt$data_representation_option)) OR (request.representation_option >
          UPPERVALUE (clt$data_representation_option))) THEN
      osp$set_status_abnormal ('CL', cle$bad_data_rep_option, '', status);
      RETURN;
    IFEND;

    IF request.max_string < 3 THEN
      osp$set_status_abnormal ('CL', cle$string_too_short, '', status);
      RETURN;
    IFEND;

    comma := ', ';
    left_parenthesis := '(';
    space := ' ';

    initial_indentation := request.initial_indentation;
    indent_amount := initial_indentation;
    continuation_indentation := request.continuation_indentation;
    max_string := request.max_string;
    include_advanced_items := request.include_advanced_items;
    include_hidden_items := request.include_hidden_items;

    colon_indent := initial_indentation;
    first_pass := TRUE;
    label_indent_limit := (max_string DIV 2) - 2;
    level_of_nesting := 0;

    start_representation;

*IF NOT $true(osv$unix)
    local_work_area.kind := amc$sequence_pointer;
    local_work_area.sequence_pointer := NIL;
*ELSE
    local_work_area := NIL;
*IFEND
    convert_to_lower_case := FALSE;

*IF $true(osv$unix)
    handler_established := #establish_condition_handler (-1, ^abort_handler);
*ELSE
    osp$establish_condition_handler (^abort_handler, TRUE);
*IFEND

    CASE request.kind OF

    = clc$convert_data_value =
      representation_option := request.representation_option;
      convert_to_lower_case := (representation_option = clc$labeled_elem_representation) OR
            (representation_option = clc$compressed_labeled_elem_rep) OR
            (representation_option = clc$display_elem_representation) OR
            (representation_option = clc$display_srce_representation);
      IF representation_option = clc$display_elem_representation THEN
        representation_option := clc$data_elem_representation;
      ELSEIF representation_option = clc$display_srce_representation THEN
        representation_option := clc$data_source_representation;
      IFEND;
      multi_line_format := representation_option <> clc$data_source_representation;
      symbolic_qualifiers_work_area := NIL;
      convert_value_to_string (request.value);

*IF NOT $true(osv$unix)
    = clc$convert_type_description =
      multi_line_format := request.multi_line_type_format;
      representation_option := clc$data_source_representation;
      symbolic_qualifiers_work_area := request.symbolic_type_qualifiers_area;
      put_type (FALSE, TRUE, multi_line_format, request.type_description^);
*IFEND

    = clc$convert_unbundled_pdt =
      multi_line_format := request.multi_line_pdt_format;
      representation_option := clc$data_source_representation;
      symbolic_qualifiers_work_area := request.symbolic_pdt_qualifiers_area;
      put_pdt (multi_line_format, request.parameter_starts_line, request.individual_parameter,
            request.individual_parameter_number, request.include_header, request.include_implementation_info,
            request.command_or_function_name, request.aliases, request.availability,
            request.command_or_function_scope, request.pdt^, request.pvt);

*IF NOT $true(osv$unix)
    = clc$convert_old_pdt =
      multi_line_format := request.multi_line_old_pdt_format;
      representation_option := clc$data_source_representation;
      symbolic_qualifiers_work_area := NIL;
      put_old_pdt (multi_line_format, request.proc_or_pdt, request.proc_names^, request.old_pdt,
            request.symbolic_parameters);

    = clc$convert_parameters =
      multi_line_format := FALSE;
      representation_option := clc$data_source_representation;
      symbolic_qualifiers_work_area := NIL;
      put_evaluated_parameters (request.initial_text, request.include_secure_parameters,
            request.evaluated_pdt^, request.evaluated_pvt, request.parameter_substitutions);

*IFEND
    ELSE
      ;
    CASEND;

*IF NOT $true(osv$unix)
    IF local_work_area.sequence_pointer <> NIL THEN
      mmp$delete_scratch_segment (local_work_area, local_status);
      local_work_area.sequence_pointer := NIL;
      IF status.normal AND (NOT local_status.normal) THEN
        status := local_status;
      IFEND;
    IFEND;
*ELSE
    IF local_work_area <> NIL THEN
      FREE local_work_area;
    IFEND;
*IFEND

*IF $true(osv$unix)
    IF handler_established THEN
      handler_established := NOT #disestablish_condition_handler (-1);
    IFEND;
*ELSE
    osp$disestablish_cond_handler;
*IFEND

    IF NOT status.normal THEN
      EXIT clp$internal_convert_to_string;
    IFEND;

    finish_representation;

  PROCEND clp$internal_convert_to_string;

MODEND clm$convert_to_string;
