?? RIGHT := 110 ??
?? NEWTITLE := 'MODULE nfm$qtf_server' ??
MODULE nfm$qtf_server;

{  The following table describes the initialization of the job submission option values.
{  The hierarchy of the values are from top (highest) to bottom (lowest).  If the submission
{  option is not defined in any of the values for that option or blank, that submission
{  option is not specified for the submit_job interface.

*copyc nfh$qtf_subj_options

{  The following table describes the initialization of the output submission option values.
{  The hierarchy of the values are from top (highest) to bottom (lowest).  If the submission
{  option is not defined in any of the values for that option or blank, that submission
{  option is not specified for the print_file interface.

*copyc nfh$qtf_prif_options

?? NEWTITLE := 'Global References', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc amt$local_file_name
*copyc jmt$qfile_attribute_keys
*copyc clt$parameter_list
*copyc cle$ecc_variable
*copyc clt$command_line_size
*copyc clt$file
*copyc fst$path
*copyc nfc$external_characteristic_a9
*copyc nfc$normal_string
*copyc nfc$parameter_00_definitions
*copyc nfc$parameter_01_definitions
*copyc nfc$parameter_02_definitions
*copyc nfc$parameter_03_definitions
*copyc nfc$parameter_04_definitions
*copyc nfc$parameter_05_definitions
*copyc nfc$parameter_06_definitions
*copyc nfc$parameter_07_definitions
*copyc nfc$parameter_08_definitions
*copyc nfc$parameter_09_definitions
*copyc nfc$parameter_10_definitions
*copyc nfc$parameter_11_definitions
*copyc nfc$parameter_12_definitions
*copyc nfc$parameter_13_definitions
*copyc nfc$parameter_16_definitions
*copyc nfc$parameter_17_definitions
*copyc nfc$parameter_20_definitions
*copyc nfc$parameter_21_definitions
*copyc nfc$parameter_22_definitions
*copyc nfc$parameter_24_definitions
*copyc nfc$parameter_25_definitions
*copyc nfc$parameter_26_definitions
*copyc nfc$parameter_27_definitions
*copyc nfc$parameter_28_definitions
*copyc nfc$parameter_29_definitions
*copyc nfc$parameter_30_definitions
*copyc nfc$parameter_31_definitions
*copyc nfc$parameter_32_definitions
*copyc nfc$parameter_33_definitions
*copyc nfc$parameter_90_definitions
*copyc nfc$parameter_91_definitions
*copyc nfc$parameter_92_definitions
*copyc nfc$parameter_93_definitions
*copyc nfc$parameter_94_definitions
*copyc nfc$parameter_95_definitions
*copyc nfc$parameter_96_definitions
*copyc nfc$parameter_97_definitions
*copyc nfc$parameter_98_definitions
*copyc nfc$parameter_99_definitions
*copyc nfc$qtf_name_constants
*copyc osc$queue_transfer_client
*copyc osc$queue_transfer_server
*copyc nfe$batch_transfer_services
*copyc nfe$queue_file_transfer_fac
*copyc nft$control_block
*copyc nft$lcn_application_names
*copyc nft$nam_application_names
*copyc nft$parameter_03_netvalues
*copyc nft$parameter_set
*copyc nft$qtf_input_accounting_data
*copyc nft$required_param_on_command
*copyc nft$store_forward_file_info
*copyc nft$task_queue
*copyc nft$transfer_modes
*copyc ost$name
*copyc ost$user_identification
*copyc osv$lower_to_upper
*copyc rfe$condition_codes
*copyc rft$external_interface
?? POP ??
*copyc amp$change_file_attributes
*copyc amp$return
*copyc clp$convert_string_to_integer
*copyc clp$count_list_elements
*copyc clp$evaluate_parameters
*copyc clp$pop_parameters
*copyc clp$push_parameters
*copyc clp$read_variable
*copyc clp$trimmed_string_size
*copyc fsp$close_file
*copyc fsp$copy_file
*copyc fsp$open_file
*copyc jmp$emit_communication_stat
*copyc jmp$get_attribute_defaults
*copyc jmp$print_file
*copyc jmp$submit_job
*copyc jmp$submit_qfile
*copyc nap$detach_server_application
*copyc nap$store_attributes
*copyc nfp$close_store_forward_file
*copyc nfp$create_wait_queue_file_name
*copyc nfp$deallocate_dirs_from_head
*copyc nfp$dequeue_directives_on_list
*copyc nfp$enqueue_status_directive
*copyc nfp$enqueue_task
*copyc nfp$format_message_to_job_log
*copyc nfp$get_new_application_name
*copyc nfp$get_new_destination_name
*copyc nfp$get_new_source_name
*copyc nfp$get_server_asynch_event
*copyc nfp$initialize_control_block
*copyc nfp$open_store_forward_file
*copyc nfp$receive_command
*copyc nfp$receive_queue_file
*copyc nfp$send_command
*copyc nfp$set_abnormal_if_normal
*copyc nfp$terminate_path
*copyc nfp$verify_family
*copyc nlp$end_title_translation
*copyc nlp$get_title_translation
*copyc nlp$translate_title
*copyc osp$set_status_abnormal
*copyc osp$set_status_from_condition
*copyc pmp$disestablish_cond_handler
*copyc pmp$establish_condition_handler
*copyc pmp$execute
*copyc pmp$get_program_description
*copyc pmp$get_program_size
*copyc pmp$get_unique_name
*copyc pmp$log
*copyc rfp$application_sign_off
*copyc rfp$get_local_host_physical_id
*copyc rfp$return_lid_type
*copyc rfp$store
*copyc nfv$lcn_application_names
*copyc nfv$nam_application_names
*copyc nfv$parameter_17_values
*copyc nfv$parameter_31_values
*copyc nfv$p04_values
*copyc nfv$qtf_parameter_rules
*copyc nfv$qtf_required_params_on_cmds
?? TITLE := 'Global Declarations', EJECT ??
  CONST
    maximum_size_qtfs_scl_command = 256,
    user_job_name_prefix = '#';

  TYPE
    nft$qtfs_task_switch_params = record
      path_info: nft$network_connection,
      network_file: ost$name,
      local_pid: host_pid_type,
      store_forward_file_name: amt$local_file_name,
      charge_prefix_character: string (1),
      project_prefix_character: string (1),
    recend;

  TYPE
    nft$queue_file_type = (nfc$print_queue_file, nfc$job_queue_file, nfc$generic_queue_file);

  TYPE
    nft$input_queue_attributes = (nfc$iqa_comment_banner, nfc$iqa_control_family, nfc$iqa_control_user,
          nfc$iqa_copies, nfc$iqa_cpu_time_limit, nfc$iqa_data_declaration, nfc$iqa_data_mode,
          nfc$iqa_default_login_family, nfc$iqa_device, nfc$iqa_disposition_code, nfc$iqa_earliest_print_time,
          nfc$iqa_earliest_run_time, nfc$iqa_external_characteristic, nfc$iqa_forms_code,
          nfc$iqa_implicit_routing_text, nfc$iqa_job_abort_disposition, nfc$iqa_job_class,
          nfc$iqa_job_deferred_by_user, nfc$iqa_job_destination, nfc$iqa_job_destination_usage,
          nfc$iqa_job_execution_ring, nfc$iqa_job_input_device, nfc$iqa_job_priority,
          nfc$iqa_job_qualifier_list, nfc$iqa_job_recovery_dispositon, nfc$iqa_latest_print_time,
          nfc$iqa_latest_run_time, nfc$iqa_login_account, nfc$iqa_login_command_supplied,
          nfc$iqa_login_family, nfc$iqa_login_password, nfc$iqa_login_project, nfc$iqa_login_user,
          nfc$iqa_magnetic_tape_limit, nfc$iqa_maximum_working_set, nfc$iqa_null_attribute,
          nfc$iqa_operator_family, nfc$iqa_operator_user, nfc$iqa_origin_application_name,
          nfc$iqa_output_destination, nfc$iqa_output_dest_usage, nfc$iqa_output_disposition,
          nfc$iqa_purge_delay, nfc$iqa_remote_host_directive, nfc$iqa_routing_banner,
          nfc$iqa_source_logical_id, nfc$iqa_sru_limit, nfc$iqa_station, nfc$iqa_system_job_name,
          nfc$iqa_system_routing_text, nfc$iqa_user_information, nfc$iqa_user_job_name,
          nfc$iqa_vertical_print_density, nfc$iqa_vfu_load_procedure);

  TYPE
    nft$input_queue_attributes_set = set of nft$input_queue_attributes;

  TYPE
    nft$output_queue_attributes = (nfc$oqa_comment_banner, nfc$oqa_control_family, nfc$oqa_control_user,
          nfc$oqa_copies, nfc$oqa_data_declaration, nfc$oqa_data_mode, nfc$oqa_device, nfc$oqa_device_type,
          nfc$oqa_disposition_code, nfc$oqa_earliest_print_time, nfc$oqa_external_characteristic,
          nfc$oqa_forms_code, nfc$oqa_implicit_routing_text, nfc$oqa_latest_print_time, nfc$oqa_login_account,
          nfc$oqa_login_family, nfc$oqa_login_project, nfc$oqa_login_user, nfc$oqa_null_attribute,
          nfc$oqa_operator_family, nfc$oqa_operator_user, nfc$oqa_origin_application_name,
          nfc$oqa_output_class, nfc$oqa_output_deferred_by_user, nfc$oqa_output_destination,
          nfc$oqa_output_dest_usage, nfc$oqa_output_disposition, nfc$oqa_output_priority,
          nfc$oqa_page_width,
          nfc$oqa_purge_delay, nfc$oqa_remote_host_directive, nfc$oqa_routing_banner,
          nfc$oqa_source_logical_id,
          nfc$oqa_station, nfc$oqa_system_file_name, nfc$oqa_system_routing_text, nfc$oqa_user_file_name,
          nfc$oqa_user_information, nfc$oqa_user_job_name, nfc$oqa_vertical_print_density,
          nfc$oqa_vfu_load_procedure);

  TYPE
    nft$output_queue_attributes_set = set of nft$output_queue_attributes;

  TYPE
    nft$generic_queue_attributes = (nfc$gqa_application_name, nfc$gqa_deferred_by_application,
          nfc$gqa_destination, nfc$gqa_earliest_run_time, nfc$gqa_latest_run_time, nfc$gqa_purge_delay,
          nfc$gqa_remote_host_directive);

  TYPE
    nft$generic_attributes_set = set of nft$generic_queue_attributes;

  TYPE
    nft$queue_submission_option = record
      case queue_file_type: nft$queue_file_type of
      = nfc$print_queue_file =
        output_submission_option: array [nft$output_queue_attributes] of jmt$output_submission_option,
      = nfc$job_queue_file =
        job_submission_option: array [nft$input_queue_attributes] of jmt$job_submission_option,
      = nfc$generic_queue_file =
        qfile_submission_option: array [nft$generic_queue_attributes] of jmt$qfile_submission_option,
      casend,
    recend;

  TYPE
    host_pid_type = record
      size: 0 .. osc$max_name_size,
      value: ost$name,
    recend;

  TYPE
    qtfs_input_accounting_data = record
      case boolean OF
      = FALSE =
        data_string: jmt$job_input_device,
      = TRUE =
        size: 0 .. jmc$job_input_device_size,
        data_block: nft$qtf_input_accounting_data,
      casend,
    recend;

  TYPE
    wait_queue_information = record
      case use_wait_queue: boolean OF
      = FALSE =
        ,
      = TRUE =
        wait_queue_file_name: amt$local_file_name,
      casend,
    recend;

  VAR
    nfv$qtf_send_p03_values: [STATIC, READ, XDCL] nft$parameter_03_netvalues :=
          [[], [nfc$ss_ack_required], []];

  VAR
    job_qualifier_list: [STATIC] array [1 .. jmc$maximum_job_qualifiers] of ost$name;

  VAR
    output_disposition_path: [STATIC] fst$path;

  VAR
    output_implicit_routing_text: [STATIC] jmt$implicit_routing_text;

  VAR
    output_purge_delay: [STATIC] jmt$time_increment;

  VAR
    output_remote_host_directive: [STATIC] jmt$remote_host_directive;

  VAR
    output_system_routing_text: [STATIC] jmt$system_routing_text;

  VAR
    output_user_information: [STATIC] jmt$user_information;

  VAR
    charge_prefix_character: [STATIC] string(1),
    project_prefix_character: [STATIC] string(1);

?? TITLE := 'nfp$qtfs_boot', EJECT ??

{ PURPOSE:
{   This is the starting procedure for the QTF server.
{   This procedure will receive all incoming QTFS connections for processing.
{   This processing is done by boot initiated tasks whose function is to
{   receive the queue files.  If for any reason the service task cannot be
{   executed, the connection will be terminated.

  PROCEDURE [XDCL] nfp$qtfs_boot
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE qtfs_boot_pdt (
{   host_physical_identifier, hpi: string 1..31 = $required
{   account_prefix_character, apc: (BY_NAME, ADVANCED) name 1..1 = A
{   project_prefix_character, ppc: (BY_NAME, ADVANCED) name 1..1 = P
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 7] of clt$pdt_parameter_name,
      parameters: array [1 .. 4] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
        default_value: string (1),
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
        default_value: string (1),
      recend,
      type4: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [91, 8, 17, 15, 13, 19, 593],
    clc$command, 7, 4, 1, 2, 0, 0, 4, ''], [
    ['ACCOUNT_PREFIX_CHARACTER       ',clc$nominal_entry, 2],
    ['APC                            ',clc$abbreviation_entry, 2],
    ['HOST_PHYSICAL_IDENTIFIER       ',clc$nominal_entry, 1],
    ['HPI                            ',clc$abbreviation_entry, 1],
    ['PPC                            ',clc$abbreviation_entry, 3],
    ['PROJECT_PREFIX_CHARACTER       ',clc$nominal_entry, 3],
    ['STATUS                         ',clc$nominal_entry, 4]],
    [
{ PARAMETER 1
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$required_parameter, 0
  , 0],
{ PARAMETER 2
    [1, clc$advanced_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5,
  clc$optional_default_parameter, 0, 1],
{ PARAMETER 3
    [6, clc$advanced_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5,
  clc$optional_default_parameter, 0, 1],
{ PARAMETER 4
    [7, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$string_type], [1, 31, FALSE]],
{ PARAMETER 2
    [[1, 0, clc$name_type], [1, 1],
    'A'],
{ PARAMETER 3
    [[1, 0, clc$name_type], [1, 1],
    'P'],
{ PARAMETER 4
    [[1, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$host_physical_identifier = 1,
      p$account_prefix_character = 2,
      p$project_prefix_character = 3,
      p$status = 4;

    VAR
      pvt: array [1 .. 4] of clt$parameter_value;

    VAR
      control_block: nft$control_block,
      host_pid: host_pid_type,
      ignore_status: ost$status,
      lcn_boot: boolean,
      nam_boot: boolean,
      network_file_name: ost$name,
      number_of_libraries: pmt$number_of_libraries,
      number_of_modules: pmt$number_of_modules,
      number_of_objects: pmt$number_of_object_files,
      parameter_block: SEQ (REP 1 of nft$qtfs_task_switch_params),
      parameter_pointer: ^nft$qtfs_task_switch_params,
      program_attributes: ^pmt$program_attributes,
      program_description: ^pmt$program_description,
      program_parameters: ^pmt$program_parameters,
      qtfs_conditions: pmt$condition,
      qtfs_condition_descriptor: pmt$established_handler,
      qtfs_task_queue: nft$task_queue,
      store_forward_file_info: nft$store_forward_file_info,
      task_id: pmt$task_id,
      task_status: pmt$task_status;

    VAR
      lcn_application_names: [STATIC, READ, XREF] nft$lcn_application_names;

    VAR
      nam_application_names: [STATIC, READ, XREF] nft$nam_application_names;

    VAR
      qtfs_parameter_rules: [STATIC, READ, XREF] nft$parameter_rules_array;

?? NEWTITLE := 'qtfs_boot_condition_handler', EJECT ??

    PROCEDURE qtfs_boot_condition_handler
      (    condition: pmt$condition;
           condition_desc: ^pmt$condition_information;
           save_area: ^ost$stack_frame_save_area;
       VAR trap_status: ost$status);

      VAR
        condition_handler_status: ost$status,
        local_status: ost$status;

      IF store_forward_file_info.file_open THEN
        nfp$close_store_forward_file (store_forward_file_info, local_status);
      IFEND;

      IF control_block.path.path_connected THEN
        nfp$terminate_path (control_block.application, TRUE, control_block.path, condition_handler_status);
      IFEND;
      rfp$application_sign_off (nfv$lcn_application_names [control_block.application],
            condition_handler_status);
      nap$detach_server_application (nfv$nam_application_names [control_block.application],
            condition_handler_status);
      osp$set_status_from_condition (nfc$status_id, condition, save_area, local_status,
            condition_handler_status);
      IF condition_handler_status.normal THEN
        pmp$log ('QTFS boot task terminating', condition_handler_status);
        nfp$format_message_to_job_log (local_status);
      ELSE
        pmp$log ('QTFS boot task terminating', local_status);
        nfp$format_message_to_job_log (condition_handler_status);
      IFEND;

    PROCEND qtfs_boot_condition_handler;
?? OLDTITLE, EJECT ??
    status.normal := TRUE;
    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      nfp$format_message_to_job_log (status);
      RETURN;
    IFEND;

    #translate (osv$lower_to_upper, pvt [p$host_physical_identifier].value^.string_value^, host_pid.value);
    host_pid.size := strlength (host_pid.value);

    lcn_boot := FALSE;
    nam_boot := FALSE;
    qtfs_task_queue.head := NIL;
    qtfs_task_queue.tail := NIL;
    qtfs_task_queue.number_of_tasks := 0;
    store_forward_file_info.file_open := FALSE;
    nfp$initialize_control_block (nfc$application_qtfs, nfc$p31_unspecified,
          nfv$qtf_send_p03_values [nfc$network_nam], nfv$qtf_send_p03_values [nfc$network_nam],
          nfv$qtf_send_p03_values [nfc$network_nam], nfc$p00_a102, nfc$take, ^nfv$qtf_parameter_rules,
          control_block);
    control_block.local_host_type := nfc$p22_nos_ve_qtf;

    qtfs_conditions.selector := pmc$condition_combination;
    qtfs_conditions.combination := $pmt$condition_combination
          [mmc$segment_access_condition, pmc$block_exit_processing];
    pmp$establish_condition_handler (qtfs_conditions, ^qtfs_boot_condition_handler,
          ^qtfs_condition_descriptor, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

{     Get description of the QTFS service task.  This description will be
{     used every time the task is executed.

    pmp$get_program_size (number_of_objects, number_of_modules, number_of_libraries, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    PUSH program_description: [[REP (#SIZE (pmt$program_attributes) +
          (number_of_objects * #SIZE (amt$local_file_name)) + (number_of_modules *
          #SIZE (pmt$program_name)) + (number_of_libraries * #SIZE (amt$local_file_name))) OF cell]];
    pmp$get_program_description (program_description^, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    RESET program_description;
    NEXT program_attributes IN program_description;
    program_attributes^.contents := program_attributes^.contents +
          $pmt$prog_description_contents [pmc$starting_proc_specified, pmc$term_error_level_specified];
    program_attributes^.starting_procedure := 'NFP$QTFS_SERVICE_TASK';
    program_attributes^.termination_error_level := pmc$fatal_load_errors;
    ALLOCATE control_block.path.network_file: [STRLENGTH (network_file_name)];

{ attach the STORE_FORWARD_NETWORK file and if the returned status is bad ignore it
{ because the file probably does not exist therefore we will not use the store/forward information

    nfp$open_store_forward_file (TRUE, store_forward_file_info, ignore_status);

{     MAIN loop

  /get_incoming_connections/
    WHILE TRUE DO

{     Get network path name

      pmp$get_unique_name (network_file_name, status);
      IF NOT status.normal THEN
        IF store_forward_file_info.file_open THEN
          nfp$close_store_forward_file (store_forward_file_info, ignore_status);
        IFEND;
        RETURN;
      IFEND;
      control_block.path.network_file^ := network_file_name;
      control_block.path.application_sequence_number := control_block.path.application_sequence_number + 1;

{     Get network connection (and handle application sign on to RHFAM, NAM).

      nfp$get_server_asynch_event (control_block.application, control_block.path, lcn_boot, nam_boot,
            qtfs_task_queue, status);
      IF NOT status.normal THEN
        IF store_forward_file_info.file_open THEN
          nfp$close_store_forward_file (store_forward_file_info, ignore_status);
        IFEND;
        RETURN;
      IFEND;

{     Build parameters for service task

      program_parameters := ^parameter_block;
      RESET program_parameters;
      NEXT parameter_pointer IN program_parameters;
      parameter_pointer^.path_info := control_block.path;
      parameter_pointer^.network_file := control_block.path.network_file^;
      parameter_pointer^.local_pid := host_pid;
      parameter_pointer^.store_forward_file_name := store_forward_file_info.local_file_name;
      parameter_pointer^.charge_prefix_character := pvt [p$account_prefix_character].value^.name_value;
      parameter_pointer^.project_prefix_character := pvt [p$project_prefix_character].value^.name_value;
      RESET program_parameters;

{     Now we have a connection, execute the service task

      pmp$execute (program_description^, program_parameters^, osc$nowait, task_id, task_status, status);
      IF status.normal THEN
        nfp$enqueue_task (task_id, control_block.path, qtfs_task_queue);
        control_block.path.path_connected := FALSE;
      ELSE
        {** Disconnect path **}
        IF control_block.path.path_connected THEN
          nfp$terminate_path (control_block.application, FALSE, control_block.path, status);
        IFEND;
      IFEND;
    WHILEND /get_incoming_connections/;

    IF store_forward_file_info.file_open THEN
      nfp$close_store_forward_file (store_forward_file_info, ignore_status);
    IFEND;

  PROCEND nfp$qtfs_boot;
?? TITLE := 'nfp$qtfs_service_task', EJECT ??

{ PURPOSE:
{   This is the entry procedure for the QTFS job generation task.
{   This task is executed by the "BOOT" to build the user QTFS job.
{   The job is then submitted for batch execution.  If the user
{   job fails, this task completes the protocol.

  PROCEDURE [XDCL] nfp$qtfs_service_task
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

?? NEWTITLE := 'qtfs_condition_handler', EJECT ??

    PROCEDURE qtfs_condition_handler
      (    condition: pmt$condition;
           condition_desc: ^pmt$condition_information;
           save_area: ^ost$stack_frame_save_area;
       VAR trap_status: ost$status);

      VAR
        condition_handler_status: ost$status,
        local_status: ost$status;

      amp$return (control_block.file_name, local_status);
      IF control_block.path.path_connected THEN
        nfp$terminate_path (control_block.application, FALSE, control_block.path, condition_handler_status);
      IFEND;

      osp$set_status_from_condition (nfc$status_id, condition, save_area, local_status,
            condition_handler_status);
      IF condition_handler_status.normal THEN
        pmp$log ('QTFS service task terminating', condition_handler_status);
        nfp$format_message_to_job_log (local_status);
      IFEND;

    PROCEND qtfs_condition_handler;
?? OLDTITLE, EJECT ??

    VAR
      control_block: nft$control_block,
      ignore_status: ost$status,
      host_pid: host_pid_type,
      initiated_job_system_name: jmt$system_supplied_name,
      nam_attributes: ^nat$change_attributes,
      network_file_name: ost$name,
      parameter_sequence: ^clt$parameter_list,
      parameter_value: ^nft$qtfs_task_switch_params,
      qtfs_conditions: pmt$condition,
      qtfs_condition_descriptor: pmt$established_handler,
      rhfam_attributes: ^rft$change_attributes,
      rhfam_physical_id: rft$physical_identifier,
      store_forward_file_name: amt$local_file_name;

    VAR
      qtf_parameter_rules: [STATIC, READ, XREF] nft$parameter_rules_array;

    status.normal := TRUE;
    nfp$initialize_control_block (nfc$application_qtfs, nfc$p31_unspecified,
          nfv$qtf_send_p03_values [nfc$network_nam], nfv$qtf_send_p03_values [nfc$network_nam],
          nfv$qtf_send_p03_values [nfc$network_nam], nfc$p00_a102, nfc$take, ^nfv$qtf_parameter_rules,
          control_block);
    control_block.local_host_type := nfc$p22_nos_ve_qtf;

{     Get task parameters and open connection

    parameter_sequence := ^parameter_list;
    RESET parameter_sequence;
    NEXT parameter_value IN parameter_sequence;
    control_block.path := parameter_value^.path_info;
    host_pid := parameter_value^.local_pid;
    store_forward_file_name := parameter_value^.store_forward_file_name;
    charge_prefix_character := parameter_value^.charge_prefix_character;
    project_prefix_character := parameter_value^.project_prefix_character;
    RESET parameter_sequence;
    PUSH control_block.path.network_file: [STRLENGTH (network_file_name)];
    control_block.path.network_file^ := parameter_value^.network_file;

{     Set up condition handler

    qtfs_conditions.selector := pmc$condition_combination;
    qtfs_conditions.combination := $pmt$condition_combination
          [mmc$segment_access_condition, pmc$block_exit_processing];
    pmp$establish_condition_handler (qtfs_conditions, ^qtfs_condition_handler, ^qtfs_condition_descriptor,
          status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    fsp$open_file (control_block.path.network_file^, amc$record, NIL, { File attachment options
    NIL, { Default creation opts
    NIL, { Mandated creation opts
    NIL, { Attribute validation
    NIL, { Attribute override
    control_block.path.network_file_id, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

{     Set up default network time outs

    CASE control_block.path.network_type OF
    = nfc$network_nam =
      PUSH nam_attributes: [1 .. 1];
      nam_attributes^ [1].kind := nac$data_transfer_timeout;
      nam_attributes^ [1].data_transfer_timeout := control_block.time_out * nfc$milliseconds;
      nap$store_attributes (control_block.path.network_file_id, nam_attributes^, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      control_block.transfer_pid_length := host_pid.size;
      control_block.transfer_pid := host_pid.value;
    = nfc$network_lcn =
      PUSH rhfam_attributes: [1 .. 1];
      rhfam_attributes^ [1].key := rfc$data_transfer_timeout;
      rhfam_attributes^ [1].data_transfer_timeout := control_block.time_out * nfc$milliseconds;
      rfp$store (control_block.path.network_file_id, rhfam_attributes^, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      rfp$get_local_host_physical_id (rhfam_physical_id, status);
      IF status.normal THEN
        control_block.transfer_pid_length := STRLENGTH (rhfam_physical_id);
        control_block.transfer_pid := rhfam_physical_id;
      ELSE
        RETURN;
      IFEND;
      control_block.required_facilities := $nft$parameter_03_value_set [];
      control_block.transfer_facilities := $nft$parameter_03_value_set [];
    ELSE
      osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
            'nfp$qtfs_service_task - bad network type', status);
      RETURN;
    CASEND;

{     Begin A-A protocol }

    qtfs_a_to_a_protocol (store_forward_file_name, control_block, status);
    IF NOT status.normal THEN
      pmp$log ('QTFS A to A protocol phase returned an abnormal status of', ignore_status);
      nfp$format_message_to_job_log (status);
    IFEND;

    IF control_block.path.path_connected THEN
      nfp$terminate_path (control_block.application, FALSE, control_block.path, ignore_status);
    IFEND;
    pmp$disestablish_cond_handler (qtfs_conditions, ignore_status);

  PROCEND nfp$qtfs_service_task;
?? TITLE := 'analyze_received_rft', EJECT ??

{ PURPOSE:
{   This procedure will check the received RFT for protocol attributes
{   which require initialization or action.  Then it calls a procedure
{   to establish the attributes for the incoming queue file.

  PROCEDURE analyze_received_rft
    (    received_parameters: nft$parameter_set;
         store_forward_file_name: amt$local_file_name;
     VAR control_block: nft$control_block;
     VAR transfer_mode: nft$transfer_modes;
     VAR store_and_forward_queue_file: boolean;
     VAR rpos_parameters: nft$parameter_set;
     VAR queue_file_attributes: nft$queue_submission_option;
     VAR queue_file_type: nft$queue_file_type;
     VAR loop_back_transfer: boolean;
     VAR input_accounting_data: qtfs_input_accounting_data;
     VAR overridden_jad_odu: boolean;
     VAR queue_file_page_width: amt$page_width;
     VAR status: ost$status);

    VAR
      application_name_changed: boolean,
      current_source_name: nft$parameter_24_definition,
      destination_name: nft$parameter_24_definition,
      destination_name_changed: boolean,
      echo_text_data_mode: jmt$data_mode,
      echo_text_login_family: ost$name,
      file_is_qtfi_err_file: boolean,
      lid_is_local: boolean,
      new_application_name: ost$name,
      new_destination_name: nft$parameter_24_definition,
      new_source_name: nft$parameter_24_definition,
      parameter_list_index: nft$protocol_parameters,
      source_name_changed: boolean,
      store_forward_application_name: ost$name,
      store_forward_file_info: nft$store_forward_file_info,
      trace_string: string (nfc$trace_commands_width);

    status.normal := TRUE;
    rpos_parameters := nfv$qtf_required_params_on_cmds [nfc$rpos];
    overridden_jad_odu := FALSE;
    file_is_qtfi_err_file := FALSE;

{ attach the STORE_FORWARD_NETWORK file and if the returned status is bad ignore it
{ because the file probably does not exist therefore we will not use the store/forward information

    store_forward_file_info.local_file_name := store_forward_file_name;
    nfp$open_store_forward_file (FALSE, store_forward_file_info, status);

    destination_name.value := control_block.remote_lid;
    destination_name.size := control_block.remote_lid_length;
    current_source_name := control_block.source_lid;
    store_forward_application_name := jmc$qtf_usage;

    IF store_forward_file_info.file_open THEN
      nfp$get_new_destination_name (nfc$sf_qtf_server, store_forward_file_info, destination_name,
            destination_name_changed, new_destination_name, status);
      IF destination_name_changed THEN
        destination_name := new_destination_name;
        IF control_block.protocol_trace THEN
          trace_string := '** QTF SERVER changed 25 to ';
          trace_string (29,*) := destination_name.value;
          pmp$log (trace_string, status);
        IFEND;
      IFEND;

{   if applicable get the new source name from the Store_Forward_Network file

      nfp$get_new_source_name (nfc$sf_qtf_server, store_forward_file_info, current_source_name,
            destination_name, source_name_changed, new_source_name, status);
      IF source_name_changed THEN
        current_source_name := new_source_name;
        IF control_block.protocol_trace THEN
          trace_string := '** QTF SERVER changed 24 to ';
          trace_string (29,*) := current_source_name.value;
          pmp$log (trace_string, status);
        IFEND;
      IFEND;

{   if applicable get the new application name from the Store_Forward_Network file

      nfp$get_new_application_name (nfc$sf_qtf_server, store_forward_file_info, destination_name,
            application_name_changed, new_application_name, status);
      IF application_name_changed THEN
        store_forward_application_name := new_application_name;
        IF control_block.protocol_trace THEN
          trace_string := '** QTF SERVER chngd APPL to ';
          trace_string (29,*) := store_forward_application_name;
          pmp$log (trace_string, status);
        IFEND;
      IFEND;
    IFEND;

    check_if_family_is_local (destination_name.value, lid_is_local, status);
    IF NOT status.normal THEN
      RETURN;
    ELSE

{  if the application name (store_forward_application_name) is NOT QTF, the incoming queue
{  file MUST be a store and forward queue file.  However, if the application name is QTF,
{  the destination (lid_is_local) will determine if the incoming queue file is a store and
{  forward queue file or at its final destination (local).

      store_and_forward_queue_file := NOT (lid_is_local AND (store_forward_application_name =
            jmc$qtf_usage));
    IFEND;

    IF control_block.protocol_trace THEN
      IF store_and_forward_queue_file THEN
        pmp$log ('** QTF SERVER defines the queue file as a STORE and FORWARD file', status);
      ELSE
        pmp$log ('** QTF SERVER defines the queue file as a LOCAL file', status);
      IFEND;
    IFEND;

{     Check if loop back transfer

    IF (control_block.transfer_pid = control_block.remote_pid) THEN
      loop_back_transfer := TRUE;
    ELSE
      loop_back_transfer := FALSE;
    IFEND;

{     Is this an output file or a job file?

    IF (control_block.disposition_code = nfc$p17_input_return) OR
          (control_block.disposition_code = nfc$p17_input_no_return) THEN
      IF loop_back_transfer THEN
        osp$set_status_abnormal(nfc$status_id,nfe$qtf_no_loopback_jobs,
             '',status);
        RETURN;
      ELSE
        queue_file_type := nfc$job_queue_file;
      IFEND;
    ELSEIF control_block.disposition_code = nfc$p17_generic_queue THEN
      queue_file_type := nfc$generic_queue_file
    ELSE
      queue_file_type := nfc$print_queue_file;
    IFEND;

{  crack the echo text for the login_family and data_mode
{  login_family will only be specified if the job was received from a NOS/VE system
{  and the login_family was supplied by the user.  data_mode will only be specified
{  if the queue file originated on a NON-NOS/VE system, store-forwarded through a
{  NOS/VE system and the data_declaration was unspecified.

    echo_text_login_family := osc$null_name;
    echo_text_data_mode := jmc$coded_data;

    IF control_block.received_echo_text.first_text <> NIL THEN
      crack_job_echo_text (control_block.received_echo_text.first_text^.value (1, control_block.
            received_echo_text.first_text^.size), echo_text_login_family, echo_text_data_mode,
            file_is_qtfi_err_file);
    IFEND;

{     Figure out data declaration to send back (if any).  The data declaration
{     will be modified only if talking to another NOS/VE system.

    IF store_and_forward_queue_file THEN
      IF control_block.remote_host_type = nfc$p22_nos_ve_qtf THEN
        control_block.data_declaration := nfc$p31_host_dependent_uh;
        rpos_parameters := rpos_parameters + $nft$parameter_set [nfc$data_declaration];
      IFEND;
    ELSE
      IF control_block.remote_host_type = nfc$p22_nos_ve_qtf THEN
        CASE control_block.data_declaration OF
        = nfc$p31_undef_unstructured_uu =
          control_block.data_declaration := nfc$p31_host_dependent_uh;
          rpos_parameters := rpos_parameters + $nft$parameter_set [nfc$data_declaration];
        = nfc$p31_unspecified =
          IF echo_text_data_mode <> jmc$rhf_structure THEN
            control_block.data_declaration := nfc$p31_host_dependent_uh;
            rpos_parameters := rpos_parameters + $nft$parameter_set [nfc$data_declaration];
          IFEND;
        = nfc$p31_ascii_c6, nfc$p31_ascii_c8, nfc$p31_undefined_structured_us =
          ; { No action }
        CASEND;
      IFEND;
    IFEND;

{     Define data mode

    IF (control_block.remote_host_type <> nfc$p22_nos_ve) AND (control_block.remote_host_type <>
          nfc$p22_nos_ve_qtf) THEN
      IF store_and_forward_queue_file THEN
        IF control_block.data_declaration = nfc$p31_undef_unstructured_uu THEN
          transfer_mode := nfc$transparent_data_mode;
        ELSE
          transfer_mode := nfc$rhf_structured_mode;
        IFEND;
      ELSE
        CASE control_block.data_declaration OF
        = nfc$p31_host_dependent_uh =
          transfer_mode := nfc$ve_to_ve_mode;
        = nfc$p31_unspecified, nfc$p31_ascii_c6, nfc$p31_ascii_c8 =
          transfer_mode := nfc$coded_data_mode;
        = nfc$p31_undef_unstructured_uu =
          transfer_mode := nfc$transparent_data_mode;
        = nfc$p31_undefined_structured_us =
          IF queue_file_type = nfc$print_queue_file THEN
            transfer_mode := nfc$rhf_structured_mode;
          ELSE
            osp$set_status_abnormal (nfc$status_id, nfe$data_type_us_not_for_job, '', status);
            RETURN;
          IFEND;
        ELSE
          osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
                'QTFS case error DD analyze_received_rft', status);
          RETURN;
        CASEND;
      IFEND;
    ELSE { VE to VE transfer }
      CASE control_block.data_declaration OF
      = nfc$p31_unspecified, nfc$p31_ascii_c6, nfc$p31_ascii_c8 =
        transfer_mode := nfc$coded_data_mode;
      = nfc$p31_undef_unstructured_uu =
        osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error, 'QTFS invalid UU transfer', status);
        RETURN;
      = nfc$p31_undefined_structured_us =
        transfer_mode := nfc$rhf_structured_mode;
      = nfc$p31_host_dependent_uh =
        transfer_mode := nfc$ve_to_ve_mode;
      ELSE
        osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
              'QTFS case error DD analyze_received_rft', status);
        RETURN;
      CASEND;
    IFEND;

{     If necessary, set block size values

    IF NOT (nfc$max_block_size IN received_parameters) THEN
      CASE control_block.data_declaration OF
      = nfc$p31_unspecified, nfc$p31_ascii_c6, nfc$p31_ascii_c8 =
        control_block.data_block_size := nfc$p12_nos_ascii_size;
      = nfc$p31_undef_unstructured_uu, nfc$p31_undefined_structured_us =
        control_block.data_block_size := nfc$p12_nos_binary_size;
      = nfc$p31_host_dependent_uh =
        control_block.data_block_size := nfc$p12_lcn_default;
      ELSE
        osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
              'QTFS analyze_received_rft - P12 invalid P31', status);
        RETURN;
      CASEND;
    IFEND;

{     If no source LID, use remote PID

    IF NOT(nfc$source_lid IN received_parameters) THEN
      IF (nfc$physical_id IN received_parameters) THEN
        control_block.source_lid.value := control_block.transfer_pid(1,control_block.
             transfer_pid_length);
        control_block.source_lid.size := control_block.transfer_pid_length;
      ELSE
        osp$set_status_abnormal(nfc$status_id,nfe$bts_internal_error,
             'QTFS source lid or transfer pid required!!!', status);
        return;
      IFEND;
    IFEND;

    create_queue_file_attributes (control_block.file_name, store_and_forward_queue_file,
          control_block.remote_host_type, control_block.data_declaration, control_block.disposition_code,
          destination_name.value (1, destination_name.size),
          current_source_name.value (1, current_source_name.size), store_forward_application_name,
          control_block.receive_systems_routing_text, control_block.receive_implicit_routing_text,
          control_block.received_directives, transfer_mode, control_block.receive_job_name.
          value (1, control_block.receive_job_name.size), control_block.receive_file_name.
          value (1, control_block.receive_file_name.size), queue_file_type, loop_back_transfer,
          echo_text_login_family, control_block.transfer_pid (1, control_block.transfer_pid_length),
          file_is_qtfi_err_file, input_accounting_data, queue_file_attributes, overridden_jad_odu,
          queue_file_page_width,status);

  PROCEND analyze_received_rft;

?? TITLE := 'change_page_width', EJECT ??

{ PURPOSE:
{   This procedure changes the file attribute page width of Queue file
{   to the value given by PAGE_WIDTH parameter in REMOTE_HOST_DIRECTIVE

  PROCEDURE  change_page_width
    (    file: amt$local_file_name;
         file_pw: amt$page_width;
     VAR status: ost$status);

    VAR
      attachment_options: ^fst$attachment_options,
      ignore_status: ost$status,
      transfer_file_attributes: ^fst$file_cycle_attributes,
      unique_fid: amt$file_identifier;

      PUSH transfer_file_attributes: [1..1];
      transfer_file_attributes^ [1].selector := fsc$page_width;
      transfer_file_attributes^ [1].page_width := file_pw;

    fsp$open_file ( file, amc$record, NIL, transfer_file_attributes,
                             NIL, NIL, NIL, unique_fid,ignore_status);

       IF NOT ignore_status.normal  THEN
         RETURN;
       IFEND;

    fsp$close_file (unique_fid,ignore_status);


  PROCEND  change_page_width;

?? TITLE := 'check_if_family_is_local', EJECT ??

{ PURPOSE:
{   This procedure must decide if a specified family (or LCN LID)
{   is served by this mainframe.  If this family is not served locally
{   then, the queue file will be store and forwarded.

  PROCEDURE check_if_family_is_local
    (    family_name: string (nfc$p24_max_param_size);
     VAR lid_is_local: boolean;
     VAR status: ost$status);

    CONST
      qtf_title_length = qtf_title_part_length + osc$max_name_size,
      qtf_title_part = 'QTFS$',
      qtf_title_part_length = 5;

    VAR
      local_status: ost$status,
      requested_cdcnet_title: string(qtf_title_length),
      requested_search_domain: nat$title_domain,
      title_request_id: nat$directory_search_identifier,
      translated_cdcnet_address: nat$osi_translation_address,
      translated_cdcnet_title: string(qtf_title_length),
      translated_identifier: nat$directory_entry_identifier,
      translated_priority: nat$directory_priority,
      translated_protocol: nat$protocol,
      translated_user_id: ost$name,
      translated_user_info: ^ array [1 .. nac$max_directory_data_length] of cell,
      translated_user_info_len: 0 .. nac$max_directory_data_length,
      type_of_transfer_lid: rft$type_of_lid,
      upper_case_family_name: string (nfc$p24_max_param_size);

    status.normal := TRUE;
    lid_is_local := FALSE;
    #translate (osv$lower_to_upper, family_name, upper_case_family_name);

    nfp$verify_family (upper_case_family_name, lid_is_local, status);

    IF NOT lid_is_local THEN
      rfp$return_lid_type (upper_case_family_name, type_of_transfer_lid, local_status);
      IF (type_of_transfer_lid = rfc$local_physical_id) OR (type_of_transfer_lid = rfc$local_logical_id) THEN
        lid_is_local := TRUE;
      ELSEIF (type_of_transfer_lid = rfc$remote_physical_id) OR (type_of_transfer_lid = rfc$remote_logical_id)
            THEN

{   the queue file destination is a remote systems logical identifier

        lid_is_local := FALSE;
      ELSE

{     check to see if the destination is a local CDCNET title

        requested_cdcnet_title := qtf_title_part;
        requested_cdcnet_title ((qtf_title_part_length + 1), * ) := upper_case_family_name;
        requested_search_domain.kind := nac$local_system_domain;
        nlp$translate_title (requested_cdcnet_title, FALSE, nac$cdna_session, FALSE, requested_search_domain,
              nac$cdna_external, title_request_id, local_status);
        IF local_status.normal THEN
          nlp$get_title_translation (title_request_id, translated_cdcnet_title, translated_cdcnet_address,
                translated_protocol, translated_user_info, translated_user_info_len, translated_priority,
                translated_user_id, translated_identifier, local_status);

{         if status is normal the CDCNET title was found as a local title
{         otherwise if the status is abnormal the CDCNET title was NOT found
{         and the title is for a remote system.

          lid_is_local := local_status.normal;
          nlp$end_title_translation (title_request_id, status);
        IFEND;
      IFEND;
    IFEND;

  PROCEND check_if_family_is_local;
?? TITLE := 'check_wait_queue_file', EJECT ??

{ PURPOSE:
{   This procedure will decide if the received queue file should be saved
{   as a permanent file, and if so, using what path name.

  PROCEDURE check_wait_queue_file
    (    output_submission_options: nft$queue_submission_option;
         remote_host_type: nft$parameter_22_values;
     VAR wait_queue: wait_queue_information);

    VAR
      local_status: ost$status,
      queue_file_name: amt$local_file_name;

    wait_queue.use_wait_queue := FALSE;

    IF (output_submission_options.output_submission_option [nfc$oqa_disposition_code].key <>
          jmc$null_attribute) AND (output_submission_options.output_submission_option
          [nfc$oqa_disposition_code].disposition_code = nfc$p17_wait_queue) AND
          (output_submission_options.output_submission_option [nfc$oqa_user_job_name].key <>
          jmc$null_attribute) AND (output_submission_options.output_submission_option [nfc$oqa_control_family]
          .key <> jmc$null_attribute) AND (output_submission_options.output_submission_option
          [nfc$oqa_control_user].key <> jmc$null_attribute) THEN
      nfp$create_wait_queue_file_name (output_submission_options.output_submission_option
            [nfc$oqa_control_family].control_family, output_submission_options.output_submission_option
            [nfc$oqa_control_user].control_user, output_submission_options.output_submission_option
            [nfc$oqa_user_job_name].user_job_name, queue_file_name, local_status);
      IF NOT local_status.normal THEN
        RETURN;
      ELSE
        wait_queue.use_wait_queue := TRUE;
        wait_queue.wait_queue_file_name := queue_file_name;
      IFEND;
    IFEND;

  PROCEND check_wait_queue_file;
?? TITLE := 'complete_qtfs_protocol', EJECT ??

{ PURPOSE:
{   This procedure will complete the ending of the A-A protocol.

  PROCEDURE complete_qtfs_protocol
    (VAR control_block: nft$control_block);

    VAR
      ignored_parameters: nft$parameter_set,
      local_status: ost$status,
      modified_parameters: nft$parameter_set,
      received_parameters: nft$parameter_set;

{     Send an ETPR

    nfp$send_command (nfc$etpr, $nft$parameter_set [],
      $nft$parameter_set[ ], $nft$parameter_set[],
      control_block, local_status);
    IF NOT local_status.normal THEN
      RETURN;
    IFEND;

{     Receive FINI

    nfp$receive_command ($nft$command_set [nfc$fini], nfv$qtf_required_params_on_cmds, control_block,
          received_parameters, ignored_parameters, modified_parameters, local_status);
    IF NOT local_status.normal THEN
      RETURN;
    IFEND;

{     Wait here for client to disconnect, if he forgets, time out and disconnect

    nfp$receive_command ($nft$command_set [], nfv$qtf_required_params_on_cmds, control_block,
          received_parameters, ignored_parameters, modified_parameters, local_status);
    IF control_block.path.path_connected THEN
      nfp$terminate_path (control_block.application, FALSE, control_block.path, local_status);
    IFEND;

  PROCEND complete_qtfs_protocol;
?? OLDTITLE ??
?? NEWTITLE := 'convert_string_to_ost$name', EJECT ??

{ PURPOSE:
{   The purpose of this function is to create a valid NOS/VE name by eliminating any invalid
{   characters from a string of characters.  If the string is empty or all blanks, the name
{   will be equal to the value osc$null_name.

  PROCEDURE convert_string_to_ost$name
    (    string_value: string ( * );
         prefix_character: string (1);
     VAR name_value: ost$name);

    TYPE
      set_of_char = set of char;

    VAR
      name_value_index: ost$non_negative_integers,
      ptr_string_value_upper_case: ^string( * ),
      string_index: ost$non_negative_integers,
      string_length: ost$non_negative_integers,
      valid_characters_for_name: [STATIC, READ] set_of_char := ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
            'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '#', '$',
            '@', '[', '\', ']', '^', '_', '`', '{', '|', '}', '~'],
      valid_number_for_name: [STATIC, READ] set_of_char := ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];

    string_length := clp$trimmed_string_size (string_value);
    name_value := osc$null_name;
    IF string_length > 0 THEN
      PUSH ptr_string_value_upper_case : [string_length];

{ convert the string value into upper case, since a name value is not case dependent.

      #translate (osv$lower_to_upper, string_value, ptr_string_value_upper_case^);

      name_value_index := 0;

{ verify that the first character of the string value is a valid first character for a name.

      IF NOT (ptr_string_value_upper_case^ (1,1) IN valid_characters_for_name) THEN
        name_value := prefix_character;
        name_value_index := 1;
      IFEND;

    /eliminate_invalid_characters/
      FOR string_index := 1 TO string_length DO

{ eliminate any invalid characters from the string value when generating the new name

        IF (ptr_string_value_upper_case^ (string_index, 1) IN valid_characters_for_name) OR
              (ptr_string_value_upper_case^ (string_index, 1) IN valid_number_for_name) THEN
          name_value_index := name_value_index + 1;
          name_value (name_value_index, 1) := ptr_string_value_upper_case^ (string_index, 1);

{ determine if the new name has reached the maximum length for a ost$name

          IF name_value_index >= osc$max_name_size THEN
            EXIT /eliminate_invalid_characters/;
          IFEND;
        IFEND;
      FOREND /eliminate_invalid_characters/;
    IFEND;

  PROCEND convert_string_to_ost$name;
?? TITLE := 'crack_generic_command', EJECT ??

{ PURPOSE:
{   This procedure will crack the remote host directive for generic queue files into
{   queue file submission options.

  PROCEDURE crack_generic_command
    (    command: string ( * );
     VAR return_attributes: nft$queue_submission_option;
     VAR status: ost$status);

{ PROCEDURE gq (
{   application_name, an: name = $optional
{   deferred_by_application, dba: boolean = $optional
{   destination, d: name = $optional
{   earliest_run_time, ert: date_time = $optional
{   latest_run_time, lrt: date_time = $optional
{   purge_delay, pd: time_increment = $optional
{   remote_host_directive, rhd: string 0..256 = $optional
{   )

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 14] of clt$pdt_parameter_name,
      parameters: array [1 .. 7] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$date_time_type_qualifier,
      recend,
      type5: record
        header: clt$type_specification_header,
        qualifier: clt$date_time_type_qualifier,
      recend,
      type6: record
        header: clt$type_specification_header,
      recend,
      type7: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
    recend := [
    [1,
    [91, 3, 27, 10, 7, 35, 915],
    clc$command, 14, 7, 0, 0, 0, 0, 0, ''], [
    ['AN                             ',clc$abbreviation_entry, 1],
    ['APPLICATION_NAME               ',clc$nominal_entry, 1],
    ['D                              ',clc$abbreviation_entry, 3],
    ['DBA                            ',clc$abbreviation_entry, 2],
    ['DEFERRED_BY_APPLICATION        ',clc$nominal_entry, 2],
    ['DESTINATION                    ',clc$nominal_entry, 3],
    ['EARLIEST_RUN_TIME              ',clc$nominal_entry, 4],
    ['ERT                            ',clc$abbreviation_entry, 4],
    ['LATEST_RUN_TIME                ',clc$nominal_entry, 5],
    ['LRT                            ',clc$abbreviation_entry, 5],
    ['PD                             ',clc$abbreviation_entry, 6],
    ['PURGE_DELAY                    ',clc$nominal_entry, 6],
    ['REMOTE_HOST_DIRECTIVE          ',clc$nominal_entry, 7],
    ['RHD                            ',clc$abbreviation_entry, 7]],
    [
{ PARAMETER 1
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 2
    [5, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 3
    [6, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 4
    [7, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 5
    [9, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 6
    [12, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 7
    [13, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$optional_parameter, 0
  , 0]],
{ PARAMETER 1
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 2
    [[1, 0, clc$boolean_type]],
{ PARAMETER 3
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 4
    [[1, 0, clc$date_time_type], [$clt$date_and_or_time [clc$date, clc$time], $clt$date_time_tenses [clc$past
  , clc$present, clc$future]]],
{ PARAMETER 5
    [[1, 0, clc$date_time_type], [$clt$date_and_or_time [clc$date, clc$time], $clt$date_time_tenses [clc$past
  , clc$present, clc$future]]],
{ PARAMETER 6
    [[1, 0, clc$time_increment_type]],
{ PARAMETER 7
    [[1, 0, clc$string_type], [0, 256, FALSE]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$application_name = 1,
      p$deferred_by_application = 2,
      p$destination = 3,
      p$earliest_run_time = 4,
      p$latest_run_time = 5,
      p$purge_delay = 6,
      p$remote_host_directive = 7;

    VAR
      pvt: array [1 .. 7] of clt$parameter_value;

    VAR
      command_length: integer,
      command_line_size_ptr: ^clt$command_line_size,
      command_ptr: ^string ( * ),
      ignore_status: ost$status,
      scl_parameter_list_ptr: ^clt$parameter_list;

{ BEGIN crack_generic_command;

    command_length := clp$trimmed_string_size(command);

    IF command_length > 0 THEN

{ Create the necessary environment to call CLP$EVALUATE_PARAMETERS.

      clp$push_parameters (status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      PUSH scl_parameter_list_ptr: [[REP (command_length + #SIZE (clt$command_line_size)) OF cell]];
      RESET scl_parameter_list_ptr;
      NEXT command_line_size_ptr IN scl_parameter_list_ptr;
      command_line_size_ptr^ := command_length;

      NEXT command_ptr: [command_length] IN scl_parameter_list_ptr;
      command_ptr^ := command (1, command_length);

      RESET scl_parameter_list_ptr;

      clp$evaluate_parameters (scl_parameter_list_ptr^, #SEQ (pdt), NIL, ^pvt, status);
      IF NOT status.normal THEN
        clp$pop_parameters (ignore_status);
        RETURN;
      IFEND;

      IF pvt [p$application_name].specified THEN

{ The subrecord DESTINATION is used in this entry in the array because APPLICATION_NAME is not a
{ qfile submission option. The value stored in this entry will be retrieved by SUBMIT_GENERIC_QUEUE_FILE
{ and passed to JMP$SUBMIT_QFILE as a parameter seperate from the qfile submission options.

        return_attributes.qfile_submission_option [nfc$gqa_application_name].key :=
              jmc$destination;
        return_attributes.qfile_submission_option [nfc$gqa_application_name].destination :=
              pvt [p$application_name].value^.name_value;
      IFEND;

      IF pvt [p$deferred_by_application].specified THEN
        return_attributes.qfile_submission_option [nfc$gqa_deferred_by_application].key :=
              jmc$deferred_by_application;
        return_attributes.qfile_submission_option [nfc$gqa_deferred_by_application].deferred_by_application :=
              pvt [p$deferred_by_application].value^.boolean_value.value;
      IFEND;

      IF pvt [p$destination].specified THEN
        return_attributes.qfile_submission_option [nfc$gqa_destination].key :=
              jmc$destination;
        return_attributes.qfile_submission_option [nfc$gqa_destination].destination :=
              pvt [p$destination].value^.name_value;
      IFEND;

      IF pvt [p$earliest_run_time].specified THEN
        return_attributes.qfile_submission_option [nfc$gqa_earliest_run_time].key :=
              jmc$earliest_run_time;
        return_attributes.qfile_submission_option [nfc$gqa_earliest_run_time].earliest_run_time.specified :=
              TRUE;
        return_attributes.qfile_submission_option [nfc$gqa_earliest_run_time].earliest_run_time.date_time :=
              pvt [p$earliest_run_time].value^.date_time_value.value;
      IFEND;

      IF pvt [p$latest_run_time].specified THEN
        return_attributes.qfile_submission_option [nfc$gqa_latest_run_time].key :=
              jmc$latest_run_time;
        return_attributes.qfile_submission_option [nfc$gqa_latest_run_time].latest_run_time.specified := TRUE;
        return_attributes.qfile_submission_option [nfc$gqa_latest_run_time].latest_run_time.date_time :=
              pvt [p$latest_run_time].value^.date_time_value.value;
      IFEND;

      IF pvt [p$purge_delay].specified THEN
        IF pvt [p$purge_delay].value^.kind = clc$keyword THEN { the only keyword allowed is NONE. }
          output_purge_delay.specified := FALSE;
        ELSE
          output_purge_delay.specified := TRUE;
          output_purge_delay.time_increment := pvt [p$purge_delay].value^.time_increment_value^;
        IFEND;

        return_attributes.qfile_submission_option [nfc$gqa_purge_delay].key := jmc$purge_delay;
        return_attributes.qfile_submission_option [nfc$gqa_purge_delay].purge_delay := ^output_purge_delay;
      IFEND;

      IF pvt [p$remote_host_directive].specified THEN
        output_remote_host_directive.size := STRLENGTH (pvt [p$remote_host_directive].value^.string_value^);
        output_remote_host_directive.parameters := pvt [p$remote_host_directive].value^.string_value^;

        return_attributes.qfile_submission_option [nfc$gqa_remote_host_directive].key :=
              jmc$remote_host_directive;
        return_attributes.qfile_submission_option [nfc$gqa_remote_host_directive].remote_host_directive :=
              ^output_remote_host_directive;
      IFEND;

      clp$pop_parameters (ignore_status);
    IFEND;

  PROCEND crack_generic_command;
?? TITLE := 'crack_implicit_routing_text', EJECT ??

{ PURPOSE:
{   This procedure will crack the QTF implicit text into output submission options.
{   The implicit text is cracked by QTFS for non-store-and-forward output files.
{   This text is used with output files to build queue file attributes.

  PROCEDURE crack_implicit_routing_text
    (    implicit_text: jmt$implicit_routing_text;
     VAR nos_ve_text: boolean;
     VAR return_attributes: nft$queue_submission_option;
     VAR queue_file_page_width: amt$page_width;
     VAR status: ost$status);

    VAR
      index: nfc$p33_min_param_length .. nfc$p33_max_param_length,
      implicit_text_index: nfc$p33_min_param_length .. nfc$p33_max_param_length,
      initial_job_name: jmt$system_supplied_name,
      initial_job_name_size: 0..jmc$system_supplied_name_size,
      login_command: string (maximum_size_qtfs_scl_command),
      login_command_size: 0 .. maximum_size_qtfs_scl_command;

    status.normal := TRUE;
    nos_ve_text := FALSE;
    IF (implicit_text.size < nfc$p33_min_param_length) THEN
      osp$set_status_abnormal (nfc$status_id, nfe$invalid_implicit_text_value, implicit_text.
            text (1, implicit_text.size), status);
      RETURN;
    IFEND;

    IF NOT (implicit_text.text (1, nfc$p33_nos_ve_text_id_length) = nfc$p33_nos_ve_text_identifier) THEN
      RETURN; { Text of some other host, cannot process }
    IFEND;

{     Extract the job name that initiated this job

    nos_ve_text := TRUE;
    initial_job_name_size := 0;

  /extract_initial_job_name/
    FOR implicit_text_index := nfc$p33_nos_ve_text_id_length + 1 TO implicit_text.size DO
      IF implicit_text.text (implicit_text_index, 1) = nfc$p33_text_delimiter THEN
        EXIT /extract_initial_job_name/;
      ELSEIF initial_job_name_size >= UPPERVALUE (initial_job_name_size) THEN
        osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
              'QTFS crack_implicit_routing_text initial job_name overflow', status);
        RETURN;
      ELSE
        initial_job_name_size := initial_job_name_size + 1;
        initial_job_name (initial_job_name_size, 1) := implicit_text.text (implicit_text_index, 1);
      IFEND;
    FOREND /extract_initial_job_name/;

{     Extract the LOGIN command which is used to identify output
{     NOTE: this simple algorithm assumes no strings are valid in the
{     implicit text LOGIN command, should that change, work needs
{     to be done here.

    login_command_size := 0;
    implicit_text_index := implicit_text_index + 1; { Move past delimiter }

  /extract_implicit_login/
    FOR index := implicit_text_index TO implicit_text.size DO
      IF implicit_text.text (index, 1) = nfc$p33_text_delimiter THEN
        EXIT /extract_implicit_login/;
      ELSEIF login_command_size >= UPPERVALUE (login_command_size) THEN
        osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
              'QTFS crack_implicit_routing_text login_command overflow', status);
        RETURN;
      ELSE
        login_command_size := login_command_size + 1;
        login_command (login_command_size, 1) := implicit_text.text (index, 1);
      IFEND;
    FOREND /extract_implicit_login/;
    IF login_command_size > 0 THEN
      crack_output_login_command (login_command (1, login_command_size), return_attributes, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;

    implicit_text_index := index + 1; { Move past delimiter }
    IF implicit_text.size - implicit_text_index > 0 THEN
      crack_print_file_parameters (implicit_text.text (implicit_text_index,
             implicit_text.size - implicit_text_index + 1), return_attributes,
             queue_file_page_width, status);
    IFEND;

  PROCEND crack_implicit_routing_text;
?? TITLE := 'crack_job_echo_text', EJECT ??

{ PURPOSE:
{   This procedure will crack the echo text for VE -> VE job transfers.
{   The echo text contains job attributes.

  PROCEDURE crack_job_echo_text
    (    text: string(*<=nfc$p29_max_param_size);
     VAR login_family: ost$name;
     VAR data_mode: jmt$data_mode;
     VAR file_is_qtfi_err_file: boolean);

    TYPE
      set_of_char = set of char;

    VAR
      command_length: integer,
      echo_text_index: ost$non_negative_integers,
      parameter_position: ost$non_negative_integers,
      parameter_value_length: ost$non_negative_integers,
      parameter_value_position: ost$non_negative_integers,
      ptr_upper_case_echo_text: ^string (*),
      valid_characters_for_name: [STATIC, READ] set_of_char := ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
            'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '#', '$',
            '@', '[', '\', ']', '^', '_', '`', '{', '|', '}', '~'],
      valid_number_for_name: [STATIC, READ] set_of_char := ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'],
      valid_login_family: boolean;

?? NEWTITLE := 'find_delimiter_position', EJECT ??

{ PURPOSE:
{   This function will find the position for the first delimiter in the
{   string.  If the delimiter was not found, the position value will be
{   equal to the length of the command_string + 1.  If the command_string
{   length is 0 (zero), the position value will be 0 (zero).

  FUNCTION find_delimiter_position
    (    command_string: string ( * <=nfc$p29_max_param_size);
         starting_position_in_string: ost$non_negative_integers): ost$non_negative_integers;

    VAR
      command_length: integer,
      string_index: ost$non_negative_integers;

    command_length := STRLENGTH (command_string);
    IF command_length > 0 THEN
      IF starting_position_in_string <= command_length THEN
        FOR string_index := starting_position_in_string TO command_length DO
          IF (command_string (string_index, 1) = ' ') OR (command_string (string_index, 1) = ',') THEN
            find_delimiter_position := string_index;
            RETURN;
          IFEND;
        FOREND;
      IFEND;
      find_delimiter_position := command_length + 1;
    ELSE
      find_delimiter_position := 0;
    IFEND;

  FUNCEND find_delimiter_position;
?? OLDTITLE ??
?? NEWTITLE := 'find_parameter_position', EJECT ??

{ PURPOSE:
{   This function will find the position for the parameter_string specified
{   in the command_string.  If the parameter_string was not found a value of
{   0 (zero) will be returned.

  FUNCTION find_parameter_position
    (    parameter_string: string ( * <=nfc$p29_max_param_size);
         command_string: string ( * <=nfc$p29_max_param_size)): ost$non_negative_integers;

    VAR
      command_length: integer,
      parameter_length: integer,
      string_index: ost$non_negative_integers;

    command_length := STRLENGTH (command_string);
    IF command_length > 0 THEN
      parameter_length := STRLENGTH (parameter_string);
      IF (parameter_length > 0) AND (parameter_length <= command_length) THEN
        FOR string_index := 1 TO (command_length - parameter_length + 1) DO
          IF command_string (string_index, parameter_length) = parameter_string (1, parameter_length) THEN
            find_parameter_position := string_index;
            RETURN;
          IFEND;
        FOREND;
      IFEND;
    IFEND;

    find_parameter_position := 0;

  FUNCEND find_parameter_position;
?? OLDTITLE, EJECT ??
    login_family := osc$null_name;
    data_mode := jmc$coded_data;
    file_is_qtfi_err_file := FALSE;

    command_length := STRLENGTH (text);
    IF command_length <= 0 THEN
      RETURN; { No parameters }
    IFEND;

    PUSH ptr_upper_case_echo_text : [command_length];
    #translate (osv$lower_to_upper, text, ptr_upper_case_echo_text^);

{ Find and process LOGIN_FAMILY

    parameter_position := find_parameter_position (nfc$p29_login_family_parameter, ptr_upper_case_echo_text^);

    IF parameter_position > 0 THEN
      parameter_value_position := parameter_position + nfc$p29_login_family_param_len;
      parameter_value_length :=  find_delimiter_position (ptr_upper_case_echo_text^, parameter_value_position)
             - parameter_value_position;

{ check to see if login family is a valid length

      IF parameter_value_length <= osc$max_name_size THEN
        IF ptr_upper_case_echo_text^ (parameter_value_position, 1) IN valid_characters_for_name THEN
          valid_login_family := TRUE;
        /validate_chars_in_login_family/
          FOR echo_text_index := parameter_value_position TO (parameter_value_position +
                parameter_value_length - 1) DO
            IF NOT ((ptr_upper_case_echo_text^ (echo_text_index, 1) IN valid_characters_for_name) OR
                  (ptr_upper_case_echo_text^ (echo_text_index, 1) IN valid_number_for_name)) THEN
              valid_login_family := FALSE;
              EXIT /validate_chars_in_login_family/;
            IFEND;
          FOREND /validate_chars_in_login_family/;
          IF valid_login_family THEN
            login_family := ptr_upper_case_echo_text^ (parameter_value_position, parameter_value_length);
          IFEND;
        IFEND;
      IFEND;
    IFEND;

{ Find and process DATA_MODE

    parameter_position := find_parameter_position (nfc$p29_data_mode_parameter, ptr_upper_case_echo_text^);

    IF parameter_position > 0 THEN
      parameter_value_position := parameter_position + nfc$p29_data_mode_param_length;
      parameter_value_length := find_delimiter_position (ptr_upper_case_echo_text^, parameter_value_position)
             - parameter_value_position;

      IF (parameter_value_length = nfc$p29_rhf_structured_length) AND (ptr_upper_case_echo_text^
            (parameter_value_position, parameter_value_length) = nfc$p29_rhf_structured_value) THEN
        data_mode := jmc$rhf_structure;
      IFEND;
    IFEND;

{ Find and process the QTFI_INFORMATION parameter.

    parameter_position := find_parameter_position (nfc$p29_qtfi_info, ptr_upper_case_echo_text^);

    IF parameter_position > 0 THEN
      parameter_value_position := parameter_position + nfc$p29_qtfi_info_length;
      parameter_value_length := find_delimiter_position (ptr_upper_case_echo_text^, parameter_value_position)
             - parameter_value_position;

      IF parameter_value_length <= osc$max_name_size THEN
        IF ptr_upper_case_echo_text^ (parameter_value_position, parameter_value_length) =
            nfc$p29_qtfi_info_err_file THEN
          file_is_qtfi_err_file := TRUE;
        IFEND;
      IFEND;
    IFEND;
  PROCEND crack_job_echo_text;
?? TITLE := 'crack_output_login_command', EJECT ??

{ PURPOSE:
{   This procedure is called to convert a login command to output submission
{   options.  The procedure cracks the login command which exists in NOS/VE
{   implicit text.
{
{ NOTE:
{   The format of the QTFS LOGIN command is not the same as the standard NOS/VE
{   LOGIN command.  This command has a very limited number of parameters.

  PROCEDURE crack_output_login_command
    (    login_command: string ( * <= maximum_size_qtfs_scl_command);
     VAR return_attributes: nft$queue_submission_option;
     VAR status: ost$status);

{ PROCEDURE login_command_pdt(
{   user, u: name = $required
{   family_name, fn: name = $required
{   user_job_name, ujn: name = $optional
{   account, a: name = $optional
{   project, p: name = $optional)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 10] of clt$pdt_parameter_name,
      parameters: array [1 .. 5] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type5: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
    recend := [
    [1,
    [89, 4, 26, 14, 11, 35, 319],
    clc$command, 10, 5, 2, 0, 0, 0, 0, ''], [
    ['A                              ',clc$abbreviation_entry, 4],
    ['ACCOUNT                        ',clc$nominal_entry, 4],
    ['FAMILY_NAME                    ',clc$nominal_entry, 2],
    ['FN                             ',clc$abbreviation_entry, 2],
    ['P                              ',clc$abbreviation_entry, 5],
    ['PROJECT                        ',clc$nominal_entry, 5],
    ['U                              ',clc$abbreviation_entry, 1],
    ['UJN                            ',clc$abbreviation_entry, 3],
    ['USER                           ',clc$nominal_entry, 1],
    ['USER_JOB_NAME                  ',clc$nominal_entry, 3]],
    [
{ PARAMETER 1
    [9, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$required_parameter, 0
  , 0],
{ PARAMETER 2
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$required_parameter, 0
  , 0],
{ PARAMETER 3
    [10, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 4
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 5
    [6, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0]],
{ PARAMETER 1
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 2
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 3
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 4
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 5
    [[1, 0, clc$name_type], [1, osc$max_name_size]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$user = 1,
      p$family_name = 2,
      p$user_job_name = 3,
      p$account = 4,
      p$project = 5;

    VAR
      pvt: array [1 .. 5] of clt$parameter_value;

    VAR
      command_line_size_ptr: ^clt$command_line_size,
      ignore_status: ost$status,
      length_parameter_list: integer,
      login_command_ptr: ^string ( * <= maximum_size_qtfs_scl_command),
      scl_parameter_list_ptr: ^clt$parameter_list;

    status.normal := TRUE;

    clp$push_parameters (status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    length_parameter_list := STRLENGTH (login_command);
    PUSH scl_parameter_list_ptr: [[REP (length_parameter_list + #SIZE (clt$command_line_size)) OF cell]];
    RESET scl_parameter_list_ptr;
    NEXT command_line_size_ptr IN scl_parameter_list_ptr;
    command_line_size_ptr^ := length_parameter_list;
    NEXT login_command_ptr: [length_parameter_list] IN scl_parameter_list_ptr;
    login_command_ptr^ := login_command;
    RESET scl_parameter_list_ptr;

    clp$evaluate_parameters (scl_parameter_list_ptr^, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      clp$pop_parameters (ignore_status);
      RETURN;
    IFEND;

{ Get USER name parameter

    return_attributes.output_submission_option [nfc$oqa_control_user].key := jmc$control_user;
    return_attributes.output_submission_option [nfc$oqa_control_user].control_user :=
          pvt [p$user].value^.name_value;

{ Get FAMILY_NAME parameter

    return_attributes.output_submission_option [nfc$oqa_control_family].key := jmc$control_family;
    return_attributes.output_submission_option [nfc$oqa_control_family].control_family :=
          pvt [p$family_name].value^.name_value;

{ If specified get USER_JOB_NAME

    IF pvt [p$user_job_name].specified THEN
      return_attributes.output_submission_option [nfc$oqa_user_job_name].key := jmc$user_job_name;
      return_attributes.output_submission_option [nfc$oqa_user_job_name].user_job_name :=
            pvt [p$user_job_name].value^.name_value;
    IFEND;

{ If specified get ACCOUNT parameter

    IF pvt [p$account].specified THEN
      return_attributes.output_submission_option [nfc$oqa_login_account].key := jmc$login_account;
      return_attributes.output_submission_option [nfc$oqa_login_account].login_account :=
            pvt [p$account].value^.name_value;
    IFEND;

{ If specified get PROJECT parameter

    IF pvt [p$project].specified THEN
      return_attributes.output_submission_option [nfc$oqa_login_project].key := jmc$login_project;
      return_attributes.output_submission_option [nfc$oqa_login_project].login_project :=
            pvt [p$project].value^.name_value;
    IFEND;

    clp$pop_parameters (ignore_status);

  PROCEND crack_output_login_command;
?? TITLE := 'crack_print_file_command', EJECT ??

{ PURPOSE:
{   This procedure will crack the remote_host_direcitve for the print_file command.

  PROCEDURE crack_print_file_command
    (    command: string ( * );
     VAR return_attributes: nft$queue_submission_option;
     VAR queue_file_page_width: amt$page_width;
     VAR status: ost$status);

    VAR
      parameter_list_position: integer;

    status.normal := TRUE;

    find_position_parameter_list (command, 'PRIF', parameter_list_position, status);
    IF NOT status.normal THEN
      find_position_parameter_list (command, 'PRINT_FILE', parameter_list_position, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;
    crack_print_file_parameters (command (parameter_list_position, * ), return_attributes,
          queue_file_page_width, status);

  PROCEND crack_print_file_command;
?? TITLE := 'crack_print_file_parameters', EJECT ??

{ PURPOSE:
{   This procedure will crack the print_file command parameters from
{   the remote_host_directive.
{
{ NOTE:
{   The QTFS print_file command is different than the standard NOS/VE
{   print_file command in that all of the parameters are optional.
{   Therefore, the remote_host_directive will not override any output
{   attribute unless it is explicitly specified.  Also, the FILE parameter
{   is ignored during the processing of this command.  Last of all, there
{   is an additional parameter 'DISPOSITION_CODE' that is not on the
{   the standard NOS/VE print_file command.

  PROCEDURE crack_print_file_parameters
    (    parameters: string ( * );
     VAR return_attributes: nft$queue_submission_option;
     VAR queue_file_page_width: amt$page_width;
     VAR status: ost$status);

{ PROCEDURE print_file_pdt (
{   file, f: file = $optional
{   comment_banner, cb: string 0..jmc$output_comment_banner_size = $optional
{   copies, c: integer 1..jmc$output_copy_count_max = $optional
{   data_mode, dm: key
{       (coded, c)
{       (transparent, t)
{     keyend = $optional
{   device, d: any of
{       key
{         automatic
{       keyend
{       name
{     anyend = $optional
{   disposition_code, dc: key
{       lp, cp, p8, pb, sp, wt, tt
{     keyend = $optional
{   earliest_print_time, ept: any of
{       key
{         none
{       keyend
{       date_time
{     anyend = $optional
{   external_characteristics, ec: any of
{       key
{         normal
{       keyend
{       string 0..jmc$ext_characteristics_size
{     anyend = $optional
{   forms_code, fc: any of
{       key
{         normal
{       keyend
{       string 0..jmc$forms_code_size
{     anyend = $optional
{   latest_print_time, lpt: any of
{       key
{         none
{       keyend
{       date_time
{     anyend = $optional
{   operator_family, destination_family, df, of: name = $optional
{   operator_user, so, station_operator, ou: name = $optional
{   output_class, oc: key
{       normal
{     keyend = $optional
{   output_deferred_by_user, odbu: boolean = $optional
{   output_destination, ode: any of
{       name
{       string 0..osc$max_name_size
{     anyend = $optional
{   output_destination_usage, destination_usage, du, odu: any of
{       key
{         dual_state, ntf, private, public, qtf
{       keyend
{       name
{     anyend = $optional
{   output_priority, op: key
{       low, medium, high
{     keyend = $optional
{   page_width, pw: integer 10..255 = $optional
{   purge_delay, pd: any of
{       key
{         none
{       keyend
{       time_increment
{     anyend = $optional
{   remote_host_directive, dsrp, dual_state_route_parameters, rhd: string ..
{     0..jmc$remote_host_directive_size = $optional
{   routing_banner, rb: string 0..jmc$output_routing_banner_size = $optional
{   station, s: any of
{       key
{         automatic
{       keyend
{       name
{     anyend = $optional
{   user_file_name, user_file_names, ufn: name = $optional
{   user_information, ui: string 0..jmc$user_information_size = $optional
{   vertical_print_density, vpd: key
{       six, eight, none, file
{     keyend = $optional
{   vfu_load_procedure, vlp: any of
{       key
{         none
{       keyend
{       name
{     anyend = $optional
{   )

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 61] of clt$pdt_parameter_name,
      parameters: array [1 .. 26] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$integer_type_qualifier,
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
      recend,
      type5: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type6: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 7] of clt$keyword_specification,
      recend,
      type7: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$date_time_type_qualifier,
        recend,
      recend,
      type8: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
      recend,
      type9: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
      recend,
      type10: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$date_time_type_qualifier,
        recend,
      recend,
      type11: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type12: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type13: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 1] of clt$keyword_specification,
      recend,
      type14: record
        header: clt$type_specification_header,
      recend,
      type15: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
      recend,
      type16: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 5] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type17: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 3] of clt$keyword_specification,
      recend,
      type18: record
        header: clt$type_specification_header,
        qualifier: clt$integer_type_qualifier,
      recend,
      type19: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
        recend,
      recend,
      type20: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
      type21: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
      type22: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type23: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type24: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
      type25: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
      recend,
      type26: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
    recend := [
    [1,
    [92, 10, 7, 14, 10, 17, 694],
    clc$command, 61, 26, 0, 0, 0, 0, 0, ''], [
    ['C                              ',clc$abbreviation_entry, 3],
    ['CB                             ',clc$abbreviation_entry, 2],
    ['COMMENT_BANNER                 ',clc$nominal_entry, 2],
    ['COPIES                         ',clc$nominal_entry, 3],
    ['D                              ',clc$abbreviation_entry, 5],
    ['DATA_MODE                      ',clc$nominal_entry, 4],
    ['DC                             ',clc$abbreviation_entry, 6],
    ['DESTINATION_FAMILY             ',clc$alias_entry, 11],
    ['DESTINATION_USAGE              ',clc$alias_entry, 16],
    ['DEVICE                         ',clc$nominal_entry, 5],
    ['DF                             ',clc$alias_entry, 11],
    ['DISPOSITION_CODE               ',clc$nominal_entry, 6],
    ['DM                             ',clc$abbreviation_entry, 4],
    ['DSRP                           ',clc$alias_entry, 20],
    ['DU                             ',clc$alias_entry, 16],
    ['DUAL_STATE_ROUTE_PARAMETERS    ',clc$alias_entry, 20],
    ['EARLIEST_PRINT_TIME            ',clc$nominal_entry, 7],
    ['EC                             ',clc$abbreviation_entry, 8],
    ['EPT                            ',clc$abbreviation_entry, 7],
    ['EXTERNAL_CHARACTERISTICS       ',clc$nominal_entry, 8],
    ['F                              ',clc$abbreviation_entry, 1],
    ['FC                             ',clc$abbreviation_entry, 9],
    ['FILE                           ',clc$nominal_entry, 1],
    ['FORMS_CODE                     ',clc$nominal_entry, 9],
    ['LATEST_PRINT_TIME              ',clc$nominal_entry, 10],
    ['LPT                            ',clc$abbreviation_entry, 10],
    ['OC                             ',clc$abbreviation_entry, 13],
    ['ODBU                           ',clc$abbreviation_entry, 14],
    ['ODE                            ',clc$abbreviation_entry, 15],
    ['ODU                            ',clc$abbreviation_entry, 16],
    ['OF                             ',clc$abbreviation_entry, 11],
    ['OP                             ',clc$abbreviation_entry, 17],
    ['OPERATOR_FAMILY                ',clc$nominal_entry, 11],
    ['OPERATOR_USER                  ',clc$nominal_entry, 12],
    ['OU                             ',clc$abbreviation_entry, 12],
    ['OUTPUT_CLASS                   ',clc$nominal_entry, 13],
    ['OUTPUT_DEFERRED_BY_USER        ',clc$nominal_entry, 14],
    ['OUTPUT_DESTINATION             ',clc$nominal_entry, 15],
    ['OUTPUT_DESTINATION_USAGE       ',clc$nominal_entry, 16],
    ['OUTPUT_PRIORITY                ',clc$nominal_entry, 17],
    ['PAGE_WIDTH                     ',clc$nominal_entry, 18],
    ['PD                             ',clc$abbreviation_entry, 19],
    ['PURGE_DELAY                    ',clc$nominal_entry, 19],
    ['PW                             ',clc$abbreviation_entry, 18],
    ['RB                             ',clc$abbreviation_entry, 21],
    ['REMOTE_HOST_DIRECTIVE          ',clc$nominal_entry, 20],
    ['RHD                            ',clc$abbreviation_entry, 20],
    ['ROUTING_BANNER                 ',clc$nominal_entry, 21],
    ['S                              ',clc$abbreviation_entry, 22],
    ['SO                             ',clc$alias_entry, 12],
    ['STATION                        ',clc$nominal_entry, 22],
    ['STATION_OPERATOR               ',clc$alias_entry, 12],
    ['UFN                            ',clc$abbreviation_entry, 23],
    ['UI                             ',clc$abbreviation_entry, 24],
    ['USER_FILE_NAME                 ',clc$nominal_entry, 23],
    ['USER_FILE_NAMES                ',clc$alias_entry, 23],
    ['USER_INFORMATION               ',clc$nominal_entry, 24],
    ['VERTICAL_PRINT_DENSITY         ',clc$nominal_entry, 25],
    ['VFU_LOAD_PROCEDURE             ',clc$nominal_entry, 26],
    ['VLP                            ',clc$abbreviation_entry, 26],
    ['VPD                            ',clc$abbreviation_entry, 25]],
    [
{ PARAMETER 1
    [23, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 2
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$optional_parameter, 0
  , 0],
{ PARAMETER 3
    [4, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20, clc$optional_parameter,
  0, 0],
{ PARAMETER 4
    [6, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 155,
  clc$optional_parameter, 0, 0],
{ PARAMETER 5
    [10, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0],
{ PARAMETER 6
    [12, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 266,
  clc$optional_parameter, 0, 0],
{ PARAMETER 7
    [17, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0],
{ PARAMETER 8
    [20, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 72, clc$optional_parameter,
  0, 0],
{ PARAMETER 9
    [24, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 72, clc$optional_parameter,
  0, 0],
{ PARAMETER 10
    [25, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0],
{ PARAMETER 11
    [33, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 12
    [34, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 13
    [36, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 44, clc$optional_parameter,
  0, 0],
{ PARAMETER 14
    [37, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 15
    [38, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 33, clc$optional_parameter,
  0, 0],
{ PARAMETER 16
    [39, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 217,
  clc$optional_parameter, 0, 0],
{ PARAMETER 17
    [40, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 118,
  clc$optional_parameter, 0, 0],
{ PARAMETER 18
    [41, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20, clc$optional_parameter,
  0, 0],
{ PARAMETER 19
    [43, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 67, clc$optional_parameter,
  0, 0],
{ PARAMETER 20
    [46, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$optional_parameter, 0
  , 0],
{ PARAMETER 21
    [48, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$optional_parameter, 0
  , 0],
{ PARAMETER 22
    [51, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0],
{ PARAMETER 23
    [55, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 24
    [57, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$optional_parameter, 0
  , 0],
{ PARAMETER 25
    [58, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 155,
  clc$optional_parameter, 0, 0],
{ PARAMETER 26
    [59, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0]],
{ PARAMETER 1
    [[1, 0, clc$file_type]],
{ PARAMETER 2
    [[1, 0, clc$string_type], [0, jmc$output_comment_banner_size, FALSE]],
{ PARAMETER 3
    [[1, 0, clc$integer_type], [1, jmc$output_copy_count_max, 10]],
{ PARAMETER 4
    [[1, 0, clc$keyword_type], [4], [
    ['C                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['CODED                          ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['T                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['TRANSPARENT                    ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 5
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['AUTOMATIC                      ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ],
{ PARAMETER 6
    [[1, 0, clc$keyword_type], [7], [
    ['CP                             ', clc$nominal_entry, clc$normal_usage_entry, 2],
    ['LP                             ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['P8                             ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['PB                             ', clc$nominal_entry, clc$normal_usage_entry, 4],
    ['SP                             ', clc$nominal_entry, clc$normal_usage_entry, 5],
    ['TT                             ', clc$nominal_entry, clc$normal_usage_entry, 7],
    ['WT                             ', clc$nominal_entry, clc$normal_usage_entry, 6]]
    ],
{ PARAMETER 7
    [[1, 0, clc$union_type], [[clc$date_time_type, clc$keyword_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$date_time_type], [$clt$date_and_or_time [clc$date, clc$time], $clt$date_time_tenses [
  clc$past, clc$present, clc$future]]]
    ],
{ PARAMETER 8
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$string_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NORMAL                         ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    8, [[1, 0, clc$string_type], [0, jmc$ext_characteristics_size, FALSE]]
    ],
{ PARAMETER 9
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$string_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NORMAL                         ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    8, [[1, 0, clc$string_type], [0, jmc$forms_code_size, FALSE]]
    ],
{ PARAMETER 10
    [[1, 0, clc$union_type], [[clc$date_time_type, clc$keyword_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$date_time_type], [$clt$date_and_or_time [clc$date, clc$time], $clt$date_time_tenses [
  clc$past, clc$present, clc$future]]]
    ],
{ PARAMETER 11
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 12
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 13
    [[1, 0, clc$keyword_type], [1], [
    ['NORMAL                         ', clc$nominal_entry, clc$normal_usage_entry, 1]]
    ],
{ PARAMETER 14
    [[1, 0, clc$boolean_type]],
{ PARAMETER 15
    [[1, 0, clc$union_type], [[clc$name_type, clc$string_type],
    FALSE, 2],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]],
    8, [[1, 0, clc$string_type], [0, osc$max_name_size, FALSE]]
    ],
{ PARAMETER 16
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type],
    FALSE, 2],
    192, [[1, 0, clc$keyword_type], [5], [
      ['DUAL_STATE                     ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['NTF                            ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['PRIVATE                        ', clc$nominal_entry, clc$normal_usage_entry, 3],
      ['PUBLIC                         ', clc$nominal_entry, clc$normal_usage_entry, 4],
      ['QTF                            ', clc$nominal_entry, clc$normal_usage_entry, 5]]
      ],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ],
{ PARAMETER 17
    [[1, 0, clc$keyword_type], [3], [
    ['HIGH                           ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['LOW                            ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['MEDIUM                         ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 18
    [[1, 0, clc$integer_type], [10, 255, 10]],
{ PARAMETER 19
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$time_increment_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    3, [[1, 0, clc$time_increment_type]]
    ],
{ PARAMETER 20
    [[1, 0, clc$string_type], [0, jmc$remote_host_directive_size, FALSE]],
{ PARAMETER 21
    [[1, 0, clc$string_type], [0, jmc$output_routing_banner_size, FALSE]],
{ PARAMETER 22
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['AUTOMATIC                      ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ],
{ PARAMETER 23
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 24
    [[1, 0, clc$string_type], [0, jmc$user_information_size, FALSE]],
{ PARAMETER 25
    [[1, 0, clc$keyword_type], [4], [
    ['EIGHT                          ', clc$nominal_entry, clc$normal_usage_entry, 2],
    ['FILE                           ', clc$nominal_entry, clc$normal_usage_entry, 4],
    ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['SIX                            ', clc$nominal_entry, clc$normal_usage_entry, 1]]
    ],
{ PARAMETER 26
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$file = 1,
      p$comment_banner = 2,
      p$copies = 3,
      p$data_mode = 4,
      p$device = 5,
      p$disposition_code = 6,
      p$earliest_print_time = 7,
      p$external_characteristics = 8,
      p$forms_code = 9,
      p$latest_print_time = 10,
      p$operator_family = 11,
      p$operator_user = 12,
      p$output_class = 13,
      p$output_deferred_by_user = 14,
      p$output_destination = 15,
      p$output_destination_usage = 16,
      p$output_priority = 17,
      p$page_width = 18,
      p$purge_delay = 19,
      p$remote_host_directive = 20,
      p$routing_banner = 21,
      p$station = 22,
      p$user_file_name = 23,
      p$user_information = 24,
      p$vertical_print_density = 25,
      p$vfu_load_procedure = 26;

    VAR
      pvt: array [1 .. 26] of clt$parameter_value;

    VAR
      command_length: integer,
      command_line_size_ptr: ^clt$command_line_size,
      ignore_status: ost$status,
      prif_command_ptr: ^string ( * ),
      scl_parameter_list_ptr: ^clt$parameter_list;

    status.normal := TRUE;
    command_length := STRLENGTH (parameters);
    IF command_length <= 0 THEN
      RETURN; { No parameters }
    IFEND;

    clp$push_parameters (status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    PUSH scl_parameter_list_ptr: [[REP (command_length + #SIZE (clt$command_line_size)) OF cell]];
    RESET scl_parameter_list_ptr;
    NEXT command_line_size_ptr IN scl_parameter_list_ptr;
    command_line_size_ptr^ := command_length;
    NEXT prif_command_ptr: [command_length] IN scl_parameter_list_ptr;
    prif_command_ptr^ := parameters;
    RESET scl_parameter_list_ptr;

    clp$evaluate_parameters (scl_parameter_list_ptr^, #SEQ(pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      clp$pop_parameters (ignore_status);
      RETURN;
    IFEND;

{ The FILE parameter is ignored.
{ If specified process COMMENT_BANNER parameter.

    IF pvt [p$comment_banner].specified THEN
      return_attributes.output_submission_option [nfc$oqa_comment_banner].key := jmc$comment_banner;
      return_attributes.output_submission_option [nfc$oqa_comment_banner].comment_banner :=
            pvt [p$comment_banner].value^.string_value^;
    IFEND;

{ If specified process COPIES parameter.

    IF pvt [p$copies].specified THEN
      return_attributes.output_submission_option [nfc$oqa_copies].key := jmc$copies;
      return_attributes.output_submission_option [nfc$oqa_copies].copies :=
            pvt [p$copies].value^.integer_value.value;
    IFEND;

{ If specified process DATA_MODE parameter.

    IF pvt [p$data_mode].specified THEN
      return_attributes.output_submission_option [nfc$oqa_data_mode].key := jmc$data_mode;
      IF pvt [p$data_mode].value^.keyword_value = 'CODED' THEN
        return_attributes.output_submission_option [nfc$oqa_data_mode].data_mode := jmc$coded_data;
      ELSE { pvt [p$data_mode].value^.keyword_value = 'TRANSPARENT'.
        return_attributes.output_submission_option [nfc$oqa_data_mode].data_mode := jmc$transparent_data;
      IFEND;
    IFEND;

{ If specified process DEVICE parameter.

    IF pvt [p$device].specified THEN
      return_attributes.output_submission_option [nfc$oqa_device].key := jmc$device;
      IF pvt [p$device].value^.kind = clc$name THEN
        return_attributes.output_submission_option [nfc$oqa_device].device := pvt [p$device].value^
              .name_value;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_device].device :=
              pvt [p$device].value^.keyword_value;
      IFEND;
    IFEND;

{ Get DISPOSITION_CODE if it was specified

    IF pvt [p$disposition_code].specified THEN
      return_attributes.output_submission_option [nfc$oqa_disposition_code].key := jmc$disposition_code;
      return_attributes.output_submission_option [nfc$oqa_disposition_code].disposition_code :=
            pvt [p$disposition_code].value^.keyword_value;
    IFEND;

{ If specified process EARLIEST_PRINT_TIME parameter.

    IF pvt [p$earliest_print_time].specified THEN
      return_attributes.output_submission_option [nfc$oqa_earliest_print_time].key := jmc$earliest_print_time;
      IF pvt [p$earliest_print_time].value^.kind = clc$keyword THEN { the only keyword allowed is NONE. }
        return_attributes.output_submission_option [nfc$oqa_earliest_print_time].earliest_print_time.specified
              := FALSE;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_earliest_print_time].earliest_print_time.specified
              := TRUE;
        return_attributes.output_submission_option [nfc$oqa_earliest_print_time].
              earliest_print_time.date_time := pvt [p$earliest_print_time].value^.date_time_value.value;
      IFEND;
    IFEND;

{ If specified process EXTERNAL_CHARACTERISTICS parameter.

    IF pvt [p$external_characteristics].specified THEN
      return_attributes.output_submission_option [nfc$oqa_external_characteristic].key :=
            jmc$external_characteristics;
      IF pvt [p$external_characteristics].value^.kind = clc$keyword THEN { the only keyword is NORMAL. }
        return_attributes.output_submission_option [nfc$oqa_external_characteristic].
              external_characteristics := pvt [p$external_characteristics].value^.keyword_value;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_external_characteristic].
              external_characteristics := pvt [p$external_characteristics].value^.string_value^;
      IFEND;
    IFEND;

{ If specified process FORMS_CODE parameter.

    IF pvt [p$forms_code].specified THEN
      return_attributes.output_submission_option [nfc$oqa_forms_code].key := jmc$forms_code;
      IF pvt [p$forms_code].value^.kind = clc$keyword THEN { the only keyword allowed is NORMAL. }
        return_attributes.output_submission_option [nfc$oqa_forms_code].forms_code := pvt [p$forms_code].
              value^.keyword_value;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_forms_code].forms_code := pvt [p$forms_code].
              value^.string_value^;
      IFEND;
    IFEND;

{ If specified process LATEST_PRINT_TIME parameter.

    IF pvt [p$latest_print_time].specified THEN
      return_attributes.output_submission_option [nfc$oqa_latest_print_time].key := jmc$latest_print_time;
      IF pvt [p$latest_print_time].value^.kind = clc$keyword THEN { the only keyword allowed is NONE. }
        return_attributes.output_submission_option [nfc$oqa_latest_print_time].latest_print_time.specified :=
              FALSE;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_latest_print_time].latest_print_time.specified :=
              TRUE;
        return_attributes.output_submission_option [nfc$oqa_latest_print_time].
              latest_print_time.date_time := pvt [p$latest_print_time].value^.date_time_value.value;
      IFEND;
    IFEND;

{ If specified process OPERATOR_FAMILY parameter.

    IF pvt [p$operator_family].specified THEN
      return_attributes.output_submission_option [nfc$oqa_operator_family].key :=
            jmc$output_destination_family;
      return_attributes.output_submission_option [nfc$oqa_operator_family].output_destination_family :=
            pvt [p$operator_family].value^.name_value;
    IFEND;

{ If specified process OPERATOR_USER parameter.

    IF pvt [p$operator_user].specified THEN
      return_attributes.output_submission_option [nfc$oqa_operator_user].key := jmc$station_operator;
      return_attributes.output_submission_option [nfc$oqa_operator_user].station_operator :=
            pvt [p$operator_user].value^.name_value;
    IFEND;

{ If specified process OUTPUT_CLASS parameter.

    IF pvt [p$output_class].specified THEN
      return_attributes.output_submission_option [nfc$oqa_output_class].key := jmc$output_class;
      return_attributes.output_submission_option [nfc$oqa_output_class].output_class :=
            pvt [p$output_class].value^.keyword_value;
    IFEND;

{ If specified process OUTPUT_DEFERRED_BY_USER parameter.

    IF pvt [p$output_deferred_by_user].specified THEN
      return_attributes.output_submission_option [nfc$oqa_output_deferred_by_user].key :=
            jmc$output_deferred_by_user;
      return_attributes.output_submission_option [nfc$oqa_output_deferred_by_user].output_deferred_by_user :=
            pvt [p$output_deferred_by_user].value^.boolean_value.value;
    IFEND;

{ If specified process OUTPUT_DESTINATION parameter.

    IF pvt [p$output_destination].specified THEN
      return_attributes.output_submission_option [nfc$oqa_output_destination].key := jmc$output_destination;
      IF pvt [p$output_destination].value^.kind = clc$name THEN
        return_attributes.output_submission_option [nfc$oqa_output_destination].output_destination :=
              pvt [p$output_destination].value^.name_value;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_output_destination].output_destination :=
              pvt [p$output_destination].value^.string_value^;
      IFEND;
    IFEND;

{ If specified process OUTPUT_DESTINATION_USAGE parameter.

    IF pvt [p$output_destination_usage].specified THEN
      return_attributes.output_submission_option [nfc$oqa_output_dest_usage].key :=
            jmc$output_destination_usage;
      IF pvt [p$output_destination_usage].value^.kind = clc$name THEN
        return_attributes.output_submission_option [nfc$oqa_output_dest_usage].
              output_destination_usage := pvt [p$output_destination_usage].value^.name_value;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_output_dest_usage].
              output_destination_usage := pvt [p$output_destination_usage].value^.keyword_value;
      IFEND;
    IFEND;

{ If specified process OUTPUT_PRIORITY parameter.

    IF pvt [p$output_priority].specified THEN
      return_attributes.output_submission_option [nfc$oqa_output_priority].key := jmc$output_priority;
      return_attributes.output_submission_option [nfc$oqa_output_priority].output_priority :=
            pvt [p$output_priority].value^.keyword_value;
    IFEND;

{ If specified process PAGE_WIDTH  parameter.

    IF pvt [p$page_width].specified THEN
      queue_file_page_width := pvt [p$page_width].value^.integer_value.value;
    IFEND;

{ If specified process PURGE_DELAY parameter.

    IF pvt [p$purge_delay].specified THEN
      IF pvt [p$purge_delay].value^.kind = clc$keyword THEN { the only keyword allowed is NONE. }
        output_purge_delay.specified := FALSE;
      ELSE
        output_purge_delay.specified := TRUE;
        output_purge_delay.time_increment := pvt [p$purge_delay].value^.time_increment_value^;
      IFEND;
      return_attributes.output_submission_option [nfc$oqa_purge_delay].key := jmc$purge_delay;
      return_attributes.output_submission_option [nfc$oqa_purge_delay].purge_delay := ^output_purge_delay;
    IFEND;

{ If specified process REMOTE_HOST_DIRECTIVE parameter.

    IF pvt [p$remote_host_directive].specified THEN
      output_remote_host_directive.size := STRLENGTH (pvt [p$remote_host_directive].value^.string_value^);
      output_remote_host_directive.parameters := pvt [p$remote_host_directive].value^.string_value^;
      return_attributes.output_submission_option [nfc$oqa_remote_host_directive].key :=
            jmc$remote_host_directive;
      return_attributes.output_submission_option [nfc$oqa_remote_host_directive].remote_host_directive :=
            ^output_remote_host_directive;
    IFEND;

{ If specified process ROUTING_BANNER parameter.

    IF pvt [p$routing_banner].specified THEN
      return_attributes.output_submission_option [nfc$oqa_routing_banner].key := jmc$routing_banner;
      return_attributes.output_submission_option [nfc$oqa_routing_banner].routing_banner :=
            pvt [p$routing_banner].value^.string_value^;
    IFEND;

{ If specified process STATION parameter.

    IF pvt [p$station].specified THEN
      return_attributes.output_submission_option [nfc$oqa_station].key := jmc$station;
      IF pvt [p$station].value^.kind = clc$keyword THEN
        return_attributes.output_submission_option [nfc$oqa_station].station :=
              pvt [p$station].value^.keyword_value;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_station].station :=
              pvt [p$station].value^.name_value;
      IFEND;
    IFEND;

{ If specified process USER_FILE_NAME parameter.

    IF pvt [p$user_file_name].specified THEN
      return_attributes.output_submission_option [nfc$oqa_user_file_name].key := jmc$user_file_name;
      return_attributes.output_submission_option [nfc$oqa_user_file_name].user_file_name :=
            pvt [p$user_file_name].value^.name_value;
    IFEND;

{ If specified process USER_INFORMATION parameter.

    IF pvt [p$user_information].specified THEN
      output_user_information := pvt [p$user_information].value^.string_value^;
      return_attributes.output_submission_option [nfc$oqa_user_information].key := jmc$user_information;
      return_attributes.output_submission_option [nfc$oqa_user_information].user_information :=
            ^output_user_information;
    IFEND;

{ If specified process VERTICAL_PRINT_DENSITY parameter.

    IF pvt [p$vertical_print_density].specified THEN
      return_attributes.output_submission_option [nfc$oqa_vertical_print_density].key :=
            jmc$vertical_print_density;
      IF pvt [p$vertical_print_density].value^.keyword_value = 'FILE' THEN
        return_attributes.output_submission_option [nfc$oqa_vertical_print_density].vertical_print_density :=
              jmc$vertical_print_density_file;
      ELSEIF pvt [p$vertical_print_density].value^.keyword_value = 'NONE' THEN
        return_attributes.output_submission_option [nfc$oqa_vertical_print_density].vertical_print_density :=
              jmc$vertical_print_density_none;
      ELSEIF pvt [p$vertical_print_density].value^.keyword_value = 'SIX' THEN
        return_attributes.output_submission_option [nfc$oqa_vertical_print_density].vertical_print_density :=
              jmc$vertical_print_density_6;
      ELSE { pvt [p$vertical_print_density].value^.keyword_value = 'EIGHT'
        return_attributes.output_submission_option [nfc$oqa_vertical_print_density].vertical_print_density :=
              jmc$vertical_print_density_8;
      IFEND;
    IFEND;

{ If specified process VFU_LOAD_PROCEDURE parameter.

    IF pvt [p$vfu_load_procedure].specified THEN
      return_attributes.output_submission_option [nfc$oqa_vfu_load_procedure].key := jmc$vfu_load_procedure;
      IF pvt [p$vfu_load_procedure].value^.kind = clc$keyword THEN
        return_attributes.output_submission_option [nfc$oqa_vfu_load_procedure].vfu_load_procedure :=
              osc$null_name;
      ELSE
        return_attributes.output_submission_option [nfc$oqa_vfu_load_procedure].vfu_load_procedure :=
              pvt [p$vfu_load_procedure].value^.name_value;
      IFEND;
    IFEND;

    clp$pop_parameters (ignore_status);

  PROCEND crack_print_file_parameters;
?? TITLE := 'crack_submit_job_command', EJECT ??

{ PURPOSE:
{   This procedure will crack the QTFS submit_job command.
{
{ NOTE:
{   The QTFS submit_job command is different from the standard NOS/VE
{   submit_job command in that all of the parameters are optional.
{   Therefore, the remote_host_directive will not override any job
{   attribute unless it is explicitly specified.

  PROCEDURE crack_submit_job_command
    (    command: string ( * );
     VAR return_attributes: nft$queue_submission_option;
     VAR status: ost$status);

{ PROCEDURE submit_job_pdt (
{   file, f: file = $optional
{   cpu_time_limit, ctl: any of
{       key
{         system_default, unlimited, unspecified
{       keyend
{       integer jmc$lowest_cpu_time_limit..jmc$highest_cpu_time_limit
{     anyend = $optional
{   earliest_run_time, ert: any of
{       key
{         none
{       keyend
{       date_time
{     anyend = $optional
{   job_abort_disposition, jad: key
{       (restart, r)
{       (terminate, t)
{     keyend = $optional
{   job_class, jc: name = $optional
{   job_deferred_by_user, jdbu: boolean = $optional
{   job_destination, jd: any of
{       name
{       string 0..osc$max_name_size
{     anyend = $optional
{   job_destination_usage, jdu: any of
{       key
{         ntf, qtf, ve, ve_local, ve_qtf, ve_family
{       keyend
{       name
{     anyend = $optional
{   job_execution_ring, jer: integer osc$sj_ring_1..osc$user_ring_2 = $optional
{   job_qualifier, job_qualifiers, jq: any of
{       key
{         none, system_default
{       keyend
{       list 1..jmc$maximum_job_qualifiers of name
{     anyend = $optional
{   job_recovery_disposition, jrd: key
{       (continue, c)
{       (restart, r)
{       (terminate, t)
{     keyend = $optional
{   latest_run_time, lrt: any of
{       key
{         none
{       keyend
{       date_time
{     anyend = $optional
{   login_family, family_name, fn, lf: name = $optional
{   magnetic_tape_limit, mtl: any of
{       key
{         system_default, unlimited, unspecified
{       keyend
{       integer jmc$lowest_magnetic_tape_limit..jmc$highest_magnetic_tape_limit
{     anyend = $optional
{   maximum_working_set, maxws: any of
{       key
{         system_default, unlimited, unspecified
{       keyend
{       integer jmc$lowest_working_set_size..jmc$highest_working_set_size
{     anyend = $optional
{   operator_family, of: name = $optional
{   operator_user, ou: name = $optional
{   output_disposition, so, standard_output, odi: any of
{       key
{         (discard_all_output, dao)
{         (discard_standard_output, dso)
{         (local, l)
{         (printer, p)
{         (wait_queue, wt, wq)
{       keyend
{       file
{     anyend = $optional
{   remote_host_directive, rhd: string 0..jmc$remote_host_directive_size = $optional
{   sru_limit, sl: any of
{       key
{         system_default, unlimited, unspecified
{       keyend
{       integer jmc$lowest_sru_limit..jmc$highest_sru_limit
{     anyend = $optional
{   station, s: any of
{       key
{         automatic
{       keyend
{       name
{     anyend = $optional
{   user_information, ui: string 0..jmc$user_information_size = $optional
{   user_job_name, jn, job_name, ujn: name = $optional)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 53] of clt$pdt_parameter_name,
      parameters: array [1 .. 23] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 3] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$integer_type_qualifier,
        recend,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$date_time_type_qualifier,
        recend,
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
      recend,
      type5: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type6: record
        header: clt$type_specification_header,
      recend,
      type7: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
      recend,
      type8: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 6] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type9: record
        header: clt$type_specification_header,
        qualifier: clt$integer_type_qualifier,
      recend,
      type10: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 2] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$name_type_qualifier,
          recend,
        recend,
      recend,
      type11: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 6] of clt$keyword_specification,
      recend,
      type12: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$date_time_type_qualifier,
        recend,
      recend,
      type13: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type14: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 3] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$integer_type_qualifier,
        recend,
      recend,
      type15: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 3] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$integer_type_qualifier,
        recend,
      recend,
      type16: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type17: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type18: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 11] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
        recend,
      recend,
      type19: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
      type20: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 3] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$integer_type_qualifier,
        recend,
      recend,
      type21: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type22: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
      recend,
      type23: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
    recend := [
    [1,
    [89, 7, 11, 9, 57, 18, 975],
    clc$command, 53, 23, 0, 0, 0, 0, 0, ''], [
    ['CPU_TIME_LIMIT                 ',clc$nominal_entry, 2],
    ['CTL                            ',clc$abbreviation_entry, 2],
    ['EARLIEST_RUN_TIME              ',clc$nominal_entry, 3],
    ['ERT                            ',clc$abbreviation_entry, 3],
    ['F                              ',clc$abbreviation_entry, 1],
    ['FAMILY_NAME                    ',clc$alias_entry, 13],
    ['FILE                           ',clc$nominal_entry, 1],
    ['FN                             ',clc$alias_entry, 13],
    ['JAD                            ',clc$abbreviation_entry, 4],
    ['JC                             ',clc$abbreviation_entry, 5],
    ['JD                             ',clc$abbreviation_entry, 7],
    ['JDBU                           ',clc$abbreviation_entry, 6],
    ['JDU                            ',clc$abbreviation_entry, 8],
    ['JER                            ',clc$abbreviation_entry, 9],
    ['JN                             ',clc$alias_entry, 23],
    ['JOB_ABORT_DISPOSITION          ',clc$nominal_entry, 4],
    ['JOB_CLASS                      ',clc$nominal_entry, 5],
    ['JOB_DEFERRED_BY_USER           ',clc$nominal_entry, 6],
    ['JOB_DESTINATION                ',clc$nominal_entry, 7],
    ['JOB_DESTINATION_USAGE          ',clc$nominal_entry, 8],
    ['JOB_EXECUTION_RING             ',clc$nominal_entry, 9],
    ['JOB_NAME                       ',clc$alias_entry, 23],
    ['JOB_QUALIFIER                  ',clc$nominal_entry, 10],
    ['JOB_QUALIFIERS                 ',clc$alias_entry, 10],
    ['JOB_RECOVERY_DISPOSITION       ',clc$nominal_entry, 11],
    ['JQ                             ',clc$abbreviation_entry, 10],
    ['JRD                            ',clc$abbreviation_entry, 11],
    ['LATEST_RUN_TIME                ',clc$nominal_entry, 12],
    ['LF                             ',clc$abbreviation_entry, 13],
    ['LOGIN_FAMILY                   ',clc$nominal_entry, 13],
    ['LRT                            ',clc$abbreviation_entry, 12],
    ['MAGNETIC_TAPE_LIMIT            ',clc$nominal_entry, 14],
    ['MAXIMUM_WORKING_SET            ',clc$nominal_entry, 15],
    ['MAXWS                          ',clc$abbreviation_entry, 15],
    ['MTL                            ',clc$abbreviation_entry, 14],
    ['ODI                            ',clc$abbreviation_entry, 18],
    ['OF                             ',clc$abbreviation_entry, 16],
    ['OPERATOR_FAMILY                ',clc$nominal_entry, 16],
    ['OPERATOR_USER                  ',clc$nominal_entry, 17],
    ['OU                             ',clc$abbreviation_entry, 17],
    ['OUTPUT_DISPOSITION             ',clc$nominal_entry, 18],
    ['REMOTE_HOST_DIRECTIVE          ',clc$nominal_entry, 19],
    ['RHD                            ',clc$abbreviation_entry, 19],
    ['S                              ',clc$abbreviation_entry, 21],
    ['SL                             ',clc$abbreviation_entry, 20],
    ['SO                             ',clc$alias_entry, 18],
    ['SRU_LIMIT                      ',clc$nominal_entry, 20],
    ['STANDARD_OUTPUT                ',clc$alias_entry, 18],
    ['STATION                        ',clc$nominal_entry, 21],
    ['UI                             ',clc$abbreviation_entry, 22],
    ['UJN                            ',clc$abbreviation_entry, 23],
    ['USER_INFORMATION               ',clc$nominal_entry, 22],
    ['USER_JOB_NAME                  ',clc$nominal_entry, 23]],
    [
{ PARAMETER 1
    [7, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 2
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 158,
  clc$optional_parameter, 0, 0],
{ PARAMETER 3
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0],
{ PARAMETER 4
    [16, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 155,
  clc$optional_parameter, 0, 0],
{ PARAMETER 5
    [17, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 6
    [18, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 7
    [19, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 33, clc$optional_parameter,
  0, 0],
{ PARAMETER 8
    [20, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 254,
  clc$optional_parameter, 0, 0],
{ PARAMETER 9
    [21, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20, clc$optional_parameter,
  0, 0],
{ PARAMETER 10
    [23, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 122,
  clc$optional_parameter, 0, 0],
{ PARAMETER 11
    [25, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 229,
  clc$optional_parameter, 0, 0],
{ PARAMETER 12
    [28, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0],
{ PARAMETER 13
    [30, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 14
    [32, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 158,
  clc$optional_parameter, 0, 0],
{ PARAMETER 15
    [33, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 158,
  clc$optional_parameter, 0, 0],
{ PARAMETER 16
    [38, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 17
    [39, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0],
{ PARAMETER 18
    [41, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 437,
  clc$optional_parameter, 0, 0],
{ PARAMETER 19
    [42, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$optional_parameter, 0
  , 0],
{ PARAMETER 20
    [47, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 158,
  clc$optional_parameter, 0, 0],
{ PARAMETER 21
    [49, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 69, clc$optional_parameter,
  0, 0],
{ PARAMETER 22
    [52, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8, clc$optional_parameter, 0
  , 0],
{ PARAMETER 23
    [53, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$optional_parameter, 0
  , 0]],
{ PARAMETER 1
    [[1, 0, clc$file_type]],
{ PARAMETER 2
    [[1, 0, clc$union_type], [[clc$integer_type, clc$keyword_type],
    FALSE, 2],
    118, [[1, 0, clc$keyword_type], [3], [
      ['SYSTEM_DEFAULT                 ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['UNLIMITED                      ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['UNSPECIFIED                    ', clc$nominal_entry, clc$normal_usage_entry, 3]]
      ],
    20, [[1, 0, clc$integer_type], [jmc$lowest_cpu_time_limit, jmc$highest_cpu_time_limit, 10]]
    ],
{ PARAMETER 3
    [[1, 0, clc$union_type], [[clc$date_time_type, clc$keyword_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$date_time_type], [$clt$date_and_or_time [clc$date, clc$time], $clt$date_time_tenses [
  clc$past, clc$present, clc$future]]]
    ],
{ PARAMETER 4
    [[1, 0, clc$keyword_type], [4], [
    ['R                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['RESTART                        ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['T                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['TERMINATE                      ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 5
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 6
    [[1, 0, clc$boolean_type]],
{ PARAMETER 7
    [[1, 0, clc$union_type], [[clc$name_type, clc$string_type],
    FALSE, 2],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]],
    8, [[1, 0, clc$string_type], [0, osc$max_name_size, FALSE]]
    ],
{ PARAMETER 8
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type],
    FALSE, 2],
    229, [[1, 0, clc$keyword_type], [6], [
      ['NTF                            ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['QTF                            ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['VE                             ', clc$nominal_entry, clc$normal_usage_entry, 3],
      ['VE_FAMILY                      ', clc$nominal_entry, clc$normal_usage_entry, 6],
      ['VE_LOCAL                       ', clc$nominal_entry, clc$normal_usage_entry, 4],
      ['VE_QTF                         ', clc$nominal_entry, clc$normal_usage_entry, 5]]
      ],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ],
{ PARAMETER 9
    [[1, 0, clc$integer_type], [osc$sj_ring_1, osc$user_ring_2, 10]],
{ PARAMETER 10
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$list_type],
    FALSE, 2],
    81, [[1, 0, clc$keyword_type], [2], [
      ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['SYSTEM_DEFAULT                 ', clc$nominal_entry, clc$normal_usage_entry, 2]]
      ],
    21, [[1, 0, clc$list_type], [5, 1, jmc$maximum_job_qualifiers, FALSE],
        [[1, 0, clc$name_type], [1, osc$max_name_size]]
      ]
    ],
{ PARAMETER 11
    [[1, 0, clc$keyword_type], [6], [
    ['C                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['CONTINUE                       ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['R                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['RESTART                        ', clc$nominal_entry, clc$normal_usage_entry, 2],
    ['T                              ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
    ['TERMINATE                      ', clc$nominal_entry, clc$normal_usage_entry, 3]]
    ],
{ PARAMETER 12
    [[1, 0, clc$union_type], [[clc$date_time_type, clc$keyword_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$date_time_type], [$clt$date_and_or_time [clc$date, clc$time], $clt$date_time_tenses [
  clc$past, clc$present, clc$future]]]
    ],
{ PARAMETER 13
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 14
    [[1, 0, clc$union_type], [[clc$integer_type, clc$keyword_type],
    FALSE, 2],
    118, [[1, 0, clc$keyword_type], [3], [
      ['SYSTEM_DEFAULT                 ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['UNLIMITED                      ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['UNSPECIFIED                    ', clc$nominal_entry, clc$normal_usage_entry, 3]]
      ],
    20, [[1, 0, clc$integer_type], [jmc$lowest_magnetic_tape_limit, jmc$highest_magnetic_tape_limit, 10]]
    ],
{ PARAMETER 15
    [[1, 0, clc$union_type], [[clc$integer_type, clc$keyword_type],
    FALSE, 2],
    118, [[1, 0, clc$keyword_type], [3], [
      ['SYSTEM_DEFAULT                 ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['UNLIMITED                      ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['UNSPECIFIED                    ', clc$nominal_entry, clc$normal_usage_entry, 3]]
      ],
    20, [[1, 0, clc$integer_type], [jmc$lowest_working_set_size, jmc$highest_working_set_size, 10]]
    ],
{ PARAMETER 16
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 17
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 18
    [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type],
    FALSE, 2],
    414, [[1, 0, clc$keyword_type], [11], [
      ['DAO                            ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
      ['DISCARD_ALL_OUTPUT             ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['DISCARD_STANDARD_OUTPUT        ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['DSO                            ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
      ['L                              ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
      ['LOCAL                          ', clc$nominal_entry, clc$normal_usage_entry, 3],
      ['P                              ', clc$abbreviation_entry, clc$normal_usage_entry, 4],
      ['PRINTER                        ', clc$nominal_entry, clc$normal_usage_entry, 4],
      ['WAIT_QUEUE                     ', clc$nominal_entry, clc$normal_usage_entry, 5],
      ['WQ                             ', clc$abbreviation_entry, clc$normal_usage_entry, 5],
      ['WT                             ', clc$alias_entry, clc$normal_usage_entry, 5]]
      ],
    3, [[1, 0, clc$file_type]]
    ],
{ PARAMETER 19
    [[1, 0, clc$string_type], [0, jmc$remote_host_directive_size, FALSE]],
{ PARAMETER 20
    [[1, 0, clc$union_type], [[clc$integer_type, clc$keyword_type],
    FALSE, 2],
    118, [[1, 0, clc$keyword_type], [3], [
      ['SYSTEM_DEFAULT                 ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['UNLIMITED                      ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['UNSPECIFIED                    ', clc$nominal_entry, clc$normal_usage_entry, 3]]
      ],
    20, [[1, 0, clc$integer_type], [jmc$lowest_sru_limit, jmc$highest_sru_limit, 10]]
    ],
{ PARAMETER 21
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['AUTOMATIC                      ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ],
{ PARAMETER 22
    [[1, 0, clc$string_type], [0, jmc$user_information_size, FALSE]],
{ PARAMETER 23
    [[1, 0, clc$name_type], [1, osc$max_name_size]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$file = 1,
      p$cpu_time_limit = 2,
      p$earliest_run_time = 3,
      p$job_abort_disposition = 4,
      p$job_class = 5,
      p$job_deferred_by_user = 6,
      p$job_destination = 7,
      p$job_destination_usage = 8,
      p$job_execution_ring = 9,
      p$job_qualifier = 10,
      p$job_recovery_disposition = 11,
      p$latest_run_time = 12,
      p$login_family = 13,
      p$magnetic_tape_limit = 14,
      p$maximum_working_set = 15,
      p$operator_family = 16,
      p$operator_user = 17,
      p$output_disposition = 18,
      p$remote_host_directive = 19,
      p$sru_limit = 20,
      p$station = 21,
      p$user_information = 22,
      p$user_job_name = 23;

    VAR
      pvt: array [1 .. 23] of clt$parameter_value;

    VAR
      command_length: integer,
      command_line_size_ptr: ^clt$command_line_size,
      default_job_attributes_p: ^jmt$default_attribute_results,
      ignore_status: ost$status,
      job_qualifier_count: 0 .. clc$max_list_size,
      job_qualifier_index: 0 .. clc$max_list_size,
      job_qualifier_options: ^clt$data_value,
      parameter_list_position: integer,
      scl_parameter_list_ptr: ^clt$parameter_list,
      subj_command_ptr: ^string ( * );

?? NEWTITLE := 'change_implicit_text_wait_queue', EJECT ??

{ PURPOSE:
{   This procedure will modify a NOS/VE Implicit Routing Text to reflect the
{   OUTPUT_DISPOSITION as specified on the Remote Host Directive.  The only
{   changes that are allowed to occur are:
{     1.  If the Remote Host Directive has the parameter OUTPUT_DISPOSITION = WAIT_QUEUE,
{         then add or change the OD parameter to have a WQ value in the Implicit Routing Text.
{     2.  If the Remote Host Directive has the parameter OUTPUT_DISPOSITION = PRINTER,
{         then delete the OD=WQ parameter value from the Implicit Routing Text.
{
{ NOTE:
{   The disposition parameter is placed into a NOS/VE Implicit Routing Text by the
{   QTF Initiator as 'DC='.

    PROCEDURE change_implicit_text_wait_queue
      (    add_wait_queue_value: boolean);

      CONST
        disposition_code_parameter = 'DC=',
        disposition_code_param_length = 3,
        semicolon = ';';

      VAR
        disposition_code_index: ost$non_negative_integers,
        found_disposition_code: boolean,
        index: ost$non_negative_integers,
        temporary_implicit_text: jmt$implicit_routing_text;

      temporary_implicit_text := output_implicit_routing_text;

{ Only change implicit routing text generated by a NOS/VE system

      IF (temporary_implicit_text.size >= nfc$p33_nos_ve_text_id_length) AND
            (temporary_implicit_text.text (1, nfc$p33_nos_ve_text_id_length) =
            nfc$p33_nos_ve_text_identifier) THEN

        index := nfc$p33_nos_ve_text_id_length;

{ Position index past the system_supplied_job name in the implicit routing text

        REPEAT
          index := index + 1;
        UNTIL (index > temporary_implicit_text.size) OR (temporary_implicit_text.text (index, 1) =
              semicolon);

        index := index + 1;
        IF index <= temporary_implicit_text.size THEN

{ Position index past the login information of the originating job in the implicit routing text

          REPEAT
            index := index + 1;
          UNTIL (index > temporary_implicit_text.size) OR (temporary_implicit_text.text (index, 1) =
                semicolon);

          index := index + 1;
          IF index <= temporary_implicit_text.size THEN
            found_disposition_code := FALSE;

{ Check to see if the disposition_code parameter is in the implicit routing text

          /find_disposition_code/
            FOR disposition_code_index := index TO (temporary_implicit_text.size -
                  disposition_code_param_length) DO
              IF temporary_implicit_text.text (disposition_code_index, disposition_code_param_length) =
                    disposition_code_parameter THEN
                found_disposition_code := TRUE;
                EXIT /find_disposition_code/;
              IFEND;
            FOREND /find_disposition_code/;

            IF found_disposition_code THEN
              IF add_wait_queue_value THEN
                IF temporary_implicit_text.text ((disposition_code_index + disposition_code_param_length
                      + 1) , 2) <> nfc$p33_imp_wait_queue_value_wt THEN

{ change the DISPOSITION_CODE value to wait_queue in the implicit routing text

                  temporary_implicit_text.text ((disposition_code_index + disposition_code_param_length
                      + 1) , 2) := nfc$p33_imp_wait_queue_value_wt;

{ the DISPOSITION_CODE wait_queue value should be followed by a space

                  IF temporary_implicit_text.text ((disposition_code_index + disposition_code_param_length
                        + 2) , 1) <> ' ' THEN
                    temporary_implicit_text.text ((disposition_code_index + disposition_code_param_length
                        + 2) , 1) := ' ';
                  IFEND;
                IFEND;
              ELSE
                IF temporary_implicit_text.text ((disposition_code_index + disposition_code_param_length), 2)
                      = nfc$p33_imp_wait_queue_value_wt THEN

{ delete the DISPOSITION_CODE parameter and value of wait_queue from the implicit routing text

                  temporary_implicit_text.text (index, *) := output_implicit_routing_text.text
                        ((disposition_code_index + disposition_code_param_length + 3), *);
                  temporary_implicit_text.size := temporary_implicit_text.size - disposition_code_param_length
                    - 3;
                IFEND;
              IFEND;

{ Replace the global implicit routing text

              output_implicit_routing_text := temporary_implicit_text;
            ELSEIF add_wait_queue_value THEN

{ Add the DISPOSITION_CODE value of wait_queue to the implicit routing text

              temporary_implicit_text.text (index, *) := disposition_code_parameter;
              temporary_implicit_text.text ((index + disposition_code_param_length), *) :=
                    nfc$p33_imp_wait_queue_value_wt;
              temporary_implicit_text.text ((index + disposition_code_param_length + 2), *) := ' ';
              temporary_implicit_text.text ((index + disposition_code_param_length + 3), *) :=
                    output_implicit_routing_text.text (index, *);
              temporary_implicit_text.size := temporary_implicit_text.size + disposition_code_param_length
                    + 3;

{ If the new implicit text is too large, truncate the implicit routing text after the last valid parameter

              IF temporary_implicit_text.size > jmc$implicit_routing_text_size THEN
                index := jmc$implicit_routing_text_size;
                WHILE (index > 0) AND (temporary_implicit_text.text (index, 1) <> ' ') DO
                  index := index - 1;
                WHILEND;
                temporary_implicit_text.size := index;
                temporary_implicit_text.text (index, *) := ' ';
              IFEND;

{ Replace the global implicit routing text

              output_implicit_routing_text := temporary_implicit_text;
            IFEND;
          IFEND;
        IFEND;
      IFEND;
    PROCEND change_implicit_text_wait_queue;
?? OLDTITLE, EJECT ??
    status.normal := TRUE;

    find_position_parameter_list (command, 'SUBJ', parameter_list_position, status);
    IF NOT status.normal THEN
      find_position_parameter_list (command, 'SUBMIT_JOB', parameter_list_position, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;

    command_length := STRLENGTH (command (parameter_list_position, * ));
    IF command_length <= 0 THEN
      RETURN; { No parameters }
    IFEND;

    clp$push_parameters (status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    PUSH scl_parameter_list_ptr: [[REP (command_length + #SIZE (clt$command_line_size)) OF cell]];
    RESET scl_parameter_list_ptr;
    NEXT command_line_size_ptr IN scl_parameter_list_ptr;
    command_line_size_ptr^ := command_length;
    NEXT subj_command_ptr: [command_length] IN scl_parameter_list_ptr;
    subj_command_ptr^ := command (parameter_list_position, * );
    RESET scl_parameter_list_ptr;

    clp$evaluate_parameters (scl_parameter_list_ptr^, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      clp$pop_parameters (ignore_status);
      RETURN;
    IFEND;

{ The FILE parameter is ignored.
{ If specified process CPU_TIME_LIMIT parameter.

    IF pvt [p$cpu_time_limit].specified THEN
      return_attributes.job_submission_option [nfc$iqa_cpu_time_limit].key := jmc$cpu_time_limit;
      IF pvt [p$cpu_time_limit].value^.kind = clc$integer THEN
        return_attributes.job_submission_option [nfc$iqa_cpu_time_limit].cpu_time_limit :=
              pvt [p$cpu_time_limit].value^.integer_value.value;
      ELSE
        IF pvt [p$cpu_time_limit].value^.keyword_value = 'UNSPECIFIED' THEN
          return_attributes.job_submission_option [nfc$iqa_cpu_time_limit].cpu_time_limit :=
                jmc$unspecified_cpu_time_limit;
        ELSEIF pvt [p$cpu_time_limit].value^.keyword_value = 'SYSTEM_DEFAULT' THEN
          return_attributes.job_submission_option [nfc$iqa_cpu_time_limit].cpu_time_limit :=
                jmc$system_default_cpu_time_lim;
        ELSE { pvt [p$cpu_time_limit].value^.keyword_value = 'UNLIMITED'.
          return_attributes.job_submission_option [nfc$iqa_cpu_time_limit].cpu_time_limit :=
                jmc$unlimited_cpu_time_limit;
        IFEND;
      IFEND;
    IFEND;

{ If specified process EARLIEST_RUN_TIME parameter.

    IF pvt [p$earliest_run_time].specified THEN
      return_attributes.job_submission_option [nfc$iqa_earliest_run_time].key := jmc$earliest_run_time;
      IF pvt [p$earliest_run_time].value^.kind = clc$keyword THEN { the only keyword allowed is NONE. }
        return_attributes.job_submission_option [nfc$iqa_earliest_run_time].earliest_run_time.specified :=
              FALSE;
      ELSE
        return_attributes.job_submission_option [nfc$iqa_earliest_run_time].earliest_run_time.specified :=
              TRUE;
        return_attributes.job_submission_option [nfc$iqa_earliest_run_time].earliest_run_time.date_time :=
              pvt [p$earliest_run_time].value^.date_time_value.value;
      IFEND;
    IFEND;

{ If specified process JOB_ABORT_DISPOSITION parameter.

    IF pvt [p$job_abort_disposition].specified THEN
      return_attributes.job_submission_option [nfc$iqa_job_abort_disposition].key :=
            jmc$job_abort_disposition;
      IF pvt [p$job_abort_disposition].value^.keyword_value = 'RESTART' THEN
        return_attributes.job_submission_option [nfc$iqa_job_abort_disposition].job_abort_disposition :=
              jmc$restart_on_abort;
      ELSE { TERMINATE is the only other choice. }
        return_attributes.job_submission_option [nfc$iqa_job_abort_disposition].job_abort_disposition :=
              jmc$terminate_on_abort;
      IFEND;
    IFEND;

{If specified process JOB_CLASS parameter.

    IF pvt [p$job_class].specified THEN
      return_attributes.job_submission_option [nfc$iqa_job_class].key := jmc$job_class;
      return_attributes.job_submission_option [nfc$iqa_job_class].job_class := pvt [p$job_class].value^
            .name_value;
    IFEND;

{ If specified process JOB_DEFERRED_BY_USER parameter.

    IF pvt [p$job_deferred_by_user].specified THEN
      return_attributes.job_submission_option [nfc$iqa_job_deferred_by_user].key := jmc$job_deferred_by_user;
      return_attributes.job_submission_option [nfc$iqa_job_deferred_by_user].job_deferred_by_user :=
            pvt [p$job_deferred_by_user].value^.boolean_value.value;
    IFEND;

{ If specified process JOB_DESTINATION parameter.

    IF pvt [p$job_destination].specified THEN
      return_attributes.job_submission_option [nfc$iqa_job_destination].key := jmc$job_destination_family;
      IF pvt [p$job_destination].value^.kind = clc$name THEN
        return_attributes.job_submission_option [nfc$iqa_job_destination].job_destination_family :=
              pvt [p$job_destination].value^.name_value;
      ELSE
        return_attributes.job_submission_option [nfc$iqa_job_destination].job_destination_family :=
              pvt [p$job_destination].value^.string_value^;
      IFEND;
    IFEND;

{ If specified process JOB_DESTINATION_USAGE parameter.

    IF pvt [p$job_destination_usage].specified THEN
      return_attributes.job_submission_option [nfc$iqa_job_destination_usage].key :=
            jmc$job_destination_usage;
      IF pvt [p$job_destination_usage].value^.kind = clc$name THEN
        return_attributes.job_submission_option [nfc$iqa_job_destination_usage].job_destination_usage :=
              pvt [p$job_destination_usage].value^.name_value;
      ELSE
        return_attributes.job_submission_option [nfc$iqa_job_destination_usage].job_destination_usage :=
              pvt [p$job_destination_usage].value^.keyword_value;
      IFEND;
    IFEND;

{ If specified process JOB_EXECUTION_RING parameter.

    IF pvt [p$job_execution_ring].specified THEN
      return_attributes.job_submission_option [nfc$iqa_job_execution_ring].key := jmc$job_execution_ring;
      return_attributes.job_submission_option [nfc$iqa_job_execution_ring].job_execution_ring :=
            pvt [p$job_execution_ring].value^.integer_value.value;
    IFEND;

{ If specified process JOB_QUALIFIER parameter.

    IF pvt [p$job_qualifier].specified THEN
      FOR job_qualifier_index := 1 TO jmc$maximum_job_qualifiers DO
        job_qualifier_list [job_qualifier_index] := osc$null_name;
      FOREND;

      IF pvt [p$job_qualifier].value^.kind = clc$keyword THEN
        IF pvt [p$job_qualifier].value^.keyword_value = 'NONE' THEN
          job_qualifier_list [1] := osc$null_name;
        ELSE { keyword_value = 'SYSTEM_DEFAULT'}
          PUSH default_job_attributes_p: [1 .. 1];
          default_job_attributes_p^ [1].key := jmc$job_qualifier_list;
          default_job_attributes_p^ [1].job_qualifier_list := ^job_qualifier_list;
          jmp$get_attribute_defaults (jmc$batch, default_job_attributes_p, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;
        IFEND;
      ELSE
        job_qualifier_count := clp$count_list_elements (pvt [p$job_qualifier].value);
        job_qualifier_options := pvt [p$job_qualifier].value;
        FOR job_qualifier_index := 1 TO job_qualifier_count DO
          job_qualifier_list [job_qualifier_index] := job_qualifier_options^.element_value^.name_value;
          job_qualifier_options := job_qualifier_options^.link;
        FOREND;
      IFEND;
      return_attributes.job_submission_option [nfc$iqa_job_qualifier_list].key := jmc$job_qualifier_list;
      return_attributes.job_submission_option [nfc$iqa_job_qualifier_list].job_qualifier_list :=
            ^job_qualifier_list;
    IFEND;

{ If specified process JOB_RECOVERY_DISPOSITION parameter.

    IF pvt [p$job_recovery_disposition].specified THEN
      return_attributes.job_submission_option [nfc$iqa_job_recovery_dispositon].key :=
            jmc$job_recovery_disposition;
      IF pvt [p$job_recovery_disposition].value^.keyword_value = 'RESTART' THEN
        return_attributes.job_submission_option [nfc$iqa_job_recovery_dispositon].job_recovery_disposition :=
              jmc$restart_on_recovery;
      ELSEIF pvt [p$job_recovery_disposition].value^.keyword_value = 'CONTINUE' THEN
        return_attributes.job_submission_option [nfc$iqa_job_recovery_dispositon].job_recovery_disposition :=
              jmc$continue_on_recovery;
      ELSE { pvt [p$job_recovery_disposition].value^.keyword_value = 'TERMINATE'.
        return_attributes.job_submission_option [nfc$iqa_job_recovery_dispositon].job_recovery_disposition :=
              jmc$terminate_on_recovery;
      IFEND;
    IFEND;

{ If specified process LATEST_RUN_TIME parameter.

    IF pvt [p$latest_run_time].specified THEN
      return_attributes.job_submission_option [nfc$iqa_latest_run_time].key := jmc$latest_run_time;
      IF pvt [p$latest_run_time].value^.kind = clc$keyword THEN { the only keyword allowed is NONE. }
        return_attributes.job_submission_option [nfc$iqa_latest_run_time].latest_run_time.specified := FALSE;
      ELSE
        return_attributes.job_submission_option [nfc$iqa_latest_run_time].latest_run_time.specified := TRUE;
        return_attributes.job_submission_option [nfc$iqa_latest_run_time].latest_run_time.date_time :=
              pvt [p$latest_run_time].value^.date_time_value.value;
      IFEND;
    IFEND;

{ If specified process LOGIN_FAMILY parameter.

    IF pvt [p$login_family].specified THEN
      return_attributes.job_submission_option [nfc$iqa_login_family].key := jmc$login_family;
      return_attributes.job_submission_option [nfc$iqa_login_family].login_family :=
            pvt [p$login_family].value^.name_value;
    IFEND;

{ If specified process MAGNETIC_TAPE_LIMIT parameter.

    IF pvt [p$magnetic_tape_limit].specified THEN
      return_attributes.job_submission_option [nfc$iqa_magnetic_tape_limit].key := jmc$magnetic_tape_limit;
      IF pvt [p$magnetic_tape_limit].value^.kind = clc$integer THEN
        return_attributes.job_submission_option [nfc$iqa_magnetic_tape_limit].magnetic_tape_limit :=
              pvt [p$magnetic_tape_limit].value^.integer_value.value;
      ELSE
        IF pvt [p$magnetic_tape_limit].value^.keyword_value = 'UNSPECIFIED' THEN
          return_attributes.job_submission_option [nfc$iqa_magnetic_tape_limit].magnetic_tape_limit :=
                jmc$unspecified_mag_tape_limit;
        ELSEIF pvt [p$magnetic_tape_limit].value^.keyword_value = 'SYSTEM_DEFAULT' THEN
          return_attributes.job_submission_option [nfc$iqa_magnetic_tape_limit].magnetic_tape_limit :=
                jmc$system_default_mag_tape_lim;
        ELSE { pvt [p$magnetic_tape_limit].value^.keyword_value = 'UNLIMITED'.
          return_attributes.job_submission_option [nfc$iqa_magnetic_tape_limit].magnetic_tape_limit :=
                jmc$unlimited_mag_tape_limit;
        IFEND;
      IFEND;
    IFEND;

{ If specified process MAXIMUM_WORKING_SET parameter.

    IF pvt [p$maximum_working_set].specified THEN
      return_attributes.job_submission_option [nfc$iqa_maximum_working_set].key := jmc$maximum_working_set;
      IF pvt [p$maximum_working_set].value^.kind = clc$integer THEN
        return_attributes.job_submission_option [nfc$iqa_maximum_working_set].maximum_working_set :=
              pvt [p$maximum_working_set].value^.integer_value.value;
      ELSE
        IF pvt [p$maximum_working_set].value^.keyword_value = 'UNSPECIFIED' THEN
          return_attributes.job_submission_option [nfc$iqa_maximum_working_set].maximum_working_set :=
                jmc$unspecified_work_set_size;
        ELSEIF pvt [p$maximum_working_set].value^.keyword_value = 'SYSTEM_DEFAULT' THEN
          return_attributes.job_submission_option [nfc$iqa_maximum_working_set].maximum_working_set :=
                jmc$system_default_work_set_siz;
        ELSE { pvt [p$maximum_working_set].value^.keyword_value = 'UNLIMITED'.
          return_attributes.job_submission_option [nfc$iqa_maximum_working_set].maximum_working_set :=
                jmc$unlimited_working_set_size;
        IFEND;
      IFEND;
    IFEND;

{ If specified process OPERATOR_FAMILY parameter.

    IF pvt [p$operator_family].specified THEN
      return_attributes.job_submission_option [nfc$iqa_operator_family].key := jmc$output_destination_family;
      return_attributes.job_submission_option [nfc$iqa_operator_family].output_destination_family :=
            pvt [p$operator_family].value^.name_value;
    IFEND;

{ If specified process OPERATOR_USER parameter.

    IF pvt [p$operator_user].specified THEN
      return_attributes.job_submission_option [nfc$iqa_operator_user].key := jmc$station_operator;
      return_attributes.job_submission_option [nfc$iqa_operator_user].station_operator :=
            pvt [p$operator_user].value^.name_value;
    IFEND;

{ If specified process OUTPUT_DISPOSITION parameter.

    IF pvt [p$output_disposition].specified THEN
      return_attributes.job_submission_option [nfc$iqa_output_disposition].key := jmc$output_disposition;
      IF pvt [p$output_disposition].value^.kind = clc$file THEN
        output_disposition_path := pvt [p$output_disposition].value^.file_value^;
        return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
              jmc$standard_output_path;
        return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition
              .standard_output_path := ^output_disposition_path;
      ELSE
        IF pvt [p$output_disposition].value^.keyword_value = 'PRINTER' THEN
          return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
                jmc$normal_output_disposition;
          change_implicit_text_wait_queue (FALSE);
        ELSEIF pvt [p$output_disposition].value^.keyword_value = 'DISCARD_ALL_OUTPUT' THEN
          return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
                jmc$discard_all_output;
        ELSEIF pvt [p$output_disposition].value^.keyword_value = 'DISCARD_STANDARD_OUTPUT' THEN
          return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
                jmc$discard_standard_output;
        ELSEIF pvt [p$output_disposition].value^.keyword_value = 'LOCAL' THEN
          return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
                jmc$local_output_disposition;
        ELSE { pvt [p$output_disposition].value^.keyword_value = 'WAIT_QUEUE'.
          return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
                jmc$wait_queue_path;
          return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition
                .wait_queue_path := NIL;
          change_implicit_text_wait_queue (TRUE);
        IFEND;
      IFEND;
    IFEND;

{ If specified process REMOTE_HOST_DIRECTIVE parameter.

    IF pvt [p$remote_host_directive].specified THEN
      output_remote_host_directive.size := STRLENGTH (pvt [p$remote_host_directive].value^.string_value^);
      output_remote_host_directive.parameters := pvt [p$remote_host_directive].value^.string_value^;
      return_attributes.job_submission_option [nfc$iqa_remote_host_directive].key :=
            jmc$remote_host_directive;
      return_attributes.job_submission_option [nfc$iqa_remote_host_directive].remote_host_directive :=
            ^output_remote_host_directive;
    IFEND;

{ If specified process SRU_LIMIT parameter.

    IF pvt [p$sru_limit].specified THEN
      return_attributes.job_submission_option [nfc$iqa_sru_limit].key := jmc$sru_limit;
      IF pvt [p$sru_limit].value^.kind = clc$integer THEN
        return_attributes.job_submission_option [nfc$iqa_sru_limit].sru_limit :=
              pvt [p$sru_limit].value^.integer_value.value;
      ELSE
        IF pvt [p$sru_limit].value^.keyword_value = 'UNSPECIFIED' THEN
          return_attributes.job_submission_option [nfc$iqa_sru_limit].sru_limit := jmc$unspecified_sru_limit;
        ELSEIF pvt [p$sru_limit].value^.keyword_value = 'SYSTEM_DEFAULT' THEN
          return_attributes.job_submission_option [nfc$iqa_sru_limit].sru_limit :=
                jmc$system_default_sru_limit;
        ELSE { pvt [p$sru_limit].value^.keyword_value = 'UNLIMITED'.
          return_attributes.job_submission_option [nfc$iqa_sru_limit].sru_limit := jmc$unlimited_sru_limit;
        IFEND;
      IFEND;
    IFEND;

{ If specified process STATION parameter.

    IF pvt [p$station].specified THEN
      return_attributes.job_submission_option [nfc$iqa_station].key := jmc$station;
      IF pvt [p$station].value^.kind = clc$keyword THEN
        return_attributes.job_submission_option [nfc$iqa_station].station :=
              pvt [p$station].value^.keyword_value;
      ELSE
        return_attributes.job_submission_option [nfc$iqa_station].station := pvt [p$station].value^
              .name_value;
      IFEND;
    IFEND;

{ If specified process USER_INFORMATION parameter.

    IF pvt [p$user_information].specified THEN
      output_user_information := pvt [p$user_information].value^.string_value^;
      return_attributes.job_submission_option [nfc$iqa_user_information].key := jmc$user_information;
      return_attributes.job_submission_option [nfc$iqa_user_information].user_information :=
            ^output_user_information;
    IFEND;

{ Get USER_JOB_NAME if it was specified

    IF pvt [p$user_job_name].specified THEN
      return_attributes.job_submission_option [nfc$iqa_user_job_name].key := jmc$user_job_name;
      return_attributes.job_submission_option [nfc$iqa_user_job_name].user_job_name :=
            pvt [p$user_job_name].value^.name_value;
    IFEND;

  PROCEND crack_submit_job_command;
?? TITLE := 'crack_system_routing_text', EJECT ??

{ PURPOSE:
{   This procedure will take the systems routing text string and cracks it
{   into job/print attributes.  The systems routing text is not defined in any
{   document.  The format of the systems routing text is:
{     CYB keyword= value, keyword= value, ...
{   Spaces are ignored.

  PROCEDURE crack_system_routing_text
    (    system_routing_text: jmt$system_routing_text;
         queue_file_type: nft$queue_file_type;
         no_override_output_attribs: nft$output_queue_attributes_set;
         no_override_input_attribs: nft$input_queue_attributes_set;
     VAR return_attributes: nft$queue_submission_option;
     VAR status: ost$status);

    CONST
      keyword_minimum_length = 2,
      keyword_maximum_length = 3,
      keyword_terminator = '=',
      maximum_account_length = 2 * maximum_attribute_length,
      maximum_attribute_length = 7,
      maximum_project_length = 4 * maximum_attribute_length,
      number_srt_tokens = 30,
      skip_character = ' ',
      srt_header_position = 1,
      text_terminator = '.',
      value_terminator = ',';

    TYPE
      srt_parsing_table = record
        keyword_name: string (keyword_maximum_length),
        keyword_length: keyword_minimum_length .. keyword_maximum_length,
        input_attribute: nft$input_queue_attributes,
        output_attribute: nft$output_queue_attributes,
      recend;

    VAR
      account_length: 0 .. maximum_account_length,
      account_value: string (maximum_account_length),
      integer_record: clt$integer,
      keyword_error_text: [STATIC] string (23) := 'Invalid SRT keyword    ',
      keyword_index: integer,
      new_name_value: ost$name,
      project_length: 0 .. maximum_project_length,
      project_value: string (maximum_project_length),
      srt_tokens: [STATIC, READ] array [1 .. number_srt_tokens] of srt_parsing_table := [
            ['CFM', 3, nfc$iqa_control_family, nfc$oqa_control_family],
            ['CH1', 3, nfc$iqa_null_attribute, nfc$oqa_login_account],
            ['CH2', 3, nfc$iqa_null_attribute, nfc$oqa_login_account],
            ['CUN', 3, nfc$iqa_control_user, nfc$oqa_control_user],
            ['DAY', 3, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['DC', 2, nfc$iqa_disposition_code, nfc$oqa_disposition_code],
            ['DO', 2, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['EC', 2, nfc$iqa_external_characteristic, nfc$oqa_external_characteristic],
            ['FC', 2, nfc$iqa_forms_code, nfc$oqa_forms_code],
            ['FID', 3, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['FM', 2, nfc$iqa_operator_family, nfc$oqa_operator_family],
            ['IC', 2, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['ID', 2, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['OFM', 3, nfc$iqa_control_family, nfc$oqa_login_family],
            ['OT', 2, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['OUN', 3, nfc$iqa_control_user, nfc$oqa_login_user],
            ['PI', 2, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['PJ1', 3, nfc$iqa_null_attribute, nfc$oqa_login_project],
            ['PJ2', 3, nfc$iqa_null_attribute, nfc$oqa_login_project],
            ['PJ3', 3, nfc$iqa_null_attribute, nfc$oqa_login_project],
            ['PJ4', 3, nfc$iqa_null_attribute, nfc$oqa_login_project],
            ['PRI', 3, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['PW1', 3, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['PW2', 3, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['REP', 3, nfc$iqa_copies, nfc$oqa_copies],
            ['SC', 2, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['SCL', 3, nfc$iqa_null_attribute, nfc$oqa_output_class],
            ['TID', 3, nfc$iqa_null_attribute, nfc$oqa_null_attribute],
            ['UJN', 3, nfc$iqa_user_job_name, nfc$oqa_user_file_name],
            ['UN', 2, nfc$iqa_operator_user, nfc$oqa_operator_user]],
      text_position: 1 .. jmc$system_routing_text_size,
      token: string (maximum_attribute_length),
      token_index: 0 .. number_srt_tokens,
      token_length: 0 .. maximum_attribute_length;

    status.normal := TRUE;

{ The first three characters must be CYB, else I cannot crack it and
{ should pass it on to a possible next hop (application).

    IF system_routing_text.size < nfc$p32_cyber_id_length THEN
      RETURN; { Cannot process }
    IFEND;
    IF system_routing_text.parameters (srt_header_position, nfc$p32_cyber_id_length) <> nfc$p32_cyber_id THEN
      RETURN; { Cannot process }
    IFEND;

    text_position := nfc$p32_cyber_id_length + 1;
    account_length := 0;
    project_length := 0;

  /parse_system_routing_text_loop/
    WHILE text_position <= system_routing_text.size DO

{ Get the keyword.

      token_length := 0;
      token := '';

      WHILE (text_position <= system_routing_text.size) AND (system_routing_text.parameters (text_position, 1)
            <> keyword_terminator) DO

{ Eliminate any spaces, commas or periods before or during the keyword.

        IF NOT ((system_routing_text.parameters (text_position, 1) = skip_character) OR
              (system_routing_text.parameters (text_position, 1) = value_terminator) OR
              (system_routing_text.parameters (text_position, 1) = text_terminator)) THEN
          token_length := token_length + 1;
          token (token_length, 1) := system_routing_text.parameters (text_position, 1);
        IFEND;
        text_position := text_position + 1;
      WHILEND;

{ increment text_position to account for the keyword terminator

      text_position := text_position + 1;

{ An error has occurred if the system_routing_text has been exhausted while searching for a keyword.

      IF (text_position > system_routing_text.size) AND (token_length >0) THEN
        keyword_error_text (20, keyword_maximum_length) := token (1, token_length);
        osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error, keyword_error_text, status);
        RETURN;
      ELSEIF (text_position > system_routing_text.size) THEN
        EXIT /parse_system_routing_text_loop/;
      IFEND;

      keyword_index := 0;
    /find_keyword/
      FOR token_index := LOWERBOUND (srt_tokens) TO UPPERBOUND (srt_tokens) DO
        IF (token_length = srt_tokens [token_index].keyword_length) AND
              (token (1, token_length) = srt_tokens [token_index].keyword_name) THEN
          keyword_index := token_index;
          EXIT /find_keyword/;
        IFEND;
      FOREND /find_keyword/;

      IF keyword_index = 0 THEN {** Unknown keyword **}
        keyword_error_text (20, keyword_maximum_length) := token (1, token_length);
        osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error, keyword_error_text, status);
        RETURN;
      IFEND;

{ Get the keyword value.

      token_length := 0;
      token := '';

      WHILE (text_position <= system_routing_text.size) AND (NOT ((system_routing_text.parameters
            (text_position, 1) = value_terminator) OR (system_routing_text.parameters (text_position, 1) =
            text_terminator))) DO
        token_length := token_length + 1;
        token (token_length, 1) := system_routing_text.parameters (text_position, 1);
        text_position := text_position + 1;
      WHILEND;

      IF queue_file_type = nfc$print_queue_file THEN
        IF NOT (srt_tokens [keyword_index].output_attribute IN no_override_output_attribs) THEN
          CASE srt_tokens [keyword_index].output_attribute OF
          = nfc$oqa_control_family =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.output_submission_option [nfc$oqa_control_family].key := jmc$control_family;
            return_attributes.output_submission_option [nfc$oqa_control_family].control_family :=
                  new_name_value;

          = nfc$oqa_control_user =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.output_submission_option [nfc$oqa_control_user].key := jmc$control_user;
            return_attributes.output_submission_option [nfc$oqa_control_user].control_user := new_name_value;

          = nfc$oqa_copies =
            clp$convert_string_to_integer (token (1, token_length), integer_record, status);
            IF NOT status.normal THEN
              RETURN;
            IFEND;
            return_attributes.output_submission_option [nfc$oqa_copies].key := jmc$copies;
            return_attributes.output_submission_option [nfc$oqa_copies].copies := integer_record.value + 1;

          = nfc$oqa_disposition_code =
            IF (token (1, token_length) = nfc$p32_cyb_wait_queue_value_wt) OR
                  (token (1, token_length) = nfc$p32_cyb_wait_queue_value_tt) THEN
              osp$set_status_abnormal (nfc$status_id, nfe$prif_to_wait_queue_not_sup, '', status);
              RETURN;
            IFEND;
            return_attributes.output_submission_option [nfc$oqa_disposition_code].key := jmc$disposition_code;
            return_attributes.output_submission_option [nfc$oqa_disposition_code].disposition_code :=
                  token (1, token_length);

          = nfc$oqa_external_characteristic =
            return_attributes.output_submission_option [nfc$oqa_external_characteristic].key :=
                  jmc$external_characteristics;
            return_attributes.output_submission_option [nfc$oqa_external_characteristic]
                  .external_characteristics := token (1, token_length);

          = nfc$oqa_forms_code =
            return_attributes.output_submission_option [nfc$oqa_forms_code].key := jmc$forms_code;
            return_attributes.output_submission_option [nfc$oqa_forms_code].forms_code :=
                  token (1, token_length);

          = nfc$oqa_login_account =
            account_value ((account_length + 1), token_length) := token;
            account_length := account_length + token_length;

          = nfc$oqa_login_family =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.output_submission_option [nfc$oqa_login_family].key := jmc$login_family;
            return_attributes.output_submission_option [nfc$oqa_login_family].login_family :=
                  new_name_value;

          = nfc$oqa_login_project =
            project_value ((project_length + 1), token_length) := token;
            project_length := project_length + token_length;

          = nfc$oqa_login_user =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.output_submission_option [nfc$oqa_login_user].key := jmc$login_user;
            return_attributes.output_submission_option [nfc$oqa_login_user].login_user := new_name_value;

          = nfc$oqa_null_attribute =

          = nfc$oqa_operator_family =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.output_submission_option [nfc$oqa_operator_family].key :=
                  jmc$output_destination_family;
            return_attributes.output_submission_option [nfc$oqa_operator_family].output_destination_family :=
                  new_name_value;

          = nfc$oqa_operator_user =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.output_submission_option [nfc$oqa_operator_user].key := jmc$station_operator;
            return_attributes.output_submission_option [nfc$oqa_operator_user].station_operator :=
                  new_name_value;

          = nfc$oqa_output_class =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);

{ Convert all non-NOS/VE output classes to those known to NOS/VE.
{ Currently the only valid NOS/VE output class is 'NORMAL'.

            IF new_name_value <> nfc$normal_string THEN
              new_name_value := nfc$normal_string;
            IFEND;
            return_attributes.output_submission_option [nfc$oqa_output_class].key := jmc$output_class;
            return_attributes.output_submission_option [nfc$oqa_output_class].output_class :=
                  new_name_value;

          = nfc$oqa_user_file_name =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.output_submission_option [nfc$oqa_user_file_name].key := jmc$user_file_name;
            return_attributes.output_submission_option [nfc$oqa_user_file_name].user_file_name :=
                  new_name_value;
          ELSE
          CASEND;
        IFEND;
      ELSE
        IF NOT (srt_tokens [keyword_index].input_attribute IN no_override_input_attribs) THEN
          CASE srt_tokens [keyword_index].input_attribute OF
          = nfc$iqa_control_family =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.job_submission_option [nfc$iqa_control_family].key := jmc$control_family;
            return_attributes.job_submission_option [nfc$iqa_control_family].control_family :=
                  new_name_value;

          = nfc$iqa_control_user =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.job_submission_option [nfc$iqa_control_user].key := jmc$control_user;
            return_attributes.job_submission_option [nfc$iqa_control_user].control_user := new_name_value;

          = nfc$iqa_copies =
            clp$convert_string_to_integer (token (1, token_length), integer_record, status);
            IF NOT status.normal THEN
              RETURN;
            IFEND;
            return_attributes.job_submission_option [nfc$iqa_copies].key := jmc$copies;
            return_attributes.job_submission_option [nfc$iqa_copies].copies := integer_record.value + 1;

          = nfc$iqa_disposition_code =
            IF (token (1, token_length) = nfc$p32_cyb_input_wait_queue_to) THEN
              return_attributes.job_submission_option [nfc$iqa_output_disposition].key :=
                    jmc$output_disposition;
              return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
                    jmc$wait_queue_path;
            ELSEIF (token (1, token_length) = nfc$p32_cyb_input_no_return_no) THEN
              return_attributes.job_submission_option [nfc$iqa_output_disposition].key :=
                    jmc$output_disposition;
              return_attributes.job_submission_option [nfc$iqa_output_disposition].output_disposition.key :=
                    jmc$discard_standard_output;
            IFEND;
            return_attributes.job_submission_option [nfc$iqa_disposition_code].key := jmc$disposition_code;
            return_attributes.job_submission_option [nfc$iqa_disposition_code].disposition_code :=
                  token (1, token_length);

          = nfc$iqa_external_characteristic =
            return_attributes.job_submission_option [nfc$iqa_external_characteristic].key :=
                  jmc$external_characteristics;
            return_attributes.job_submission_option [nfc$iqa_external_characteristic]
                  .external_characteristics := token (1, token_length);

          = nfc$iqa_forms_code =
            return_attributes.job_submission_option [nfc$iqa_forms_code].key := jmc$forms_code;
            return_attributes.job_submission_option [nfc$iqa_forms_code].forms_code :=
                  token (1, token_length);

          = nfc$iqa_null_attribute =

          = nfc$iqa_operator_family =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.job_submission_option [nfc$iqa_operator_family].key :=
                  jmc$output_destination_family;
            return_attributes.job_submission_option [nfc$iqa_operator_family].output_destination_family :=
                 new_name_value;

          = nfc$iqa_operator_user =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.job_submission_option [nfc$iqa_operator_user].key := jmc$station_operator;
            return_attributes.job_submission_option [nfc$iqa_operator_user].station_operator :=
                  new_name_value;

          = nfc$iqa_user_job_name =
            convert_string_to_ost$name (token (1, token_length), user_job_name_prefix, new_name_value);
            return_attributes.job_submission_option [nfc$iqa_user_job_name].key := jmc$user_job_name;
            return_attributes.job_submission_option [nfc$iqa_user_job_name].user_job_name :=
                  new_name_value;
          ELSE
          CASEND;
        IFEND;
      IFEND;

{ increment text_position to account for the keyword value terminator

      text_position := text_position + 1;
    WHILEND /parse_system_routing_text_loop/;

    IF queue_file_type = nfc$print_queue_file THEN
      IF account_length > 0 THEN
        convert_string_to_ost$name (account_value (1, account_length), charge_prefix_character,
              new_name_value);
        return_attributes.output_submission_option [nfc$oqa_login_account].key := jmc$login_account;
        return_attributes.output_submission_option [nfc$oqa_login_account].login_account := new_name_value;
      IFEND;

      IF project_length > 0 THEN
        convert_string_to_ost$name (project_value (1, project_length), project_prefix_character,
              new_name_value);
        return_attributes.output_submission_option [nfc$oqa_login_project].key := jmc$login_project;
        return_attributes.output_submission_option [nfc$oqa_login_project].login_project := new_name_value;
      IFEND;

      IF return_attributes.output_submission_option [nfc$oqa_operator_family].key = jmc$null_attribute THEN
        return_attributes.output_submission_option [nfc$oqa_operator_family].key :=
              jmc$output_destination_family;
        IF return_attributes.output_submission_option [nfc$oqa_control_family].key <> jmc$null_attribute THEN
          return_attributes.output_submission_option [nfc$oqa_operator_family].output_destination_family :=
                return_attributes.output_submission_option [nfc$oqa_control_family].control_family;
        ELSE
          return_attributes.output_submission_option [nfc$oqa_operator_family].output_destination_family :=
                'NONE';
        IFEND;
      IFEND;

      IF return_attributes.output_submission_option [nfc$oqa_operator_user].key = jmc$null_attribute THEN
        return_attributes.output_submission_option [nfc$oqa_operator_user].key := jmc$station_operator;
        IF return_attributes.output_submission_option [nfc$oqa_control_user].key <> jmc$null_attribute THEN
          return_attributes.output_submission_option [nfc$oqa_operator_user].station_operator :=
                return_attributes.output_submission_option [nfc$oqa_control_user].control_user;
        ELSE
          return_attributes.output_submission_option [nfc$oqa_operator_user].station_operator := 'NONE';
        IFEND;
      IFEND;
    ELSE
      IF return_attributes.job_submission_option [nfc$iqa_operator_family].key = jmc$null_attribute THEN
        return_attributes.job_submission_option [nfc$iqa_operator_family].key :=
              jmc$output_destination_family;
        IF return_attributes.job_submission_option [nfc$iqa_control_family].key <> jmc$null_attribute THEN
          return_attributes.job_submission_option [nfc$iqa_operator_family].output_destination_family :=
                return_attributes.job_submission_option [nfc$iqa_control_family].control_family;
        ELSE
          return_attributes.job_submission_option [nfc$iqa_operator_family].output_destination_family :=
                'NONE';
        IFEND;
      IFEND;

      IF return_attributes.job_submission_option [nfc$iqa_operator_user].key = jmc$null_attribute THEN
        return_attributes.job_submission_option [nfc$iqa_operator_user].key :=
              jmc$output_destination_family;
        IF return_attributes.job_submission_option [nfc$iqa_control_user].key <> jmc$null_attribute THEN
          return_attributes.job_submission_option [nfc$iqa_operator_user].station_operator :=
                return_attributes.job_submission_option [nfc$iqa_control_user].control_user;
        ELSE
          return_attributes.job_submission_option [nfc$iqa_operator_user].station_operator := 'NONE';
        IFEND;
      IFEND;
    IFEND;
  PROCEND crack_system_routing_text;
?? TITLE := 'create_queue_file_attributes', EJECT ??

{ PURPOSE:
{   This procedure will create the attributes for a queue file based on A-A protocol.
{   This procedure will take the protocol elements sent by the client task and
{   creates the queue file attributes for the transfer.  The attributes are keyed
{   primarily off of the initiating host type, and received protocol elements.

  PROCEDURE create_queue_file_attributes
    (    file_name: amt$local_file_name;
         store_and_forward_queue_file: boolean;
         remote_host_type: nft$parameter_22_values;
         data_declaration: nft$parameter_31_type;
         disposition_code: nft$parameter_17_definition;
         destination_family: string ( * <= nfc$p25_max_param_size);
         source_lid: string ( * <= nfc$p24_max_param_size);
         store_forward_application_name: ost$name;
         system_routing_text: jmt$system_routing_text;
         implicit_routing_text: jmt$implicit_routing_text;
         explicit_routing_text: nft$directive_entry_list_head;
         transfer_mode: nft$transfer_modes;
         protocol_job_name: string ( * <= nfc$p26_max_param_length);
         system_supplied_name: string ( * <= nfc$p16_max_param_length);
         queue_file_type: nft$queue_file_type;
         loop_back_transfer: boolean;
         echo_text_login_family: ost$name;
         transfer_pid: string ( * <= nfc$p27_max_param_size);
         file_is_qtfi_err_file: boolean;
     VAR input_accounting_data: qtfs_input_accounting_data;
     VAR queue_file_attributes: nft$queue_submission_option;
     VAR overridden_jad_odu: boolean;
     VAR queue_file_page_width:amt$page_width;
     VAR status: ost$status);

    VAR
      attribute_results: ^jmt$default_attribute_results,
      generic_queue_attributes_index: nft$generic_queue_attributes,
      input_queue_attributes_index: nft$input_queue_attributes,
      new_name_value: ost$name,
      nos_ve_implicit_text: boolean,
      output_queue_attributes_index: nft$output_queue_attributes,
      srt_no_override_output_attribs: nft$output_queue_attributes_set;

{ Initialize variables

    status.normal := TRUE;
    overridden_jad_odu := FALSE;
    nos_ve_implicit_text := FALSE;

{ Set all attributes to null for input and output queue files. Set appropriate ORIGIN_APPLICATION_NAME.

    IF queue_file_type = nfc$job_queue_file THEN
      queue_file_attributes.queue_file_type := nfc$job_queue_file;
      FOR input_queue_attributes_index := LOWERVALUE (input_queue_attributes_index) TO
            UPPERVALUE (input_queue_attributes_index) DO
        queue_file_attributes.job_submission_option [input_queue_attributes_index].key := jmc$null_attribute;
      FOREND;

{ Set ORIGIN_APPLICATION_NAME to qtf_server

      queue_file_attributes.job_submission_option [nfc$iqa_origin_application_name].key :=
            jmc$origin_application_name;
      queue_file_attributes.job_submission_option [nfc$iqa_origin_application_name].origin_application_name :=
            osc$queue_transfer_server;
    ELSEIF queue_file_type = nfc$print_queue_file THEN
      queue_file_attributes.queue_file_type := nfc$print_queue_file;
      FOR output_queue_attributes_index := LOWERVALUE (output_queue_attributes_index)
            TO UPPERVALUE (output_queue_attributes_index) DO
        queue_file_attributes.output_submission_option [output_queue_attributes_index].key :=
              jmc$null_attribute;
      FOREND;

      IF file_is_qtfi_err_file THEN
        queue_file_attributes.output_submission_option [nfc$oqa_origin_application_name].key :=
              jmc$origin_application_name;
        queue_file_attributes.output_submission_option [nfc$oqa_origin_application_name]
              .origin_application_name := osc$queue_transfer_client;
      ELSE
        queue_file_attributes.output_submission_option [nfc$oqa_origin_application_name].key :=
              jmc$origin_application_name;
        queue_file_attributes.output_submission_option [nfc$oqa_origin_application_name]
              .origin_application_name := osc$queue_transfer_server;
      IFEND;
    ELSEIF queue_file_type = nfc$generic_queue_file THEN
      queue_file_attributes.queue_file_type := nfc$generic_queue_file;
      FOR generic_queue_attributes_index := LOWERVALUE (generic_queue_attributes_index) TO
            UPPERVALUE (generic_queue_attributes_index) DO
        queue_file_attributes.qfile_submission_option [generic_queue_attributes_index].key
              := jmc$null_attribute;
      FOREND;
    IFEND;

{ Set up default attributes

    PUSH attribute_results: [1 .. 2];
    attribute_results^ [1].key := jmc$output_destination_usage;
    attribute_results^ [2].key := jmc$login_family;
    jmp$get_attribute_defaults (jmc$batch, attribute_results, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    IF store_and_forward_queue_file THEN
      IF queue_file_type = nfc$job_queue_file THEN

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN

{ If job is from a non-NOS/VE system, set the CONTROL_FAMILY to NONE

          queue_file_attributes.job_submission_option [nfc$iqa_control_family].key := jmc$control_family;
          queue_file_attributes.job_submission_option [nfc$iqa_control_family].control_family := 'NONE';

{ If job is from a non-NOS/VE system, set the CONTROL_USER to NONE

          queue_file_attributes.job_submission_option [nfc$iqa_control_user].key := jmc$control_user;
          queue_file_attributes.job_submission_option [nfc$iqa_control_user].control_user := 'NONE';
        IFEND;

{ If specified set up the DATA_DECLARATION

        IF (data_declaration <> nfc$p31_unspecified) AND (data_declaration <> nfc$p31_host_dependent_uh) THEN
          queue_file_attributes.job_submission_option [nfc$iqa_data_declaration].key := jmc$data_declaration;
          queue_file_attributes.job_submission_option [nfc$iqa_data_declaration].data_declaration :=
                nfv$parameter_31_values [data_declaration];
        IFEND;

{ Set up the DATA_MODE if rhf_structure

        IF transfer_mode = nfc$rhf_structured_mode THEN
          queue_file_attributes.job_submission_option [nfc$iqa_data_mode].key := jmc$data_mode;
          queue_file_attributes.job_submission_option [nfc$iqa_data_mode].data_mode := jmc$rhf_structure;
        IFEND;

{ Set up the DISPOSITION_CODE

        queue_file_attributes.job_submission_option [nfc$iqa_disposition_code].key :=
              jmc$disposition_code;
        queue_file_attributes.job_submission_option [nfc$iqa_disposition_code].disposition_code :=
              nfv$parameter_17_values [disposition_code];

{ Set up the IMPLICIT_ROUTING_TEXT

        output_implicit_routing_text := implicit_routing_text;
        queue_file_attributes.job_submission_option [nfc$iqa_implicit_routing_text].key :=
              jmc$implicit_routing_text;
        queue_file_attributes.job_submission_option [nfc$iqa_implicit_routing_text].implicit_routing_text :=
              ^output_implicit_routing_text;

{ Set up the JOB_DESTINATION

        convert_string_to_ost$name (destination_family, user_job_name_prefix, new_name_value);
        queue_file_attributes.job_submission_option [nfc$iqa_job_destination].key :=
              jmc$job_destination_family;
        queue_file_attributes.job_submission_option [nfc$iqa_job_destination].job_destination_family :=
              new_name_value;

{ Set up the JOB_DESTINATION_USAGE

        convert_string_to_ost$name (store_forward_application_name, user_job_name_prefix, new_name_value);
        queue_file_attributes.job_submission_option [nfc$iqa_job_destination_usage].key :=
              jmc$job_destination_usage;
        queue_file_attributes.job_submission_option [nfc$iqa_job_destination_usage].job_destination_usage :=
              new_name_value;

{ Set up the LOGIN_COMMAND_SUPPLIED

        queue_file_attributes.job_submission_option [nfc$iqa_login_command_supplied].key :=
              jmc$login_command_supplied;
        queue_file_attributes.job_submission_option [nfc$iqa_login_command_supplied]
              .login_command_supplied := FALSE;

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN

{ If job is from a non-NOS/VE system, set the OPERATOR_FAMILY to NONE

          queue_file_attributes.job_submission_option [nfc$iqa_operator_family].key :=
                jmc$output_destination_family;
          queue_file_attributes.job_submission_option [nfc$iqa_operator_family].output_destination_family :=
                'NONE';

{ If job is from a non-NOS/VE system, set the OPERATOR_USER to NONE

          queue_file_attributes.job_submission_option [nfc$iqa_operator_user].key := jmc$station_operator;
          queue_file_attributes.job_submission_option [nfc$iqa_operator_user].station_operator := 'NONE';
        IFEND;

{ Set up the OUTPUT_DESTINATION

        convert_string_to_ost$name (source_lid, user_job_name_prefix, new_name_value);
        queue_file_attributes.job_submission_option [nfc$iqa_output_destination].key :=
              jmc$output_destination;
        queue_file_attributes.job_submission_option [nfc$iqa_output_destination].output_destination :=
              new_name_value;

{ If the output is to be returned to the originating user, set the OUTPUT_DESTIANTION_USAGE to QTF

        IF disposition_code = nfc$p17_input_return THEN
          queue_file_attributes.job_submission_option [nfc$iqa_output_dest_usage].key :=
                jmc$output_destination_usage;
          queue_file_attributes.job_submission_option [nfc$iqa_output_dest_usage]
                .output_destination_usage := jmc$qtf_usage;
        IFEND;

{ Set up the REMOTE_HOST_DIRECTIVE

        IF explicit_routing_text.head <> NIL THEN
          output_remote_host_directive.size := STRLENGTH (explicit_routing_text.head^.line);
          output_remote_host_directive.parameters := explicit_routing_text.head^.line;
          queue_file_attributes.job_submission_option [nfc$iqa_remote_host_directive].key :=
                jmc$remote_host_directive;
          queue_file_attributes.job_submission_option [nfc$iqa_remote_host_directive].remote_host_directive
                := ^output_remote_host_directive;
        IFEND;

{ Set up the SOURCE_LOGICAL_ID

        queue_file_attributes.job_submission_option [nfc$iqa_source_logical_id].key :=
              jmc$source_logical_id;
        queue_file_attributes.job_submission_option [nfc$iqa_source_logical_id].source_logical_id :=
              source_lid;

{ If the previous system was NOS/VE then save the previous SYSTEM_JOB_NAME

        IF ((remote_host_type = nfc$p22_nos_ve) OR (remote_host_type = nfc$p22_nos_ve_qtf)) AND
              (NOT loop_back_transfer) THEN
          queue_file_attributes.job_submission_option [nfc$iqa_system_job_name].key := jmc$system_job_name;
          queue_file_attributes.job_submission_option [nfc$iqa_system_job_name].system_job_name :=
                system_supplied_name;
        IFEND;

{ Set up the SYSTEM_ROUTING_TEXT

        output_system_routing_text := system_routing_text;
        queue_file_attributes.job_submission_option [nfc$iqa_system_routing_text].key :=
              jmc$system_routing_text;
        queue_file_attributes.job_submission_option [nfc$iqa_system_routing_text].system_routing_text :=
              ^output_system_routing_text;

{ Set up the USER_JOB_NAME

        IF protocol_job_name <> '' THEN
          convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
          queue_file_attributes.job_submission_option [nfc$iqa_user_job_name].key :=
                jmc$user_job_name;
          queue_file_attributes.job_submission_option [nfc$iqa_user_job_name].user_job_name :=
                new_name_value;
        IFEND;

      ELSEIF queue_file_type = nfc$print_queue_file THEN { Store/Forward Output file.

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN

{ If job is from a non-NOS/VE system, set the COMMENT_BANNER to the user_file_name

          IF protocol_job_name <> '' THEN
            convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
            queue_file_attributes.output_submission_option [nfc$oqa_comment_banner].key := jmc$comment_banner;
            queue_file_attributes.output_submission_option [nfc$oqa_comment_banner].comment_banner :=
                  new_name_value;
          IFEND;

{ If job is from a non-NOS/VE system, set the CONTROL_FAMILY to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_control_family].key := jmc$control_family;
          queue_file_attributes.output_submission_option [nfc$oqa_control_family].control_family := 'NONE';

{ If job is from a non-NOS/VE system, set the CONTROL_USER to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_control_user].key := jmc$control_user;
          queue_file_attributes.output_submission_option [nfc$oqa_control_user].control_user := 'NONE';
        IFEND;

{ If specified set up the DATA_DECLARATION

        IF (data_declaration <> nfc$p31_unspecified) AND (data_declaration <> nfc$p31_host_dependent_uh) THEN
          queue_file_attributes.output_submission_option [nfc$oqa_data_declaration].key :=
                jmc$data_declaration;
          queue_file_attributes.output_submission_option [nfc$oqa_data_declaration].data_declaration :=
                nfv$parameter_31_values [data_declaration];
        IFEND;

{ If rhf_structure set up the DATA_MODE

        IF transfer_mode = nfc$rhf_structured_mode THEN
          queue_file_attributes.output_submission_option [nfc$oqa_data_mode].key := jmc$data_mode;
          queue_file_attributes.output_submission_option [nfc$oqa_data_mode].data_mode := jmc$rhf_structure;
        IFEND;

{ Set up the DISPOSITION_CODE

        queue_file_attributes.output_submission_option [nfc$oqa_disposition_code].key :=
              jmc$disposition_code;
        queue_file_attributes.output_submission_option [nfc$oqa_disposition_code].disposition_code :=
              nfv$parameter_17_values [disposition_code];

{ Save the IMPLICIT_ROUTING_TEXT

        output_implicit_routing_text := implicit_routing_text;
        queue_file_attributes.output_submission_option [nfc$oqa_implicit_routing_text].key :=
              jmc$implicit_routing_text;
        queue_file_attributes.output_submission_option [nfc$oqa_implicit_routing_text].implicit_routing_text
              := ^output_implicit_routing_text;

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN

{ If job is from a non-NOS/VE system, set the LOGIN_ACCOUNT to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_login_account].key := jmc$login_account;
          queue_file_attributes.output_submission_option [nfc$oqa_login_account].login_account := 'NONE';

{ If job is from a non-NOS/VE system, set the LOGIN_FAMILY to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_login_family].key := jmc$login_family;
          queue_file_attributes.output_submission_option [nfc$oqa_login_family].login_family := 'NONE';

{ If job is from a non-NOS/VE system, set the LOGIN_PROJECT to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_login_project].key := jmc$login_project;
          queue_file_attributes.output_submission_option [nfc$oqa_login_project].login_project := 'NONE';

{ If job is from a non-NOS/VE system, set the LOGIN_USER to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_login_user].key := jmc$login_user;
          queue_file_attributes.output_submission_option [nfc$oqa_login_user].login_user := 'NONE';

{ If job is from a non-NOS/VE system, set the OPERATOR_FAMILY to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_operator_family].key :=
                jmc$output_destination_family;
          queue_file_attributes.output_submission_option [nfc$oqa_operator_family].output_destination_family
                := 'NONE';

{ If job is from a non-NOS/VE system, set the OPERATOR_USER to NONE

          queue_file_attributes.output_submission_option [nfc$oqa_operator_user].key := jmc$station_operator;
          queue_file_attributes.output_submission_option [nfc$oqa_operator_user].station_operator := 'NONE';
        IFEND;

{ Set up the OUTPUT_DESTINATION

        convert_string_to_ost$name (destination_family, user_job_name_prefix, new_name_value);
        queue_file_attributes.output_submission_option [nfc$oqa_output_destination].key :=
              jmc$output_destination;
        queue_file_attributes.output_submission_option [nfc$oqa_output_destination].output_destination :=
              new_name_value;

{ Set up the OUTPUT_DESTINATION_USAGE

        convert_string_to_ost$name (store_forward_application_name, user_job_name_prefix, new_name_value);
        queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage].key :=
              jmc$output_destination_usage;
        queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage].output_destination_usage :=
              new_name_value;

{ Set up the REMOTE_HOST_DIRECTIVE

        IF explicit_routing_text.head <> NIL THEN
          output_remote_host_directive.size := STRLENGTH (explicit_routing_text.head^.line);
          output_remote_host_directive.parameters := explicit_routing_text.head^.line;
          queue_file_attributes.output_submission_option [nfc$oqa_remote_host_directive].key :=
                jmc$remote_host_directive;
          queue_file_attributes.output_submission_option [nfc$oqa_remote_host_directive].remote_host_directive
                := ^output_remote_host_directive;
        IFEND;

{ If job is from a non-NOS/VE system, set the ROUTING_BANNER to NONE

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          queue_file_attributes.output_submission_option [nfc$oqa_routing_banner].key := jmc$routing_banner;
          queue_file_attributes.output_submission_option [nfc$oqa_routing_banner].routing_banner := 'NONE';
        IFEND;

{ Set up the SOURCE_LOGICAL_ID

        queue_file_attributes.output_submission_option [nfc$oqa_source_logical_id].key :=
              jmc$source_logical_id;
        queue_file_attributes.output_submission_option [nfc$oqa_source_logical_id].source_logical_id :=
              source_lid;

{ If the previous system was NOS/VE, then save the previous SYSTEM_FILE_NAME

        IF ((remote_host_type = nfc$p22_nos_ve) OR (remote_host_type = nfc$p22_nos_ve_qtf)) AND
              (NOT loop_back_transfer) THEN
          queue_file_attributes.output_submission_option [nfc$oqa_system_file_name].key :=
                jmc$system_file_name;
          queue_file_attributes.output_submission_option [nfc$oqa_system_file_name].system_file_name :=
                system_supplied_name;
        IFEND;

{ Set up the SYSTEM_ROUTING_TEXT

        output_system_routing_text := system_routing_text;
        queue_file_attributes.output_submission_option [nfc$oqa_system_routing_text].key :=
              jmc$system_routing_text;
        queue_file_attributes.output_submission_option [nfc$oqa_system_routing_text].system_routing_text :=
              ^output_system_routing_text;

{ Set up the USER_FILE_NAME

        IF protocol_job_name <> '' THEN
          convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
          queue_file_attributes.output_submission_option [nfc$oqa_user_file_name].key :=
                jmc$user_file_name;
          queue_file_attributes.output_submission_option [nfc$oqa_user_file_name].user_file_name :=
                new_name_value;
        IFEND;

{ If job is from a non-NOS/VE system, set the USER_JOB_NAME to NONE

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          queue_file_attributes.output_submission_option [nfc$oqa_user_job_name].key := jmc$user_job_name;
          queue_file_attributes.output_submission_option [nfc$oqa_user_job_name].user_job_name := 'NONE';
        IFEND;

      ELSEIF queue_file_type = nfc$generic_queue_file THEN { Store/Forward generic queue file.
        convert_string_to_ost$name (destination_family, user_job_name_prefix, new_name_value);
        queue_file_attributes.qfile_submission_option [nfc$gqa_destination].key :=
              jmc$destination;
        queue_file_attributes.qfile_submission_option [nfc$gqa_destination].destination :=
              new_name_value;
      IFEND;

    ELSE { Not store and forward queue file }
      IF ((remote_host_type = nfc$p22_nos_ve) OR (remote_host_type = nfc$p22_nos_ve_qtf)) AND
            (queue_file_type = nfc$job_queue_file) THEN

{ Set communication accounting info in JOB_INPUT_DEVICE attribute for jobs.
{ Note that file size is set later - after the file has been received.

        input_accounting_data.size := #SIZE (nft$qtf_input_accounting_data);
        input_accounting_data.data_block.origin_mainframe_name := source_lid;
        input_accounting_data.data_block.dest_mainframe_name := transfer_pid;
        queue_file_attributes.job_submission_option [nfc$iqa_job_input_device].key := jmc$job_input_device;
        queue_file_attributes.job_submission_option [nfc$iqa_job_input_device].job_input_device :=
               ^input_accounting_data.data_string;
      IFEND;

      CASE disposition_code OF
      = nfc$p17_input_return, nfc$p17_input_no_return =

{ Force the DATA_MODE to CODED_DATA

        queue_file_attributes.job_submission_option [nfc$iqa_data_mode].key := jmc$data_mode;
        queue_file_attributes.job_submission_option [nfc$iqa_data_mode].data_mode := jmc$coded_data;

{ Set DEFAULT_LOGIN_FAMILY so if user did not specify on LOGIN card, it won't
{ default to where QTFS is running ($SYSTEM).

        IF (remote_host_type = nfc$p22_nos_ve) OR (remote_host_type = nfc$p22_nos_ve_qtf) THEN
          IF echo_text_login_family <> osc$null_name  THEN
            convert_string_to_ost$name (echo_text_login_family, user_job_name_prefix, new_name_value);
            queue_file_attributes.job_submission_option [nfc$iqa_default_login_family].key :=
                  jmc$default_login_family;
            queue_file_attributes.job_submission_option [nfc$iqa_default_login_family].default_login_family
                  := new_name_value;
          ELSE
            convert_string_to_ost$name (attribute_results^ [2].login_family, user_job_name_prefix,
                  new_name_value);
            queue_file_attributes.job_submission_option [nfc$iqa_default_login_family].key :=
                  jmc$default_login_family;
            queue_file_attributes.job_submission_option [nfc$iqa_default_login_family].default_login_family
                  := new_name_value;
          IFEND;
        IFEND;

{ Save the IMPLICIT_ROUTING_TEXT

        output_implicit_routing_text := implicit_routing_text;
        queue_file_attributes.job_submission_option [nfc$iqa_implicit_routing_text].key :=
              jmc$implicit_routing_text;
        queue_file_attributes.job_submission_option [nfc$iqa_implicit_routing_text].implicit_routing_text :=
              ^output_implicit_routing_text;

{ Ensure job is executed here by setting JOB_DESTINATION to NULL

        queue_file_attributes.job_submission_option [nfc$iqa_job_destination].key :=
              jmc$job_destination_family;
        queue_file_attributes.job_submission_option [nfc$iqa_job_destination].job_destination_family := ' ';

{ Ensure job is executed here by setting JOB_DESTINATION_USAGE

        queue_file_attributes.job_submission_option [nfc$iqa_job_destination_usage].key :=
              jmc$job_destination_usage;
        queue_file_attributes.job_submission_option [nfc$iqa_job_destination_usage].job_destination_usage
              := jmc$ve_qtf_usage;

{ Force the LOGIN_COMMAND_SUPPLIED to TRUE

        queue_file_attributes.job_submission_option [nfc$iqa_login_command_supplied].key :=
              jmc$login_command_supplied;
        queue_file_attributes.job_submission_option [nfc$iqa_login_command_supplied]
              .login_command_supplied := TRUE;

{ Clear out the REMOTE_HOST_DIRECTIVE so that it is NO longer associated with this job

        output_remote_host_directive.size := 0;
        output_remote_host_directive.parameters := '';
        queue_file_attributes.job_submission_option [nfc$iqa_remote_host_directive].key :=
              jmc$remote_host_directive;
        queue_file_attributes.job_submission_option [nfc$iqa_remote_host_directive].remote_host_directive
              := ^output_remote_host_directive;

{ If the previous system was NOS/VE then save the previous SYSTEM_JOB_NAME

        IF ((remote_host_type = nfc$p22_nos_ve) OR (remote_host_type = nfc$p22_nos_ve_qtf)) AND
              (NOT loop_back_transfer) THEN
          queue_file_attributes.job_submission_option [nfc$iqa_system_job_name].key := jmc$system_job_name;
          queue_file_attributes.job_submission_option [nfc$iqa_system_job_name].system_job_name :=
                system_supplied_name;
        IFEND;

{ Set up the USER_JOB_NAME

        IF protocol_job_name <> '' THEN
          convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
          queue_file_attributes.job_submission_option [nfc$iqa_user_job_name].key :=
                jmc$user_job_name;
          queue_file_attributes.job_submission_option [nfc$iqa_user_job_name].user_job_name
                := new_name_value;
        IFEND;

{ Job executes here and the job output is sent back to the initiating system

        IF disposition_code = nfc$p17_input_return THEN

{ Change the DISPOSITION_CODE to force QTF to set a new one (depending output/job)

          queue_file_attributes.job_submission_option [nfc$iqa_disposition_code].key :=
                jmc$disposition_code;
          queue_file_attributes.job_submission_option [nfc$iqa_disposition_code].disposition_code := '  ';

{ Set OUTPUT_DESTINATION to source logical identifier so initiating mainframe will get output

          queue_file_attributes.job_submission_option [nfc$iqa_output_destination].key :=
                jmc$output_destination;
          queue_file_attributes.job_submission_option [nfc$iqa_output_destination].output_destination :=
                source_lid;

{ Because output is returned, set OUTPUT_DESTINATION_USAGE to QTF

          queue_file_attributes.job_submission_option [nfc$iqa_output_dest_usage].key :=
                jmc$output_destination_usage;
          queue_file_attributes.job_submission_option [nfc$iqa_output_dest_usage]
                .output_destination_usage := jmc$qtf_usage;

{ Set the SOURCE_LOGICAL_ID

          queue_file_attributes.job_submission_option [nfc$iqa_source_logical_id].key :=
                jmc$source_logical_id;
          queue_file_attributes.job_submission_option [nfc$iqa_source_logical_id].source_logical_id :=
                source_lid;

{ Force the generation of a new SYSTEM_ROUTING_TEXT

          output_system_routing_text.size := 0;
          output_system_routing_text.parameters := '';
          queue_file_attributes.output_submission_option [nfc$oqa_system_routing_text].key :=
                jmc$system_routing_text;
          queue_file_attributes.output_submission_option [nfc$oqa_system_routing_text].system_routing_text :=
                ^output_system_routing_text;

{ Job executes here and the job output is printed (or handled here).

        ELSE

{ Force OUTPUT_DESTINATION_USAGE to have the system default destination usage (public,dual_state, etc)

          queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage].key :=
                jmc$output_destination_usage;
          IF attribute_results^ [1].output_destination_usage = jmc$qtf_usage THEN

{ disallow output_destination_usage of QTF for a output file at its final destination

            queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage]
                  .output_destination_usage := jmc$public_usage;
            overridden_jad_odu := TRUE;
          ELSE
            queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage]
                  .output_destination_usage := attribute_results^ [1].output_destination_usage;
          IFEND;

{ Force OUTPUT_DISPOSITION to printer to avoid problems with LOCAL

          queue_file_attributes.job_submission_option [nfc$iqa_output_disposition].key :=
                jmc$output_disposition;
          queue_file_attributes.job_submission_option [nfc$iqa_output_disposition]
                .output_disposition.key := jmc$normal_output_disposition;
        IFEND;

      = nfc$p17_line_printer, nfc$p17_hollerith_card_punch, nfc$p17_binary_checksummed_cp,
            nfc$p17_special_output =

{ If the output is from a non-NOS/VE system, use the protocol_job_name as the COMMENT_BANNER

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
          queue_file_attributes.output_submission_option [nfc$oqa_comment_banner].key := jmc$comment_banner;
          queue_file_attributes.output_submission_option [nfc$oqa_comment_banner].comment_banner :=
                new_name_value;
        IFEND;

{ Set up the DATA_MODE

        IF remote_host_type <> nfc$p22_nos_ve_qtf THEN
          queue_file_attributes.output_submission_option [nfc$oqa_data_mode].key := jmc$data_mode;
          CASE transfer_mode OF
          = nfc$rhf_structured_mode, nfc$transparent_data_mode =
            queue_file_attributes.output_submission_option [nfc$oqa_data_mode].data_mode :=
                  jmc$transparent_data;
          = nfc$coded_data_mode, nfc$ve_to_ve_mode =
            queue_file_attributes.output_submission_option [nfc$oqa_data_mode].data_mode := jmc$coded_data;
          ELSE
            osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
                  'QTFS bad DM case create_queue_file_attributes', status);
            RETURN;
          CASEND;
        IFEND;

{ Save the IMPLICIT_ROUTING_TEXT

        output_implicit_routing_text := implicit_routing_text;
        queue_file_attributes.output_submission_option [nfc$oqa_implicit_routing_text].key :=
              jmc$implicit_routing_text;
        queue_file_attributes.output_submission_option [nfc$oqa_implicit_routing_text].implicit_routing_text
              := ^output_implicit_routing_text;

{ If the output is from a non-NOS/VE system, use the transfer_pid as the OUTPUT_DESTINATION

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          convert_string_to_ost$name (transfer_pid, user_job_name_prefix, new_name_value);
          queue_file_attributes.output_submission_option [nfc$oqa_output_destination].key :=
                jmc$output_destination;
          queue_file_attributes.output_submission_option [nfc$oqa_output_destination].output_destination :=
                new_name_value;
        IFEND;

{ Force OUTPUT_DESTINATION_USAGE to have the system default destination usage (public,dual_state, etc)

        queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage].key :=
              jmc$output_destination_usage;
        IF attribute_results^ [1].output_destination_usage = jmc$qtf_usage THEN

{ disallow output_destination_usage of QTF for a output file at its final destination

          queue_file_attributes.output_submission_option  [nfc$oqa_output_dest_usage]
                .output_destination_usage := jmc$public_usage;
           overridden_jad_odu := TRUE;
         ELSE
          queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage]
                .output_destination_usage := attribute_results^ [1].output_destination_usage;
         IFEND;

{ If the output is from a non-NOS/VE system, force the OUTPUT_DISPOSITION to be PRINTER.
{ This is done to prevent JMP$PRINT_FILE from using the ODI job attribute from the $SYSTEM
{ job where QTF is executing. For NOS/VE queue files, JMP$PRINT_FILE will obtain the ODI
{ information from the queue file's system label.

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          queue_file_attributes.output_submission_option [nfc$oqa_output_disposition].key :=
                jmc$output_disposition;
          queue_file_attributes.output_submission_option [nfc$oqa_output_disposition]
                .output_disposition.key := jmc$normal_output_disposition;
        IFEND;

{ Clear out the REMOTE_HOST_DIRECTIVE so that it is NO longer associated with this output file

        output_remote_host_directive.size := 0;
        output_remote_host_directive.parameters := '';
        queue_file_attributes.output_submission_option [nfc$oqa_remote_host_directive].key :=
              jmc$remote_host_directive;
        queue_file_attributes.output_submission_option [nfc$oqa_remote_host_directive].remote_host_directive
              := ^output_remote_host_directive;

{ If the output is from a non-NOS/VE system, use the protocol_job_name as the ROUTING_BANNER

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
            convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
            queue_file_attributes.output_submission_option [nfc$oqa_routing_banner].key := jmc$routing_banner;
            queue_file_attributes.output_submission_option [nfc$oqa_routing_banner].routing_banner :=
                  new_name_value;
          IFEND;

{ If the previous system was NOS/VE then save the previous SYSTEM_FILE_NAME

        IF ((remote_host_type = nfc$p22_nos_ve) OR (remote_host_type = nfc$p22_nos_ve_qtf)) AND
              (NOT loop_back_transfer) THEN
          queue_file_attributes.output_submission_option [nfc$oqa_system_file_name].key :=
                jmc$system_file_name;
          queue_file_attributes.output_submission_option [nfc$oqa_system_file_name].system_file_name :=
                system_supplied_name;
        IFEND;

{ Set up the USER_FILE_NAME

        IF protocol_job_name <> '' THEN
          convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
          queue_file_attributes.output_submission_option [nfc$oqa_user_file_name].key :=
                jmc$user_file_name;
          queue_file_attributes.output_submission_option [nfc$oqa_user_file_name].user_file_name :=
                new_name_value;
        IFEND;

{ If the output is from a non-NOS/VE system, use the protocol_job_name as the USER_JOB_NAME

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
          queue_file_attributes.output_submission_option [nfc$oqa_user_job_name].key := jmc$user_job_name;
          queue_file_attributes.output_submission_option [nfc$oqa_user_job_name].user_job_name :=
                new_name_value;
        IFEND;
      = nfc$p17_generic_queue =

{ Clear out the REMOTE_HOST_DIRECTIVE so that it is NO longer associated with this generic queue file

        output_remote_host_directive.size := 0;
        output_remote_host_directive.parameters := '';
        queue_file_attributes.qfile_submission_option [nfc$gqa_remote_host_directive].key :=
              jmc$remote_host_directive;
        queue_file_attributes.qfile_submission_option [nfc$gqa_remote_host_directive].remote_host_directive
              := ^output_remote_host_directive;
      CASEND;
    IFEND;

{ Crack various texts to get queue attributes, then submit or print

    IF NOT store_and_forward_queue_file THEN
      IF (queue_file_type = nfc$job_queue_file) THEN
        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          IF system_routing_text.size > 0 THEN
            crack_system_routing_text (system_routing_text, queue_file_type,
                  $nft$output_queue_attributes_set [], $nft$input_queue_attributes_set [],
                  queue_file_attributes, status);
            IF NOT status.normal THEN
              RETURN;
            IFEND;
          IFEND;
        IFEND;

        IF (explicit_routing_text.head <> NIL) AND (STRLENGTH (explicit_routing_text.head^.line) > 0) THEN
          crack_submit_job_command (explicit_routing_text.head^.line, queue_file_attributes, status);
        IFEND;
      ELSEIF queue_file_type = nfc$print_queue_file THEN
        IF implicit_routing_text.size > 0 THEN
          crack_implicit_routing_text (implicit_routing_text, nos_ve_implicit_text, queue_file_attributes,
                queue_file_page_width, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;
        IFEND;

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN
          IF system_routing_text.size > 0 THEN
            srt_no_override_output_attribs := $nft$output_queue_attributes_set [nfc$oqa_user_file_name];

            IF queue_file_attributes.output_submission_option [nfc$oqa_control_family].key <>
                  jmc$null_attribute THEN
              srt_no_override_output_attribs := srt_no_override_output_attribs +
                      $nft$output_queue_attributes_set [nfc$oqa_control_family];
            IFEND;

            IF queue_file_attributes.output_submission_option [nfc$oqa_control_user].key <>
                  jmc$null_attribute THEN
              srt_no_override_output_attribs := srt_no_override_output_attribs +
                      $nft$output_queue_attributes_set [nfc$oqa_control_user];
            IFEND;

            IF queue_file_attributes.output_submission_option [nfc$oqa_login_account].key <>
                  jmc$null_attribute THEN
              srt_no_override_output_attribs := srt_no_override_output_attribs +
                      $nft$output_queue_attributes_set [nfc$oqa_login_account];
            IFEND;

            IF queue_file_attributes.output_submission_option [nfc$oqa_login_project].key <>
                  jmc$null_attribute THEN
              srt_no_override_output_attribs := srt_no_override_output_attribs +
                      $nft$output_queue_attributes_set [nfc$oqa_login_project];
            IFEND;

            IF (queue_file_attributes.output_submission_option [nfc$oqa_disposition_code].key <>
                  jmc$null_attribute) AND (queue_file_attributes.output_submission_option
                  [nfc$oqa_disposition_code].disposition_code = nfc$p17_wait_queue) THEN
              srt_no_override_output_attribs := srt_no_override_output_attribs +
                      $nft$output_queue_attributes_set [nfc$oqa_disposition_code];
            IFEND;

            crack_system_routing_text (system_routing_text, queue_file_type, srt_no_override_output_attribs,
                  $nft$input_queue_attributes_set [], queue_file_attributes, status);
            IF NOT status.normal THEN
              RETURN;
            ELSEIF (queue_file_attributes.output_submission_option [nfc$oqa_external_characteristic].key =
                  jmc$external_characteristics) AND (queue_file_attributes.output_submission_option
                  [nfc$oqa_external_characteristic].external_characteristics =
                  nfc$external_characteristic_a9) THEN
              queue_file_attributes.output_submission_option [nfc$oqa_external_characteristic]
                    .external_characteristics := nfc$normal_string;
            IFEND;
          IFEND;
        IFEND;

        IF (explicit_routing_text.head <> NIL) AND (STRLENGTH (explicit_routing_text.head^.line) > 0) THEN
          crack_print_file_command (explicit_routing_text.head^.line, queue_file_attributes,
                queue_file_page_width, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;
        IFEND;
        IF (queue_file_attributes.output_submission_option [nfc$oqa_output_dest_usage].key =
              jmc$output_destination_usage) AND (queue_file_attributes.output_submission_option
              [nfc$oqa_output_dest_usage].output_destination_usage = jmc$qtf_usage) AND
              (nos_ve_implicit_text) THEN

{ Destroy the old implicit routing text to avoid infinite queue loop

          output_implicit_routing_text.text := '';
          output_implicit_routing_text.size := 0;
          queue_file_attributes.output_submission_option [nfc$oqa_implicit_routing_text].key :=
                jmc$implicit_routing_text;
          queue_file_attributes.output_submission_option [nfc$oqa_implicit_routing_text]
               .implicit_routing_text := ^output_implicit_routing_text;
        IFEND;

        IF (remote_host_type <> nfc$p22_nos_ve) AND (remote_host_type <> nfc$p22_nos_ve_qtf) THEN

{ If the output is from a non-NOS/VE system and the control_family is not defined,
{ then use the source_lid as the CONTROL_FAMILY

          IF queue_file_attributes.output_submission_option [nfc$oqa_control_family].key =
                jmc$null_attribute THEN
            convert_string_to_ost$name (source_lid, user_job_name_prefix, new_name_value);
            queue_file_attributes.output_submission_option [nfc$oqa_control_family].key := jmc$control_family;
            queue_file_attributes.output_submission_option [nfc$oqa_control_family].control_family :=
                  new_name_value;
          IFEND;

{ If the output is from a non-NOS/VE system and the control_user is not defined,
{ then use the protocol_job_name as the CONTROL_USER

          IF queue_file_attributes.output_submission_option [nfc$oqa_control_family].key =
                jmc$null_attribute THEN

            convert_string_to_ost$name (protocol_job_name, user_job_name_prefix, new_name_value);
            queue_file_attributes.output_submission_option [nfc$oqa_control_user].key := jmc$control_user;
            queue_file_attributes.output_submission_option [nfc$oqa_control_user].control_user :=
                  new_name_value;
          IFEND;

{ If the output is from a non-NOS system and the login_account is not defined,
{ use the value of 'NONE'.

          IF queue_file_attributes.output_submission_option [nfc$oqa_login_account].key =
                  jmc$null_attribute THEN
            queue_file_attributes.output_submission_option [nfc$oqa_login_account].key :=
                jmc$login_account;
            queue_file_attributes.output_submission_option [nfc$oqa_login_account].login_account :=
                'NONE';
          IFEND;

{ If the output is from a non-NOS system and the login_family is not defined,
{ use the value of 'NONE'.

          IF queue_file_attributes.output_submission_option [nfc$oqa_login_family].key =
                jmc$null_attribute THEN
            queue_file_attributes.output_submission_option [nfc$oqa_login_family].key :=
                jmc$login_family;
            queue_file_attributes.output_submission_option [nfc$oqa_login_family].login_family :=
                'NONE';
          IFEND;

{ If the output is from a non-NOS system and the login_project is not defined,
{ use the value of 'NONE'.

          IF queue_file_attributes.output_submission_option [nfc$oqa_login_project].key =
                jmc$null_attribute THEN
            queue_file_attributes.output_submission_option [nfc$oqa_login_project].key :=
                jmc$login_project;
            queue_file_attributes.output_submission_option [nfc$oqa_login_project].login_project :=
                'NONE';
          IFEND;

{ If the output is from a non-NOS system and the login_user is not defined,
{ use the value of 'NONE'.

          IF queue_file_attributes.output_submission_option [nfc$oqa_login_user].key =
                jmc$null_attribute THEN
            queue_file_attributes.output_submission_option [nfc$oqa_login_user].key :=
                jmc$login_user;
            queue_file_attributes.output_submission_option [nfc$oqa_login_user].login_user :=
                'NONE';
          IFEND;
        IFEND;
      ELSEIF queue_file_type = nfc$generic_queue_file THEN
        IF (explicit_routing_text.head <> NIL) AND (STRLENGTH (explicit_routing_text.head^.line) > 0) THEN
          crack_generic_command (explicit_routing_text.head^.line, queue_file_attributes, status);
        IFEND;
      IFEND;
    IFEND;

{ Handle loop back possibility, this should cause JM to produce a new system job name/file name

    IF loop_back_transfer THEN
      IF queue_file_type = nfc$job_queue_file THEN
        queue_file_attributes.job_submission_option [nfc$iqa_system_job_name].key := jmc$system_job_name;
        queue_file_attributes.job_submission_option [nfc$iqa_system_job_name].system_job_name :=
              jmc$blank_system_supplied_name;
      ELSEIF queue_file_type = nfc$print_queue_file THEN
        queue_file_attributes.output_submission_option [nfc$oqa_system_file_name].key := jmc$system_file_name;
        queue_file_attributes.output_submission_option [nfc$oqa_system_file_name].system_file_name :=
              jmc$blank_system_supplied_name;
      IFEND;
    IFEND;

  PROCEND create_queue_file_attributes;
?? TITLE := 'emit_qtfs_output_stat', EJECT ??

{ PURPOSE:
{   This procedure emits the destination queue file transfer communication
{   accounting statistic for output files.
{ DESIGN:
{   The statistic data is assembled and then Procedure
{   jmp$emit_communication_stat is called to emit the statistic.
{ NOTES:
{  The communication accounting statistic for jobs is emitted elsewhere,
{  at job begin.

  PROCEDURE emit_qtfs_output_stat
    (    output_file_name: amt$local_file_name;
         origin_mainframe_name: string ( * <= osc$max_name_size);
         dest_mainframe_name: string ( * <= osc$max_name_size);
         file_size: nft$parameter_06_values;
         system_job_name: jmt$system_supplied_name,
         queue_file_attributes: nft$queue_submission_option);

    VAR
     qtfs_statistic: jmt$qtf_dest_statistic_data,
     statistic_data: jmt$comm_acct_statistic_data;

    qtfs_statistic.kind := jmc$output_file;
    qtfs_statistic.output_file_name := output_file_name;
    qtfs_statistic.data.file_size := file_size;
    qtfs_statistic.data.user_identification.user := queue_file_attributes.output_submission_option
       [nfc$oqa_login_user].login_user;
    qtfs_statistic.data.user_identification.family := queue_file_attributes.output_submission_option
       [nfc$oqa_login_family].login_family;
    qtfs_statistic.data.account_name := queue_file_attributes.output_submission_option
       [nfc$oqa_login_account].login_account;
    qtfs_statistic.data.project_name := queue_file_attributes.output_submission_option
       [nfc$oqa_login_project].login_project;
    qtfs_statistic.data.system_job_name := system_job_name;
    qtfs_statistic.data.user_job_name := queue_file_attributes.output_submission_option
       [nfc$oqa_user_job_name].user_job_name;
    qtfs_statistic.data.origin_mainframe_name := origin_mainframe_name;
    qtfs_statistic.data.dest_mainframe_name := dest_mainframe_name;

    statistic_data.statistic_id := jmc$ca_dest_qf_transfer;
    statistic_data.dest_queue_file_transfer := ^qtfs_statistic;

    jmp$emit_communication_stat( statistic_data );

  PROCEND emit_qtfs_output_stat;
?? TITLE := 'find_position_parameter_list', EJECT ??

{ PURPOSE:
{   This procedure will search a string for a pattern(string) starting at the next
{   non-blank character.

  PROCEDURE find_position_parameter_list
    (    command_line: string ( * <= maximum_size_qtfs_scl_command);
         expected_command: string ( * <= maximum_size_qtfs_scl_command);
     VAR parameter_list_position: integer;
     VAR status: ost$status);

    VAR
      command_line_length: 0 .. maximum_size_qtfs_scl_command,
      expected_command_length: 0 .. maximum_size_qtfs_scl_command,
      position_start_command: 0 .. maximum_size_qtfs_scl_command,
      upper_case_command_line: string (maximum_size_qtfs_scl_command),
      upper_case_expected_command: string (maximum_size_qtfs_scl_command);

    status.normal := TRUE;
    command_line_length := STRLENGTH (command_line);
    expected_command_length := STRLENGTH (expected_command);
    IF (command_line_length < 1) OR (expected_command_length < 1) THEN
      osp$set_status_abnormal (nfc$status_id, nfe$bts_internal_error,
            'QTFS find_position_parameter_list length error', status);
      RETURN;
    IFEND;

  /skip_blank_characters/
    FOR position_start_command := 1 TO command_line_length DO
      IF (command_line (position_start_command, 1) <> ' ') THEN
        EXIT /skip_blank_characters/;
      IFEND;
    FOREND /skip_blank_characters/;

    IF STRLENGTH (command_line (position_start_command, * )) < expected_command_length THEN
      osp$set_status_abnormal (nfc$status_id, nfe$invalid_explicit_text, command_line, status);
      RETURN;
    IFEND;

    #translate (osv$lower_to_upper, command_line, upper_case_command_line);
    #translate (osv$lower_to_upper, expected_command, upper_case_expected_command);

    IF upper_case_command_line (position_start_command, expected_command_length) = upper_case_expected_command
          THEN
      parameter_list_position := position_start_command + expected_command_length;
    ELSE
      osp$set_status_abnormal (nfc$status_id, nfe$invalid_explicit_text, command_line, status);
    IFEND;

  PROCEND find_position_parameter_list;
?? TITLE := 'first_character_is_letter', EJECT ??

  FUNCTION first_character_is_letter
    (    value: string (1)): boolean;

    TYPE
      set_of_char = set of char;

    VAR
      compare_character: char,
      letter_set: [STATIC, READ] set_of_char := ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
            'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e',
            'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
            'y', 'z'];

    compare_character := value (1);
    IF compare_character IN letter_set THEN
      first_character_is_letter := TRUE;
    ELSE
      first_character_is_letter := FALSE;
    IFEND;

  FUNCEND first_character_is_letter;
?? TITLE := 'initialize_rft_parameters', EJECT ??

{ PURPOSE:
{   This procedure initializes the control block before each RFT is received.

  PROCEDURE initialize_rft_parameters
    (VAR control_block: nft$control_block);

    VAR
      ignore_status: ost$status;

    control_block.data_xfer_complete := FALSE;
    control_block.state_of_transfer.normal := TRUE;
    control_block.remote_status.normal := TRUE;
    control_block.local_status.normal := TRUE;
    control_block.data_declaration := nfc$p31_unspecified;
    control_block.disposition_code := nfc$p17_line_printer;
    control_block.receive_systems_routing_text.size := 0;
    control_block.send_systems_routing_text.size := 0;
    control_block.receive_implicit_routing_text.size := 0;
    control_block.send_implicit_routing_text.size := 0;
    IF (control_block.received_directives.head <> NIL) THEN
      nfp$deallocate_dirs_from_head (control_block.received_directives, ignore_status);
    IFEND;
    IF (control_block.send_directives <> NIL) THEN
      nfp$dequeue_directives_on_list (control_block.send_directives, ignore_status);
    IFEND;
    IF (control_block.received_operator_messages.head <> NIL) THEN
      nfp$deallocate_dirs_from_head (control_block.received_operator_messages, ignore_status);
    IFEND;
    IF (control_block.send_operator_messages <> NIL) THEN
      nfp$dequeue_directives_on_list (control_block.send_operator_messages, ignore_status);
    IFEND;
    IF (control_block.received_user_messages.head <> NIL) THEN
      nfp$deallocate_dirs_from_head (control_block.received_user_messages, ignore_status);
    IFEND;
    IF (control_block.send_user_messages <> NIL) THEN
      nfp$dequeue_directives_on_list (control_block.send_user_messages, ignore_status);
    IFEND;
    IF (control_block.received_account_messages.head <> NIL) THEN
      nfp$deallocate_dirs_from_head (control_block.received_account_messages, ignore_status);
    IFEND;
    IF (control_block.send_account_messages <> NIL) THEN
      nfp$dequeue_directives_on_list (control_block.send_account_messages, ignore_status);
    IFEND;
    IF (control_block.received_errorlog_messages.head <> NIL) THEN
      nfp$deallocate_dirs_from_head (control_block.received_errorlog_messages, ignore_status);
    IFEND;
    IF (control_block.send_errorlog_messages <> NIL) THEN
      nfp$dequeue_directives_on_list (control_block.send_errorlog_messages, ignore_status);
    IFEND;

  PROCEND initialize_rft_parameters;
?? TITLE := 'print_queue_job', EJECT ??

{ PURPOSE:
{   This procedure will convert the queue_file_attributes to parameters for
{   jmp$print_file, and call jmp$print_file.

  PROCEDURE print_queue_job
    (    file_name: fst$file_reference;
         queue_file_attributes: nft$queue_submission_option;
     VAR job_name: jmt$system_supplied_name;
     VAR status: ost$status);

    VAR
      array_index: integer,
      number_output_options: integer,
      output_submission_options: ^jmt$output_submission_options,
      option_index: nft$output_queue_attributes;

    status.normal := TRUE;

    number_output_options := $INTEGER (UPPERVALUE (nft$output_queue_attributes)) -
          $INTEGER (LOWERVALUE (nft$output_queue_attributes)) + 1;
    PUSH output_submission_options: [1 .. number_output_options];
    array_index := 1;
    FOR option_index := LOWERVALUE (nft$output_queue_attributes) TO UPPERVALUE (nft$output_queue_attributes)
          DO
      output_submission_options^ [array_index] := queue_file_attributes.output_submission_option
            [option_index];
      array_index := array_index + 1;
    FOREND;

    jmp$print_file (file_name, output_submission_options, job_name, status);

  PROCEND print_queue_job;
?? TITLE := 'qtfs_a_to_a_protocol', EJECT ??

{ PURPOSE:
{   This procedure is the protocol driver for QTFS.  It sequences the protocol
{   commands correctly for file transfers.  If a file is successfully sent,
{   the file is disposed to job management accordingly.

  PROCEDURE qtfs_a_to_a_protocol
    (    store_forward_file_name: amt$local_file_name;
     VAR control_block: nft$control_block;
     VAR status: ost$status);

    VAR
      additional_parameters: nft$parameter_set,
      change_file_attributes: ^amt$file_attributes,
      file_attributes: ^fst$attachment_options,
      file_size: amt$file_length,
      ignore_status: ost$status,
      ignored_parameters: nft$parameter_set,
      input_accounting_data: qtfs_input_accounting_data,
      loop_back_transfer: boolean,
      modified_parameters: nft$parameter_set,
      output_creation_attributes: ^fst$file_cycle_attributes,
      overridden_jad_odu: boolean,
      protocol_consistent: boolean,
      queue_file_attributes: nft$queue_submission_option,
      queue_file_page_width: amt$page_width,
      queue_file_type: nft$queue_file_type,
      received_parameters: nft$parameter_set,
      rft_parameters: nft$parameter_set,
      rpos_parameters: nft$parameter_set,
      store_and_forward_queue_file: boolean,
      system_supplied_name: jmt$system_supplied_name,
      transfer_mode: nft$transfer_modes,
      wait_queue: wait_queue_information;

{     Receive RFT
    status.normal := TRUE;
    queue_file_page_width := 1;
    overridden_jad_odu := FALSE;
    initialize_rft_parameters (control_block);
    nfp$receive_command ($nft$command_set [nfc$rft], nfv$qtf_required_params_on_cmds, control_block,
          rft_parameters, ignored_parameters, modified_parameters, status);
    IF NOT control_block.path.path_connected THEN
      RETURN;
    IFEND;
    IF (NOT status.normal) AND ((status.condition = nfe$invalid_protocol_command) OR
          (status.condition = nfe$invalid_param_count) OR
          (status.condition = nfe$invalid_command_code)) THEN
      RETURN;
    IFEND;

{     Main queue file transfer loop

  /receive_file_loop/
    WHILE TRUE DO
      IF status.normal THEN
        analyze_received_rft (rft_parameters, store_forward_file_name, control_block, transfer_mode,
              store_and_forward_queue_file, rpos_parameters, queue_file_attributes, queue_file_type,
              loop_back_transfer, input_accounting_data, overridden_jad_odu, queue_file_page_width, status);
      IFEND;

      nfp$set_abnormal_if_normal (status, control_block.local_status);
      IF status.normal THEN

{     Send RPOS to client application

        nfp$send_command (nfc$rpos, rpos_parameters,
             $nft$parameter_set[], $nft$parameter_set[],
             control_block, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;

{     Receive GO or STOP if problem with RPOS

        nfp$receive_command ($nft$command_set [nfc$go, nfc$stop], nfv$qtf_required_params_on_cmds,
              control_block, received_parameters, ignored_parameters, modified_parameters, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;

{     Receive the queue file

        IF control_block.last_command_received <> nfc$stop THEN
          pmp$get_unique_name (control_block.file_name, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;

{     The queue file page width is obtained in crack_print_file_parameters }

        IF  control_block.remote_host_type <>   nfc$p22_nos_ve_qtf  THEN
          IF (queue_file_page_width <> 1) AND (queue_file_page_width <> 132)  THEN
           change_page_width ( control_block.file_name,queue_file_page_width,status );
          IFEND;
        IFEND;

          nfp$receive_queue_file (control_block.path.network_file_id, control_block.file_name,
                control_block.transfer_facilities, transfer_mode, control_block.data_block_size,
                control_block.time_out, control_block.protocol_in_use, control_block.path.network_type,
                control_block.protocol_trace, file_size, protocol_consistent, control_block.state_of_transfer,
                status);
          IF NOT protocol_consistent THEN
            amp$return (control_block.file_name, ignore_status);
            RETURN;
          IFEND;
          nfp$set_abnormal_if_normal (status, control_block.local_status);
        ELSE
          IF control_block.state_of_transfer.normal THEN
            osp$set_status_abnormal (nfc$status_id, nfe$sender_problem_no_retry, '', status);
          IFEND;
        IFEND;
      ELSE

{     Send an RNEG

        osp$set_status_abnormal (nfc$status_id, nfv$p04_values [nfc$p04_transfer_rejected_messa].condition,
              '', control_block.state_of_transfer);
        nfp$set_abnormal_if_normal (status, control_block.local_status);
        nfp$send_command (nfc$rneg, nfv$qtf_required_params_on_cmds [nfc$rneg],
             $nft$parameter_set[], $nft$parameter_set[ ],
             control_block, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
      IFEND;

{     Receive the STOP if file was transferred

      IF control_block.last_command_received <> nfc$stop THEN
        nfp$receive_command ($nft$command_set [nfc$stop], nfv$qtf_required_params_on_cmds, control_block,
              received_parameters, ignored_parameters, modified_parameters, status);
        IF (NOT control_block.path.path_connected) THEN
          amp$return (control_block.file_name, ignore_status);
          RETURN;
        ELSEIF (NOT status.normal) AND ((status.condition = nfe$invalid_protocol_command) OR
              (status.condition = nfe$invalid_param_count) OR (status.condition = nfe$invalid_command_code))
              THEN
          amp$return (control_block.file_name, ignore_status);
          RETURN;
        ELSE
          IF (control_block.state_of_transfer.normal) AND (control_block.local_status.normal) AND
                (control_block.remote_status.normal) THEN

{     Transfer is o.k., try to submit/print queue file

            IF queue_file_type = nfc$job_queue_file THEN
              input_accounting_data.data_block.file_size := file_size;
              submit_queue_job (control_block.file_name, queue_file_attributes, system_supplied_name, status);

{ Note: Communication accounting statistic for input file is not emitted here.
{       It is emitted later, at job_begin time.

              IF NOT (status.normal) THEN
                IF (status.condition = jme$maximum_jobs) OR (status.condition = jme$no_space_for_file) THEN
                  osp$set_status_abnormal (nfc$status_id, nfv$p04_values [nfc$p04_receiver_problem_retry].
                        condition, '', control_block.state_of_transfer);
                ELSE
                  osp$set_status_abnormal (nfc$status_id, nfv$p04_values [nfc$p04_receiver_problem_noretr].
                        condition, '', control_block.state_of_transfer);
                IFEND;
              IFEND;
            ELSEIF queue_file_type = nfc$print_queue_file THEN
              IF (control_block.remote_host_type <> nfc$p22_nos_ve) AND (control_block.remote_host_type <>
                    nfc$p22_nos_ve_qtf) AND (transfer_mode <> nfc$transparent_data_mode) THEN
                PUSH change_file_attributes: [1 .. 1];
                change_file_attributes^ [1].key := amc$file_contents;
                change_file_attributes^ [1].file_contents := amc$list;
                amp$change_file_attributes (control_block.file_name, change_file_attributes, status);
              IFEND;

              check_wait_queue_file (queue_file_attributes, control_block.remote_host_type, wait_queue);
              IF wait_queue.use_wait_queue THEN
                PUSH output_creation_attributes: [1..1];
                output_creation_attributes^ [1].selector := fsc$ring_attributes;
                output_creation_attributes^ [1].ring_attributes.r1 := osc$user_ring;
                output_creation_attributes^ [1].ring_attributes.r2 := osc$user_ring;
                output_creation_attributes^ [1].ring_attributes.r3 := osc$user_ring;
                fsp$copy_file (control_block.file_name, wait_queue.wait_queue_file_name, NIL, NIL,
                      output_creation_attributes, status);
                IF status.normal THEN
                  IF control_block.protocol_in_use = nfc$p00_a101 THEN
                    system_supplied_name := '           $WAITQUE';
                  ELSE
                    system_supplied_name := '        $WAIT_QUEUE';
                  IFEND;
                ELSE
                  print_queue_job (control_block.file_name, queue_file_attributes, system_supplied_name,
                        status);
                IFEND;
                amp$return (wait_queue.wait_queue_file_name, ignore_status);
              ELSE  { print the output queue file }
                print_queue_job (control_block.file_name, queue_file_attributes, system_supplied_name,
                      status);
              IFEND;
              IF status.normal THEN
                emit_qtfs_output_stat (control_block.file_name, control_block.source_lid.value (1,
                      control_block.source_lid.size), control_block.transfer_pid (1, control_block.
                      transfer_pid_length), control_block.file_size, control_block.system_job_name,
                      queue_file_attributes);
              ELSE
                IF (status.condition = jme$maximum_output) OR (status.condition = jme$no_space_for_file) THEN
                  osp$set_status_abnormal (nfc$status_id, nfv$p04_values [nfc$p04_receiver_problem_retry].
                        condition, '', control_block.state_of_transfer);
                ELSE
                  osp$set_status_abnormal (nfc$status_id, nfv$p04_values [nfc$p04_receiver_problem_noretr].
                        condition, '', control_block.state_of_transfer);
                IFEND;
              IFEND;
            ELSE { queue_file_type = nfc$generic_queue_file
              submit_generic_queue_file(control_block.file_name, queue_file_attributes, system_supplied_name,
                    status);
            IFEND;
            nfp$set_abnormal_if_normal (status, control_block.local_status);
          IFEND;
        IFEND;
      IFEND;

{     Return the local version of the received queue file

      amp$return (control_block.file_name, ignore_status);

{ if the output_destination_usage was changed from the job_attribute_default of QTF to PUBLIC
{ then display an informative message into the system's job_log

      IF overridden_jad_odu THEN
        osp$set_status_abnormal (nfc$status_id, nfe$qtfs_chg_jad_qtf_to_public, system_supplied_name,
              ignore_status);
        nfp$format_message_to_job_log (ignore_status);
      IFEND;

{     if we are receiving a queue file from an A101 system send the significant part
{     of the system_supplied_name (last 8 characters) back to the A101 system

      IF control_block.protocol_in_use = nfc$p00_a101 THEN
        system_supplied_name := system_supplied_name (12, *);
      IFEND;

{ Send the STOPR

      qtfs_send_stopr (system_supplied_name, control_block, status);
      IF (NOT control_block.path.path_connected) THEN
        RETURN;
      IFEND;

{ Receive ETP or RFT (indicating receive another queue file)

      initialize_rft_parameters (control_block);

{ Reset page_width flag

      queue_file_page_width := 1;
      qtfs_receive_rft_or_etp (control_block, status);
      IF (NOT control_block.path.path_connected) THEN
        RETURN;
      IFEND;
      IF control_block.last_command_received = nfc$etp THEN
        EXIT /receive_file_loop/;
      IFEND;
    WHILEND /receive_file_loop/;

{     Disconnect path (standard normal termination)

    complete_qtfs_protocol (control_block);

  PROCEND qtfs_a_to_a_protocol;
?? TITLE := 'qtfs_receive_rft_or_etp', EJECT ??

{ PURPOSE:
{   This procedure receives the protocol command which indicates
{   if any more files are to be received on this connection.

  PROCEDURE qtfs_receive_rft_or_etp
    (VAR control_block: nft$control_block;
     VAR status: ost$status);

    VAR
      ignored_parameters: nft$parameter_set,
      modified_parameters: nft$parameter_set,
      received_parameters: nft$parameter_set;

    status.normal := TRUE;
    nfp$receive_command ($nft$command_set [nfc$rft, nfc$etp], nfv$qtf_required_params_on_cmds, control_block,
          received_parameters, ignored_parameters, modified_parameters, status);
    IF (NOT status.normal) AND ((status.condition = nfe$invalid_protocol_command) OR
          (status.condition = nfe$invalid_param_count) OR (status.condition = nfe$invalid_command_code)) THEN
      nfp$terminate_path (control_block.application, FALSE, control_block.path, status);
      RETURN;
    IFEND;

  PROCEND qtfs_receive_rft_or_etp;
?? TITLE := 'qtfs_send_stopr', EJECT ??

{ PURPOSE:
{   This procedure will send an appropriate STOPR command to the initiating application
{   (QTF).  The STOPR command indicates if the transfer was successfull, unsuccessfull
{   and retryable, or just unsuccessfull.  If the submit_job or print_file was sucessful,
{   the job name is returned.  If an error occurred, a text message describing the
{   error is returned.

  PROCEDURE qtfs_send_stopr
    (    system_supplied_name: jmt$system_supplied_name;
     VAR control_block: nft$control_block;
     VAR status: ost$status);

    VAR
      ignore_status: ost$status,
      status_list: nft$directive_entry_list_head,
      stopr_parameters: nft$parameter_set;

    status.normal := TRUE;
    stopr_parameters := nfv$qtf_required_params_on_cmds [nfc$stopr];

{     Force bad state of transfer if something wrong

    IF (control_block.state_of_transfer.normal) AND NOT (control_block.local_status.normal) THEN
      osp$set_status_abnormal (nfc$status_id, nfe$transfer_rejected_message, '',
            control_block.state_of_transfer);
    IFEND;

    IF control_block.state_of_transfer.normal THEN
      stopr_parameters := stopr_parameters + $nft$parameter_set [nfc$job_name];
      control_block.send_job_name.size := STRLENGTH (system_supplied_name);
      control_block.send_job_name.value := system_supplied_name;
    ELSE
      IF NOT (control_block.local_status.normal) THEN
        stopr_parameters := stopr_parameters + $nft$parameter_set [nfc$user_message];
        status_list.head := NIL;
        status_list.tail := NIL;
        nfp$enqueue_status_directive (control_block.local_status, status_list, status);
        control_block.send_user_messages := status_list.head;
      IFEND;
    IFEND;

    nfp$send_command (nfc$stopr, stopr_parameters,
      $nft$parameter_set[], $nft$parameter_set[],
      control_block, status);
    IF (control_block.send_user_messages <> NIL) THEN
      nfp$dequeue_directives_on_list (control_block.send_user_messages, ignore_status);
    IFEND;

  PROCEND qtfs_send_stopr;
?? TITLE := 'submit_generic_queue_file', EJECT ??

{ PURPOSE:
{   This procedure will convert the nft$queue_submission_option to the generic
{   queue file attributes for submitting a generic queue file.

  PROCEDURE submit_generic_queue_file
    (    file_name: fst$file_reference;
     VAR queue_file_attributes: nft$queue_submission_option;
     VAR system_file_name: jmt$system_supplied_name;
     VAR status: ost$status);

    VAR
      array_index: integer,
      application_name: ost$name,
      number_generic_options: integer,
      option_index: nft$generic_queue_attributes,
      qfile_submission_options: ^jmt$qfile_submission_options;

    status.normal := TRUE;

    number_generic_options := $INTEGER (UPPERVALUE (nft$generic_queue_attributes)) -
          $INTEGER (LOWERVALUE (nft$generic_queue_attributes)) + 1;
    PUSH qfile_submission_options: [1 .. number_generic_options];

    IF queue_file_attributes.qfile_submission_option [nfc$gqa_application_name].key = jmc$destination THEN

{ The procedure CRACK_GENERIC_COMMAND used the subrecord DESTINATION to store the APPLICATION_NAME
{ for this queue file. Retrieve the APPLICATION_NAME and erase the data for the array entry to prevent
{ JMP$SUBMIT_QFILE from using the data as a DESTINATION name.

      application_name :=
            queue_file_attributes.qfile_submission_option [nfc$gqa_application_name].destination;

      queue_file_attributes.qfile_submission_option [nfc$gqa_application_name].destination := '';
      queue_file_attributes.qfile_submission_option [nfc$gqa_application_name].key := jmc$null_attribute;
    ELSE
      application_name := nfc$qtf_namve_client_name;
    IFEND;

{ Copy the array qfile submission options. Two indices are used to ensure against problems which
{ could ocurr if LOWERVALUE (nft$generic_queue_attributes) is not equal to one.

    array_index := 1;
    FOR option_index := LOWERVALUE (nft$generic_queue_attributes) TO
          UPPERVALUE (nft$generic_queue_attributes) DO
      qfile_submission_options^ [array_index] := queue_file_attributes.qfile_submission_option [option_index];
      array_index := array_index + 1;
    FOREND;

    jmp$submit_qfile (file_name, application_name, qfile_submission_options,
          system_file_name, status);
    IF NOT status.normal THEN
      nfp$format_message_to_job_log(status);
    IFEND;

  PROCEND submit_generic_queue_file;
?? TITLE := 'submit_queue_job', EJECT ??

{ PURPOSE:
{   This procedure will convert the nft$queue_submission_option to
{   the queue attribute form for submitting a job.  Then it submits the job.

  PROCEDURE submit_queue_job
    (    file_name: fst$file_reference;
         queue_file_attributes: nft$queue_submission_option;
     VAR job_name: jmt$system_supplied_name;
     VAR status: ost$status);

    VAR
      array_index: integer,
      job_submission_options: ^jmt$job_submission_options,
      number_job_options: integer,
      option_index: nft$input_queue_attributes;

    status.normal := TRUE;
    number_job_options := $INTEGER (UPPERVALUE (nft$input_queue_attributes)) -
          $INTEGER (LOWERVALUE (nft$input_queue_attributes)) + 1;
    PUSH job_submission_options: [1 .. number_job_options];
    array_index := 1;
    FOR option_index := LOWERVALUE (nft$input_queue_attributes) TO UPPERVALUE (nft$input_queue_attributes) DO
      job_submission_options^ [array_index] := queue_file_attributes.job_submission_option [option_index];
      array_index := array_index + 1;
    FOREND;

    jmp$submit_job (file_name, job_submission_options, job_name, status);

  PROCEND submit_queue_job;
?? OLDTITLE ??
MODEND nfm$qtf_server;
