?? RIGHT := 110 ??                                                                                            
?? NEWTITLE := 'NOS/VE: Job Management Queued Files Output Interfaces' ??                                     
MODULE jmm$queue_file_output_manager;                                                                         
                                                                                                              
{ PURPOSE:                                                                                                    
{   This module contains the queue file output management interfaces.  These interfaces control the           
{ access to, submission of, and manipulation of output files.                                                 
{                                                                                                             
{ DESIGN:                                                                                                     
{   The program interfaces contained in this module are designed in such a fashion that binary                
{ compatibility can be maintained.  Any change to the size of a record element in a variant record            
{ will result in an interface breakage.  These procedures operate in rings 2 and 3 with a call bracket        
{ of ring 13.                                                                                                 
                                                                                                              
?? NEWTITLE := 'Global Declarations Referenced by this Module', EJECT ??                                      
?? PUSH (LISTEXT := ON) ??                                                                                    
*copyc amt$access_level                                                                                       
*copyc amt$file_attributes                                                                                    
*copyc amt$local_file_name                                                                                    
*copyc avc$validation_field_names                                                                             
*copyc ave$validation_interface_errors                                                                        
*copyc cle$ecc_lexical                                                                                        
*copyc fme$file_management_errors                                                                             
*copyc fst$file_reference                                                                                     
*copyc i#compare_collated                                                                                     
*copyc i#current_sequence_position                                                                            
*copyc jmc$change_output_attributes                                                                           
*copyc jmc$default_forms_code                                                                                 
*copyc jmc$get_output_attributes                                                                              
*copyc jmc$get_output_status                                                                                  
*copyc jmc$job_management_id                                                                                  
*copyc jmc$print_file                                                                                         
*copyc jmc$system_family                                                                                      
*copyc jmc$terminate_output                                                                                   
*copyc jme$internal_work_area_overflow                                                                        
*copyc jme$job_history_conditions                                                                             
*copyc jme$queued_file_conditions                                                                             
*copyc jme$not_validated_for_copof                                                                            
*copyc jme$no_space_for_file                                                                                  
*copyc jme$operator_queue_restore                                                                             
*copyc jme$work_area_too_small                                                                                
*copyc jml$user_id                                                                                            
*copyc jmt$attribute_keys_set                                                                                 
*copyc jmt$destination_usage                                                                                  
*copyc jmt$name                                                                                               
*copyc jmt$name_list                                                                                          
*copyc jmt$output_attribute_changes                                                                           
*copyc jmt$output_attribute_options                                                                           
*copyc jmt$output_attribute_results                                                                           
*copyc jmt$output_count_range                                                                                 
*copyc jmt$output_counts                                                                                      
*copyc jmt$output_descriptor                                                                                  
*copyc jmt$output_disposition_keys                                                                            
*copyc jmt$output_mechanism                                                                                   
*copyc jmt$output_state_set                                                                                   
*copyc jmt$output_status_count                                                                                
*copyc jmt$output_status_options                                                                              
*copyc jmt$output_status_results                                                                              
*copyc jmt$output_status_updates                                                                              
*copyc jmt$output_submission_options                                                                          
*copyc jmt$output_system_id                                                                                   
*copyc jmt$output_system_label                                                                                
*copyc jmt$output_termination_options                                                                         
*copyc jmt$queue_file_password                                                                                
*copyc jmt$queue_file_path                                                                                    
*copyc jmt$release_output_file_list                                                                           
*copyc jmt$system_supplied_name                                                                               
*copyc jmt$user_supplied_name                                                                                 
*copyc ofe$error_codes                                                                                        
*copyc osc$dual_state_batch                                                                                   
*copyc osc$space_unavailable_condition                                                                        
*copyc osd$virtual_address                                                                                    
*copyc oss$task_private                                                                                       
*copyc ost$caller_identifier                                                                                  
*copyc ost$date_time                                                                                          
*copyc ost$status                                                                                             
*copyc ost$user_identification                                                                                
*copyc pmt$entry_point_reference                                                                              
?? POP ??                                                                                                     
*copyc pmf$job_mode                                                                                           
*copyc amp$get_file_attributes                                                                                
*copyc amp$return                                                                                             
*copyc avp$get_capability                                                                                     
*copyc avp$ring_nominal                                                                                       
*copyc avp$system_administrator                                                                               
*copyc avp$system_displays                                                                                    
*copyc avp$system_operator                                                                                    
*copyc bap$set_local_name_abnormal                                                                            
*copyc bap$validate_file_identifier                                                                           
*copyc clp$convert_string_to_file                                                                             
*copyc clp$get_fs_path_elements                                                                               
*copyc clp$trimmed_string_size                                                                                
*copyc clp$validate_name                                                                                      
*copyc fsp$close_file                                                                                         
*copyc fsp$copy_file                                                                                          
*copyc fsp$open_and_get_type_of_copy                                                                          
*copyc fsp$open_file                                                                                          
*copyc fsp$path_element                                                                                       
*copyc fsp$subsystem_copy_file                                                                                
*copyc ifp$invoke_pause_utility                                                                               
*copyc jmp$convert_date_time_dif_to_us                                                                        
*copyc jmp$copy_seq_to_result_array                                                                           
*copyc jmp$emit_communication_stat                                                                            
*copyc jmp$emit_job_history_statistics                                                                        
*copyc jmp$general_purpose_cluster_rpc                                                                        
*copyc jmp$get_attribute_name                                                                                 
*copyc jmp$get_data_packet_size                                                                               
*copyc jmp$get_jm_work_area                                                                                   
*copyc jmp$get_result_size                                                                                    
*copyc jmp$system_job                                                                                         
*copyc jmp$validate_attribute_options                                                                         
*copyc jmp$validate_name                                                                                      
*copyc jmp$validate_status_options                                                                            
*copyc mmp$create_scratch_segment                                                                             
*copyc mmp$delete_scratch_segment                                                                             
*copyc osp$append_status_parameter                                                                            
*copyc osp$disestablish_cond_handler                                                                          
*copyc osp$establish_block_exit_hndlr                                                                         
*copyc osp$establish_condition_handler                                                                        
*copyc osp$force_access_violation                                                                             
*copyc osp$generate_log_message                                                                               
*copyc osp$get_status_condition_name                                                                          
*copyc osp$is_caller_system_privileged                                                                        
*copyc osp$set_status_abnormal                                                                                
*copyc osp$set_status_condition                                                                               
*copyc osp$set_status_from_condition                                                                          
*copyc osp$verify_system_privilege                                                                            
*copyc pfp$attach                                                                                             
*copyc pfp$begin_system_authority                                                                             
*copyc pfp$define                                                                                             
*copyc pfp$define_catalog                                                                                     
*copyc pfp$end_system_authority                                                                               
*copyc pfp$purge                                                                                              
*copyc pmp$compute_date_time                                                                                  
*copyc pmp$compute_date_time_increment                                                                        
*copyc pmp$continue_to_cause                                                                                  
*copyc pmp$get_compact_date_time                                                                              
*copyc pmp$get_job_names                                                                                      
*copyc pmp$get_mainframe_id                                                                                   
*copyc pmp$get_microsecond_clock                                                                              
*copyc pmp$get_unique_name                                                                                    
*copyc pmp$get_user_identification                                                                            
*copyc pmp$ready_task                                                                                         
*copyc qfp$acquire_modified_output                                                                            
*copyc qfp$acquire_new_output                                                                                 
*copyc qfp$assign_system_supplied_name                                                                        
*copyc qfp$change_output_attributes                                                                           
*copyc qfp$get_application_name                                                                               
*copyc qfp$get_output_counts                                                                                  
*copyc qfp$get_output_status                                                                                  
*copyc qfp$print_file                                                                                         
*copyc qfp$purge_expired_file                                                                                 
*copyc qfp$purge_printed_file                                                                                 
*copyc qfp$read_output_system_label                                                                           
*copyc qfp$rebuild_output_queue                                                                               
*copyc qfp$register_output_application                                                                        
*copyc qfp$release_output_files                                                                               
*copyc qfp$set_output_completed                                                                               
*copyc qfp$set_output_initiated                                                                               
*copyc qfp$terminate_acquired_output                                                                          
*copyc qfp$terminate_output                                                                                   
*copyc qfp$validate_output_file_access                                                                        
*copyc qfp$write_output_system_label                                                                          
*copyc rhp$get_link_user_descriptor                                                                           
*copyc syp$system_is_idling                                                                                   
*copyc amv$nil_file_identifier                                                                                
*copyc avv$account_name                                                                                       
*copyc avv$project_name                                                                                       
*copyc jmv$default_job_attributes                                                                             
*copyc jmv$enable_queue_file_access                                                                           
*copyc jmv$jcb                                                                                                
*copyc jmv$job_attributes                                                                                     
*copyc jmv$job_disposition_code                                                                               
*copyc jmv$job_history_active                                                                                 
*copyc jmv$job_management_work_area_p                                                                         
*copyc jmv$kjlx_p                                                                                             
*copyc jmv$known_output_list                                                                                  
*copyc osv$lower_to_upper                                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'Global Declarations Declared by this Module', EJECT ??                                        
                                                                                                              
  TYPE                                                                                                        
    mainframe_chaoa_parameters = record                                                                       
      privileged_job: boolean,                                                                                
      system_file_name: jmt$system_supplied_name,                                                             
      output_destination_usage: jmt$destination_usage,                                                        
      attribute_change_count: ost$non_negative_integers,                                                      
    recend;                                                                                                   
                                                                                                              
  TYPE                                                                                                        
    mainframe_getoa_parameters = record                                                                       
      status_option_count: ost$non_negative_integers,                                                         
      attach_file: boolean,                                                                                   
      results_keys_count: ost$non_negative_integers,                                                          
    recend;                                                                                                   
                                                                                                              
  TYPE                                                                                                        
    mainframe_getos_parameters = record                                                                       
      user_identification: ost$user_identification,                                                           
      privileged_job: boolean,                                                                                
      status_option_count: ost$non_negative_integers,                                                         
      status_results_count: ost$non_negative_integers,                                                        
    recend;                                                                                                   
                                                                                                              
  TYPE                                                                                                        
    mainframe_tero_parameters = record                                                                        
      system_file_name: jmt$system_supplied_name,                                                             
      reason: ost$name,                                                                                       
      output_state_set: jmt$output_state_set,                                                                 
    recend;                                                                                                   
                                                                                                              
  VAR                                                                                                         
    task_has_registered_application: [STATIC, oss$task_private] boolean := FALSE;                             
                                                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'acquire_output', EJECT ??                                                                     
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this request is to acquire a file from the output queue.  What this means is to attach     
{ the file and read its output system label information.  A subset of this information is then placed in      
{ a descriptor that describes the file being acquired.                                                        
                                                                                                              
  PROCEDURE acquire_output                                                                                    
    (    output_destination_usage: jmt$destination_usage;                                                     
         new_output: boolean;                                                                                 
     VAR output_descriptor: jmt$output_descriptor;                                                            
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      ignore_status: ost$status,                                                                              
      system_label: jmt$output_system_label,                                                                  
      output_name: jmt$name,                                                                                  
      local_file: boolean,                                                                                    
      old_file: boolean,                                                                                      
      contains_data: boolean,                                                                                 
      file_attributes: ^amt$get_attributes,                                                                   
      local_file_name: amt$local_file_name,                                                                   
      usage_selections: pft$usage_selections,                                                                 
      path_p: ^pft$path,                                                                                      
      cycle_selector: pft$cycle_selector,                                                                     
      password: pft$password;                                                                                 
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    ignore_status.normal := TRUE;                                                                             
                                                                                                              
    IF syp$system_is_idling () THEN                                                                           
      osp$set_status_abnormal (jmc$job_management_id, jme$output_queue_is_empty, '', status);                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Acquire the file                                                                                            
                                                                                                              
    IF new_output THEN                                                                                        
      qfp$acquire_new_output (output_destination_usage, output_descriptor, status);                           
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
    ELSE                                                                                                      
      qfp$acquire_modified_output (output_destination_usage, output_descriptor, status);                      
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
{ Attach the file so we can read the system label and get the attributes                                      
                                                                                                              
    pmp$get_unique_name (local_file_name, status);                                                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    determine_file_path (output_destination_usage, output_descriptor.system_file_name, path_p);               
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
    usage_selections := $pft$usage_selections [pfc$read];                                                     
                                                                                                              
    osp$establish_block_exit_hndlr (^handle_block_exit);                                                      
    pfp$begin_system_authority;                                                                               
    pfp$attach (local_file_name, path_p^, cycle_selector, password, usage_selections, usage_selections,       
          pfc$wait, status);                                                                                  
    pfp$end_system_authority;                                                                                 
    osp$disestablish_cond_handler;                                                                            
    IF NOT status.normal THEN                                                                                 
      output_name.kind := jmc$system_supplied_name;                                                           
      output_name.system_supplied_name := output_descriptor.system_file_name;                                 
      jmp$terminate_output (output_name, NIL, ignore_status);                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Read the output file's system label                                                                         
                                                                                                              
    qfp$read_output_system_label (local_file_name, system_label, status);                                     
    IF NOT status.normal THEN                                                                                 
      amp$return (local_file_name, ignore_status);                                                            
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Get the necessary file attributes for the output file                                                       
                                                                                                              
    PUSH file_attributes: [1 .. 4];                                                                           
    file_attributes^ [1].key := amc$file_length;                                                              
    file_attributes^ [2].key := amc$page_format;                                                              
    file_attributes^ [3].key := amc$page_length;                                                              
    file_attributes^ [4].key := amc$page_width;                                                               
    amp$get_file_attributes (local_file_name, file_attributes^, local_file, old_file, contains_data, status); 
    IF NOT status.normal THEN                                                                                 
      amp$return (local_file_name, ignore_status);                                                            
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Release the file in case somebody needs it for write access                                                 
                                                                                                              
    amp$return (local_file_name, status);                                                                     
                                                                                                              
{ Set up the fields in the output descriptor                                                                  
                                                                                                              
    output_descriptor.comment_banner := system_label.comment_banner;                                          
    output_descriptor.control_family := system_label.output_controller.family;                                
    output_descriptor.control_user := system_label.output_controller.user;                                    
    output_descriptor.copies := system_label.copy_count;                                                      
    output_descriptor.copies_printed := system_label.copies_printed;                                          
    output_descriptor.data_declaration := system_label.data_declaration;                                      
    output_descriptor.data_mode := system_label.data_mode;                                                    
    output_descriptor.device := system_label.device;                                                          
    output_descriptor.device_type := system_label.device_type;                                                
    output_descriptor.disposition_code := system_label.disposition_code;                                      
    IF system_label.output_destination_usage = jmc$dual_state_usage THEN                                      
      output_descriptor.dual_state_account := system_label.dual_state_account;                                
      output_descriptor.dual_state_family_name := system_label.dual_state_family_name;                        
      output_descriptor.dual_state_password := system_label.dual_state_password;                              
      output_descriptor.dual_state_project := system_label.dual_state_project;                                
      output_descriptor.dual_state_user := system_label.dual_state_user;                                      
    ELSE                                                                                                      
      output_descriptor.dual_state_account := osc$null_name;                                                  
      output_descriptor.dual_state_family_name := osc$null_name;                                              
      output_descriptor.dual_state_password := osc$null_name;                                                 
      output_descriptor.dual_state_project := osc$null_name;                                                  
      output_descriptor.dual_state_user := osc$null_name;                                                     
    IFEND;                                                                                                    
    output_descriptor.earliest_print_time := system_label.earliest_print_time;                                
    output_descriptor.external_characteristics := system_label.external_characteristics;                      
    output_descriptor.file_position := system_label.file_position;                                            
    output_descriptor.file_size := file_attributes^ [1].file_length;                                          
    output_descriptor.forms_code := system_label.forms_code;                                                  
    output_descriptor.implicit_routing_text := system_label.implicit_routing_text;                            
    output_descriptor.latest_print_time := system_label.latest_print_time;                                    
    output_descriptor.login_account := system_label.login_account;                                            
    output_descriptor.login_family := system_label.login_user_identification.family;                          
    output_descriptor.login_project := system_label.login_project;                                            
    output_descriptor.login_user := system_label.login_user_identification.user;                              
    output_descriptor.originating_application_name := system_label.originating_application_name;              
    output_descriptor.output_class := system_label.output_class;                                              
    output_descriptor.output_destination := system_label.output_destination;                                  
    output_descriptor.output_destination_family := system_label.output_destination_family;                    
    output_descriptor.output_destination_usage := system_label.output_destination_usage;                      
    output_descriptor.output_disposition_key := system_label.output_disposition_key;                          
    output_descriptor.output_priority := system_label.output_priority;                                        
    output_descriptor.output_submission_time := system_label.output_submission_time;                          
    output_descriptor.page_format := file_attributes^ [2].page_format;                                        
    output_descriptor.page_length := file_attributes^ [3].page_length;                                        
    output_descriptor.page_width := file_attributes^ [4].page_width;                                          
    output_descriptor.purge_delay := system_label.purge_delay;                                                
    output_descriptor.remote_host_directive := system_label.remote_host_directive;                            
    output_descriptor.routing_banner := system_label.routing_banner;                                          
    output_descriptor.site_information := system_label.site_information;                                      
    output_descriptor.source_logical_id := system_label.source_logical_id;                                    
    output_descriptor.station := system_label.station;                                                        
    output_descriptor.station_operator := system_label.station_operator;                                      
    output_descriptor.system_file_name := system_label.system_file_name;                                      
    output_descriptor.system_job_name := system_label.system_job_name;                                        
    output_descriptor.system_routing_text := system_label.system_routing_text;                                
    output_descriptor.user_file_name := system_label.user_file_name;                                          
    output_descriptor.user_information := system_label.user_information;                                      
    output_descriptor.user_job_name := system_label.user_job_name;                                            
    output_descriptor.vertical_print_density := system_label.vertical_print_density;                          
    output_descriptor.vfu_load_procedure := system_label.vfu_load_procedure;                                  
  PROCEND acquire_output;                                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[INLINE] determine_file_path', EJECT ??                                                       
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this request is to PUSH the correct path name for an output file on the requestors         
{ stack.                                                                                                      
{                                                                                                             
{ NOTES:                                                                                                      
{   This procedure MUST be INLINE.                                                                            
                                                                                                              
  PROCEDURE [INLINE] determine_file_path                                                                      
    (    output_destination_usage: jmt$destination_usage;                                                     
         system_file_name: jmt$system_supplied_name;                                                          
     VAR path_p: ^pft$path);                                                                                  
                                                                                                              
    PUSH path_p: [1 .. 4];                                                                                    
    path_p^ [1] := jmc$system_family;                                                                         
    path_p^ [2] := jmc$system_user;                                                                           
    determine_file_catalog (output_destination_usage, path_p^ [3]);                                           
    path_p^ [4] := system_file_name;                                                                          
  PROCEND determine_file_path;                                                                                
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[INLINE] determine_file_catalog', EJECT ??                                                    
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this request is to determine which catalog a file is in based on its output                
{ destination usage                                                                                           
                                                                                                              
  PROCEDURE [INLINE] determine_file_catalog                                                                   
    (    output_destination_usage: jmt$destination_usage;                                                     
     VAR output_catalog: ost$name);                                                                           
                                                                                                              
    IF (output_destination_usage = jmc$dual_state_usage) OR (output_destination_usage = jmc$private_usage) OR 
          (output_destination_usage = jmc$public_usage) THEN                                                  
      output_catalog := jmc$job_output_catalog;                                                               
    ELSE                                                                                                      
      output_catalog := jmc$job_output_catalog;                                                               
                                                                                                              
{***  output_catalog := jmc$sf_job_output_catalog;                                                            
                                                                                                              
    IFEND;                                                                                                    
  PROCEND determine_file_catalog;                                                                             
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$acquire_modified_output', EJECT ??                                          
*copy jmh$acquire_modified_output                                                                             
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$acquire_modified_output                                                         
    (    output_destination_usage: jmt$destination_usage;                                                     
     VAR output_descriptor: jmt$output_descriptor;                                                            
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    acquire_output (output_destination_usage, FALSE, output_descriptor, status);                              
                                                                                                              
  PROCEND jmp$acquire_modified_output;                                                                        
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$acquire_new_output', EJECT ??                                               
*copy jmh$acquire_new_output                                                                                  
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$acquire_new_output                                                              
    (    output_destination_usage: jmt$destination_usage;                                                     
     VAR output_descriptor: jmt$output_descriptor;                                                            
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    acquire_output (output_destination_usage, TRUE, output_descriptor, status);                               
                                                                                                              
  PROCEND jmp$acquire_new_output;                                                                             
                                                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$activate_output', EJECT ??                                                  
*copy jmh$activate_output                                                                                     
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$activate_output                                                                 
    (    system_file_name: jmt$system_supplied_name;                                                          
         subcatalog_name: ost$name;                                                                           
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    IF NOT (avp$system_administrator () OR avp$system_operator ()) THEN                                       
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'system_administration OR system_operation', status);
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    jmp$rebuild_output_queue (system_file_name, subcatalog_name, status);                                     
                                                                                                              
  PROCEND jmp$activate_output;                                                                                
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$change_output_attributes', EJECT ??                                         
*copy jmh$change_output_attributes                                                                            
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$change_output_attributes                                                        
    (    output_name: jmt$name;                                                                               
         output_attribute_changes: ^jmt$output_attribute_changes;                                             
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      change_index: integer,                                                                                  
      ignore_status: ost$status,                                                                              
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_attribute_changes_p: ^jmt$output_attribute_changes,                                               
      local_parameters_p: ^mainframe_chaoa_parameters,                                                        
      local_purge_delay_p: ^jmt$time_increment,                                                               
      local_remote_host_directive_p: ^jmt$remote_host_directive,                                              
      local_site_information_p: ^jmt$site_information,                                                        
      local_user_information_p: ^jmt$user_information,                                                        
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      number_of_data_packets: ost$non_negative_integers,                                                      
      number_of_outputs_found: jmt$output_status_count,                                                       
      output_status_options_p: ^jmt$output_status_options,                                                    
      output_status_results_p: ^jmt$output_status_results,                                                    
      privileged_job: boolean,                                                                                
      scl_name: ost$name,                                                                                     
      scratch_segment: amt$segment_pointer,                                                                   
      status_results_keys_p: ^jmt$results_keys,                                                               
      status_result_size: ost$segment_length,                                                                 
      status_work_area_p: ^SEQ ( * ),                                                                         
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * ),                                                                           
      target_options_size: ost$non_negative_integers,                                                         
      valid_name: boolean;                                                                                    
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      CASE condition.selector OF                                                                              
      = pmc$block_exit_processing =                                                                           
        mmp$delete_scratch_segment (scratch_segment, ignore_status);                                          
        IF status.normal THEN                                                                                 
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                               
      CASEND;                                                                                                 
    PROCEND handle_block_exit;                                                                                
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
                                                                                                              
    ignore_status.normal := TRUE;                                                                             
    status.normal := TRUE;                                                                                    
                                                                                                              
    privileged_job := avp$system_operator ();                                                                 
                                                                                                              
    PUSH output_status_options_p: [1 .. 3];                                                                   
    output_status_options_p^ [1].key := jmc$name_list;                                                        
    PUSH output_status_options_p^ [1].name_list: [1 .. 1];                                                    
    output_status_options_p^ [1].name_list^ [1] := output_name;                                               
    output_status_options_p^ [2].key := jmc$privilege;                                                        
    IF privileged_job THEN                                                                                    
      output_status_options_p^ [2].privilege := jmc$privileged;                                               
    ELSE                                                                                                      
      output_status_options_p^ [2].privilege := jmc$not_privileged;                                           
    IFEND;                                                                                                    
    output_status_options_p^ [3].key := jmc$continue_request_to_servers;                                      
    output_status_options_p^ [3].continue_request_to_servers := TRUE;                                         
                                                                                                              
    PUSH status_results_keys_p: [1 .. 4];                                                                     
    status_results_keys_p^ [1] := jmc$system_file_name;                                                       
    status_results_keys_p^ [2] := jmc$output_state;                                                           
    status_results_keys_p^ [3] := jmc$output_destination_usage;                                               
    status_results_keys_p^ [4] := jmc$client_mainframe_id;                                                    
                                                                                                              
{ If we are able to status the output file, we have control over the file                                     
{ so we can change the attributes of the file                                                                 
                                                                                                              
    jmp$get_result_size ({number_of_items} 1, #SEQ (status_results_keys_p^), status_result_size);             
    PUSH status_work_area_p: [[REP status_result_size OF cell]];                                              
    RESET status_work_area_p;                                                                                 
                                                                                                              
    jmp$get_output_status (output_status_options_p, status_results_keys_p, status_work_area_p,                
          output_status_results_p, number_of_outputs_found, status);                                          
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$work_area_too_small THEN                                                      
        IF output_name.kind = jmc$system_supplied_name THEN { Can't ever happen                               
          osp$set_status_abnormal (jmc$job_management_id, jme$duplicate_name,                                 
                output_name.system_supplied_name, status);                                                    
        ELSE                                                                                                  
          osp$set_status_abnormal (jmc$job_management_id, jme$duplicate_name, output_name.user_supplied_name, 
                status);                                                                                      
        IFEND;                                                                                                
      IFEND;                                                                                                  
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    IF output_status_results_p^ [1]^ [2].output_state IN $jmt$output_state_set                                
          [jmc$initiated_output, jmc$terminated_output] THEN                                                  
                                                                                                              
{ In order for the output state to be terminated, the file must either be printing or the application         
{ responsible for the file will momentarily return the file to queue file management.  In any case,           
{ the same error (jme$output_is_initiated) is reported since the later is not likely to occur.                
                                                                                                              
      IF output_name.kind = jmc$system_supplied_name THEN                                                     
        osp$set_status_abnormal (jmc$job_management_id, jme$output_is_initiated,                              
              output_name.system_supplied_name, status);                                                      
      ELSE                                                                                                    
        osp$set_status_abnormal (jmc$job_management_id, jme$output_is_initiated,                              
              output_name.user_supplied_name, status);                                                        
      IFEND;                                                                                                  
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Pack up the required information and pass it to the general purpose request.                                
                                                                                                              
    mmp$create_scratch_segment (amc$sequence_pointer, mmc$as_sequential, scratch_segment, status);            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
    RESET scratch_segment.sequence_pointer;                                                                   
                                                                                                              
    osp$establish_block_exit_hndlr (^handle_block_exit);                                                      
                                                                                                              
    NEXT local_parameters_p IN scratch_segment.sequence_pointer;                                              
                                                                                                              
    local_parameters_p^.privileged_job := privileged_job;                                                     
    local_parameters_p^.system_file_name := output_status_results_p^ [1]^ [1].system_file_name;               
    local_parameters_p^.output_destination_usage := output_status_results_p^ [1]^ [3].                        
          output_destination_usage;                                                                           
                                                                                                              
    IF output_attribute_changes = NIL THEN                                                                    
      local_parameters_p^.attribute_change_count := 0;                                                        
    ELSE                                                                                                      
      local_parameters_p^.attribute_change_count := UPPERBOUND (output_attribute_changes^);                   
      NEXT local_attribute_changes_p: [1 .. local_parameters_p^.attribute_change_count] IN                    
            scratch_segment.sequence_pointer;                                                                 
                                                                                                              
      IF local_attribute_changes_p <> NIL THEN                                                                
                                                                                                              
      /validate_changes/                                                                                      
        FOR change_index := 1 TO UPPERBOUND (output_attribute_changes^) DO                                    
          local_attribute_changes_p^ [change_index].key := output_attribute_changes^ [change_index].key;      
                                                                                                              
          CASE output_attribute_changes^ [change_index].key OF                                                
          = jmc$comment_banner =                                                                              
            local_attribute_changes_p^ [change_index].comment_banner :=                                       
                  output_attribute_changes^ [change_index].comment_banner;                                    
                                                                                                              
          = jmc$copies =                                                                                      
            local_attribute_changes_p^ [change_index].copies :=                                               
                  output_attribute_changes^ [change_index].copies;                                            
                                                                                                              
          = jmc$device =                                                                                      
            clp$validate_name (output_attribute_changes^ [change_index].device, scl_name, valid_name);        
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_attribute_changes^ [change_index].device, status);                                 
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].device := scl_name;                                     
                                                                                                              
          = jmc$earliest_print_time =                                                                         
            local_attribute_changes_p^ [change_index].earliest_print_time :=                                  
                  output_attribute_changes^ [change_index].earliest_print_time;                               
                                                                                                              
          = jmc$external_characteristics =                                                                    
            #TRANSLATE (osv$lower_to_upper, output_attribute_changes^ [change_index].external_characteristics,
                  local_attribute_changes_p^ [change_index].external_characteristics);                        
                                                                                                              
          = jmc$forms_code =                                                                                  
            #TRANSLATE (osv$lower_to_upper, output_attribute_changes^ [change_index].forms_code,              
                  local_attribute_changes_p^ [change_index].forms_code);                                      
                                                                                                              
          = jmc$latest_print_time =                                                                           
            local_attribute_changes_p^ [change_index].latest_print_time :=                                    
                  output_attribute_changes^ [change_index].latest_print_time;                                 
                                                                                                              
          = jmc$null_attribute =                                                                              
            ;                                                                                                 
                                                                                                              
          = jmc$output_class =                                                                                
            clp$validate_name (output_attribute_changes^ [change_index].output_class, scl_name, valid_name);  
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_attribute_changes^ [change_index].output_class, status);                           
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].output_class := scl_name;                               
                                                                                                              
          = jmc$output_deferred_by_operator =                                                                 
            IF NOT privileged_job THEN                                                                        
              osp$set_status_abnormal (jmc$job_management_id, jme$requires_operator_privilege,                
                    'OUTPUT_DEFERRED_BY_OPERATOR', status);                                                   
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].output_deferred_by_operator :=                          
                  output_attribute_changes^ [change_index].output_deferred_by_operator;                       
                                                                                                              
          = jmc$output_deferred_by_user =                                                                     
            local_attribute_changes_p^ [change_index].output_deferred_by_user :=                              
                  output_attribute_changes^ [change_index].output_deferred_by_user;                           
                                                                                                              
          = jmc$output_destination =                                                                          
            clp$validate_name (output_attribute_changes^ [change_index].output_destination, scl_name,         
                  valid_name);                                                                                
            IF valid_name THEN                                                                                
              local_attribute_changes_p^ [change_index].output_destination := scl_name;                       
            ELSE                                                                                              
              #TRANSLATE (osv$lower_to_upper, output_attribute_changes^ [change_index].output_destination,    
                    local_attribute_changes_p^ [change_index].output_destination);                            
            IFEND;                                                                                            
                                                                                                              
          = jmc$output_destination_family =                                                                   
            clp$validate_name (output_attribute_changes^ [change_index].output_destination_family, scl_name,  
                  valid_name);                                                                                
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_attribute_changes^ [change_index].output_destination_family, status);              
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].output_destination_family := scl_name;                  
                                                                                                              
          = jmc$output_destination_usage =                                                                    
            clp$validate_name (output_attribute_changes^ [change_index].output_destination_usage, scl_name,   
                  valid_name);                                                                                
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_attribute_changes^ [change_index].output_destination_usage, status);               
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].output_destination_usage := scl_name;                   
                                                                                                              
          = jmc$output_priority =                                                                             
            clp$validate_name (output_attribute_changes^ [change_index].output_priority, scl_name,            
                  valid_name);                                                                                
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_attribute_changes^ [change_index].output_priority, status);                        
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].output_priority := scl_name;                            
                                                                                                              
          = jmc$purge_delay =                                                                                 
                                                                                                              
{ If the purge delay has changed, the output disposition time has changed.                                    
                                                                                                              
            NEXT local_purge_delay_p IN scratch_segment.sequence_pointer;                                     
            local_purge_delay_p^ := output_attribute_changes^ [change_index].purge_delay^;                    
                                                                                                              
          = jmc$remote_host_directive =                                                                       
            NEXT local_remote_host_directive_p IN scratch_segment.sequence_pointer;                           
            local_remote_host_directive_p^ := output_attribute_changes^ [change_index].remote_host_directive^;
                                                                                                              
          = jmc$reprint_disposition =                                                                         
            local_attribute_changes_p^ [change_index].reprint_disposition :=                                  
                  output_attribute_changes^ [change_index].reprint_disposition;                               
                                                                                                              
          = jmc$routing_banner =                                                                              
            local_attribute_changes_p^ [change_index].routing_banner :=                                       
                  output_attribute_changes^ [change_index].routing_banner;                                    
                                                                                                              
          = jmc$site_information =                                                                            
                                                                                                              
            IF avp$system_operator () THEN                                                                    
              NEXT local_site_information_p IN scratch_segment.sequence_pointer;                              
              local_site_information_p^ := output_attribute_changes^ [change_index].site_information^;        
            ELSE                                                                                              
              osp$set_status_abnormal ('OF', ofe$sou_not_active, 'system_operation', status);                 
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
                                                                                                              
          = jmc$station =                                                                                     
            clp$validate_name (output_attribute_changes^ [change_index].station, scl_name, valid_name);       
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_attribute_changes^ [change_index].station, status);                                
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].station := scl_name;                                    
                                                                                                              
          = jmc$station_operator =                                                                            
            clp$validate_name (output_attribute_changes^ [change_index].station_operator, scl_name,           
                  valid_name);                                                                                
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_attribute_changes^ [change_index].station_operator, status);                       
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].station_operator := scl_name;                           
                                                                                                              
          = jmc$user_information =                                                                            
            NEXT local_user_information_p IN scratch_segment.sequence_pointer;                                
            local_user_information_p^ := output_attribute_changes^ [change_index].user_information^;          
                                                                                                              
          = jmc$vertical_print_density =                                                                      
            local_attribute_changes_p^ [change_index].vertical_print_density :=                               
                  output_attribute_changes^ [change_index].vertical_print_density;                            
                                                                                                              
            IF local_attribute_changes_p^ [change_index].vertical_print_density >                             
                  jmc$vertical_print_density_6 THEN                                                           
              local_attribute_changes_p^ [change_index].vertical_print_density :=                             
                    jmc$vertical_print_density_8;                                                             
                                                                                                              
            ELSEIF local_attribute_changes_p^ [change_index].vertical_print_density =                         
                  jmc$vertical_print_density_file THEN                                                        
              jmp$get_attribute_name (output_attribute_changes^ [change_index].key, scl_name);                
              osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter_value, scl_name, status); 
              osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_ATTRIBUTE_CHANGES',        
                    status);                                                                                  
              osp$append_status_parameter (osc$status_parameter_delimiter, jmc$change_output_attributes,      
                    status);                                                                                  
              EXIT /validate_changes/;                                                                        
            IFEND;                                                                                            
                                                                                                              
          = jmc$vfu_load_procedure =                                                                          
            IF output_attribute_changes^ [change_index].vfu_load_procedure <> osc$null_name THEN              
              clp$validate_name (output_attribute_changes^ [change_index].vfu_load_procedure, scl_name,       
                    valid_name);                                                                              
              IF NOT valid_name THEN                                                                          
                osp$set_status_abnormal ('CL', cle$improper_name,                                             
                      output_attribute_changes^ [change_index].vfu_load_procedure, status);                   
                EXIT /validate_changes/;                                                                      
              IFEND;                                                                                          
              local_attribute_changes_p^ [change_index].vfu_load_procedure := scl_name;                       
            ELSE                                                                                              
              local_attribute_changes_p^ [change_index].vfu_load_procedure := osc$null_name;                  
            IFEND;                                                                                            
                                                                                                              
          ELSE                                                                                                
            jmp$get_attribute_name (output_attribute_changes^ [change_index].key, scl_name);                  
            osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter, scl_name, status);         
            osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_ATTRIBUTE_CHANGES', status); 
            osp$append_status_parameter (osc$status_parameter_delimiter, jmc$change_output_attributes,        
                  status);                                                                                    
            EXIT /validate_changes/;                                                                          
          CASEND;                                                                                             
        FOREND /validate_changes/;                                                                            
      ELSE                                                                                                    
        osp$set_status_condition (jme$internal_work_area_overflow, status);                                   
      IFEND;                                                                                                  
                                                                                                              
      IF NOT status.normal THEN                                                                               
        mmp$delete_scratch_segment (scratch_segment, ignore_status);                                          
        osp$disestablish_cond_handler;                                                                        
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
    IFEND;                                                                                                    
                                                                                                              
{ Call the general purpose RPC processor to change the output attributes.                                     
                                                                                                              
    mainframes_processed.count := 0;                                                                          
    target_options_size := i#current_sequence_position (scratch_segment.sequence_pointer);                    
    RESET scratch_segment.sequence_pointer;                                                                   
    NEXT target_options_p: [[REP target_options_size OF cell]] IN scratch_segment.sequence_pointer;           
    RESET target_options_p;                                                                                   
    jm_work_area_p := NIL;                                                                                    
    jmp$general_purpose_cluster_rpc (output_status_results_p^ [1]^ [4].client_mainframe_id,                   
          jmc$gpro_change_output_attribut, {data_packet_size} 0, mainframes_processed, target_options_p,      
          jm_work_area_p, target_mainframe_reached, mainframes_processed, number_of_data_packets, status);    
                                                                                                              
    mmp$delete_scratch_segment (scratch_segment, ignore_status);                                              
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
  PROCEND jmp$change_output_attributes;                                                                       
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$close_files_for_copof', EJECT ??                                            
*copy jmh$close_files_for_copof                                                                               
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$close_files_for_copof                                                           
    (    output_fid: amt$file_identifier;                                                                     
         output_lfn: amt$local_file_name;                                                                     
         target_fid: amt$file_identifier;                                                                     
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      file_id_is_valid: boolean,                                                                              
      file_instance: ^bat$task_file_entry,                                                                    
      local_status: ost$status;                                                                               
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
{ Verify that the caller is part of NOS/VE, not an application.                                               
                                                                                                              
    osp$verify_system_privilege;                                                                              
                                                                                                              
{ Close the files and detach the output queue file.                                                           
                                                                                                              
    IF output_fid <> amv$nil_file_identifier THEN                                                             
      bap$validate_file_identifier (output_fid, file_instance, file_id_is_valid);                             
      IF file_id_is_valid THEN                                                                                
        fsp$close_file (output_fid, status);                                                                  
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
    amp$return (output_lfn, local_status);                                                                    
    IF status.normal AND (NOT local_status.normal) THEN                                                       
      status := local_status;                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    IF target_fid <> amv$nil_file_identifier THEN                                                             
      bap$validate_file_identifier (target_fid, file_instance, file_id_is_valid);                             
      IF file_id_is_valid THEN                                                                                
        fsp$close_file (target_fid, local_status);                                                            
        IF status.normal AND (NOT local_status.normal) THEN                                                   
          status := local_status;                                                                             
        IFEND;                                                                                                
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$close_files_for_copof;                                                                          
                                                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$close_output_file', EJECT ??                                                
*copy jmh$close_output_file                                                                                   
                                                                                                              
{ DESIGN:                                                                                                     
{   This procedure will close a file with the specified file identifier.                                      
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$close_output_file                                                               
    (    file_identifier: amt$file_identifier;                                                                
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    fsp$close_file (file_identifier, status);                                                                 
                                                                                                              
  PROCEND jmp$close_output_file;                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$get_output_counts', EJECT ??                                                
*copy jmh$get_output_counts                                                                                   
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$get_output_counts                                                               
    (VAR output_counts: jmt$output_counts;                                                                    
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
    qfp$get_output_counts (output_counts, status);                                                            
  PROCEND jmp$get_output_counts;                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$get_output_attributes', EJECT ??                                            
*copy jmh$get_output_attributes                                                                               
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$get_output_attributes                                                           
    (    output_attribute_options_p: ^jmt$output_attribute_options;                                           
         output_attribute_results_keys_p: ^jmt$results_keys;                                                  
     VAR work_area_p: ^jmt$work_area;                                                                         
     VAR output_attribute_results_p: ^jmt$output_attribute_results;                                           
     VAR number_of_outputs_found: jmt$output_status_count;                                                    
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      continue_request_to_servers: boolean,                                                                   
      good_name: jmt$name,                                                                                    
      ignore_status: ost$status,                                                                              
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_parameters_p: ^mainframe_getoa_parameters,                                                        
      local_results_keys_p: ^jmt$results_keys,                                                                
      local_status_keys_p: ^jmt$results_keys,                                                                 
      local_status_name_count_p: ^ost$non_negative_integers,                                                  
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      name_index: integer,                                                                                    
      number_of_data_packets: ost$non_negative_integers,                                                      
      option_index: ost$non_negative_integers,                                                                
      output_status_options_p: ^jmt$output_status_options,                                                    
      privileged_job: boolean,                                                                                
      result_element_size: ost$segment_length,                                                                
      result_index: ost$non_negative_integers,                                                                
      save_work_area_p: ^jmt$work_area,                                                                       
      scl_name: ost$name,                                                                                     
      scratch_segment: amt$segment_pointer,                                                                   
      specified_keys: jmt$attribute_keys_set,                                                                 
      target_mainframe_id: pmt$mainframe_id,                                                                  
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * ),                                                                           
      target_options_size: ost$non_negative_integers,                                                         
      valid_name: boolean;                                                                                    
                                                                                                              
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise.                                                                                                    
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      mmp$delete_scratch_segment (scratch_segment, ignore_status);                                            
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
{ BEGIN: jmp$get_output_attributes                                                                            
                                                                                                              
    status.normal := TRUE;                                                                                    
    number_of_outputs_found := 0;                                                                             
    continue_request_to_servers := FALSE;                                                                     
                                                                                                              
    privileged_job := avp$system_operator () OR avp$system_displays ();                                       
                                                                                                              
    mmp$create_scratch_segment (amc$sequence_pointer, mmc$as_sequential, scratch_segment, status);            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
    RESET scratch_segment.sequence_pointer;                                                                   
                                                                                                              
    osp$establish_block_exit_hndlr (^handle_block_exit);                                                      
                                                                                                              
    NEXT local_parameters_p IN scratch_segment.sequence_pointer;                                              
                                                                                                              
    IF output_attribute_options_p = NIL THEN                                                                  
      local_parameters_p^.status_option_count := 2;                                                           
      NEXT output_status_options_p: [1 .. local_parameters_p^.status_option_count] IN                         
            scratch_segment.sequence_pointer;                                                                 
      option_index := 1;                                                                                      
                                                                                                              
    ELSE                                                                                                      
      save_work_area_p := scratch_segment.sequence_pointer;                                                   
      jmp$validate_attribute_options (jmc$get_output_attributes, 'OUTPUT_ATTRIBUTE_OPTIONS_P',                
            #SEQ (output_attribute_options_p^), { number_of_options_to_add } 2, continue_request_to_servers,  
            local_parameters_p^.status_option_count, scratch_segment.sequence_pointer, status);               
      IF NOT status.normal THEN                                                                               
        mmp$delete_scratch_segment (scratch_segment, ignore_status);                                          
        osp$disestablish_cond_handler;                                                                        
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
      NEXT output_status_options_p: [1 .. local_parameters_p^.status_option_count] IN save_work_area_p;       
      option_index := local_parameters_p^.status_option_count - 1;                                            
    IFEND;                                                                                                    
                                                                                                              
    output_status_options_p^ [option_index].key := jmc$privilege;                                             
    IF privileged_job THEN                                                                                    
      output_status_options_p^ [option_index].privilege := jmc$privileged;                                    
    ELSE                                                                                                      
      output_status_options_p^ [option_index].privilege := jmc$not_privileged;                                
    IFEND;                                                                                                    
    output_status_options_p^ [option_index + 1].key := jmc$user_identification;                               
    NEXT output_status_options_p^ [option_index + 1].user_identification IN scratch_segment.sequence_pointer; 
    pmp$get_user_identification (output_status_options_p^ [option_index + 1].user_identification^,            
          ignore_status);                                                                                     
                                                                                                              
    local_parameters_p^.attach_file := FALSE;                                                                 
                                                                                                              
{ Verify that result is only asking for valid fields                                                          
                                                                                                              
    IF output_attribute_results_keys_p = NIL THEN                                                             
      local_parameters_p^.results_keys_count := 0;                                                            
      result_element_size := 0;                                                                               
    ELSE                                                                                                      
      local_parameters_p^.results_keys_count := UPPERBOUND (output_attribute_results_keys_p^);                
                                                                                                              
{ Make two copies of the result keys.  One for what to return, the other a list of values that                
{ the status request is to return.                                                                            
                                                                                                              
      NEXT local_results_keys_p: [1 .. local_parameters_p^.results_keys_count] IN                             
            scratch_segment.sequence_pointer;                                                                 
      NEXT local_status_keys_p: [1 .. local_parameters_p^.results_keys_count] IN                              
            scratch_segment.sequence_pointer;                                                                 
                                                                                                              
      local_results_keys_p^ := output_attribute_results_keys_p^;                                              
      local_status_keys_p^ := output_attribute_results_keys_p^;                                               
                                                                                                              
      FOR result_index := 1 TO local_parameters_p^.results_keys_count DO                                      
        CASE local_results_keys_p^ [result_index] OF                                                          
        = jmc$comment_banner, jmc$copies, jmc$copies_printed, jmc$data_mode, jmc$device, jmc$device_type,     
              jmc$earliest_print_time, jmc$external_characteristics, jmc$file_position, jmc$file_size,        
              jmc$forms_code, jmc$latest_print_time, jmc$login_account, jmc$login_project,                    
              jmc$origin_application_name, jmc$output_class, jmc$output_destination,                          
              jmc$output_destination_family { operator_family } , jmc$output_priority,                        
              jmc$output_submission_time, jmc$purge_delay, jmc$remote_host_directive, jmc$routing_banner,     
              jmc$site_information, jmc$station, jmc$station_operator { operator_user } ,                     
              jmc$user_information, jmc$vertical_print_density, jmc$vfu_load_procedure =                      
          local_parameters_p^.attach_file := TRUE;                                                            
          local_status_keys_p^ [result_index] := jmc$null_attribute;                                          
                                                                                                              
        = jmc$control_family, jmc$control_user, jmc$login_family, jmc$login_user, jmc$null_attribute,         
              jmc$output_deferred_by_operator, jmc$output_deferred_by_user, jmc$output_destination_usage,     
              jmc$output_state, jmc$system_file_name, jmc$system_job_name, jmc$user_file_name,                
              jmc$user_job_name =                                                                             
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (local_results_keys_p^ [result_index], scl_name);                            
          osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter, scl_name, status);           
          osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_ATTRIBUTE_RESULTS_KEYS_P',     
                status);                                                                                      
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$get_output_attributes, status);    
          mmp$delete_scratch_segment (scratch_segment, ignore_status);                                        
          osp$disestablish_cond_handler;                                                                      
          RETURN;                                                                                             
        CASEND;                                                                                               
                                                                                                              
      FOREND; { result index                                                                                  
                                                                                                              
      jmp$get_data_packet_size (local_results_keys_p, result_element_size, status);                           
      IF NOT status.normal THEN                                                                               
        mmp$delete_scratch_segment (scratch_segment, ignore_status);                                          
        osp$disestablish_cond_handler;                                                                        
        RETURN;                                                                                               
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
    IF continue_request_to_servers THEN                                                                       
      target_mainframe_id := pmc$null_mainframe_id;                                                           
    ELSE                                                                                                      
      pmp$get_mainframe_id (target_mainframe_id, ignore_status);                                              
    IFEND;                                                                                                    
                                                                                                              
    mainframes_processed.count := 0;                                                                          
    target_options_size := i#current_sequence_position (scratch_segment.sequence_pointer);                    
    RESET scratch_segment.sequence_pointer;                                                                   
    NEXT target_options_p: [[REP target_options_size OF cell]] IN scratch_segment.sequence_pointer;           
    RESET target_options_p;                                                                                   
    NEXT jm_work_area_p: [[REP (osc$max_segment_length - target_options_size) OF cell]] IN                    
          scratch_segment.sequence_pointer;                                                                   
    RESET jm_work_area_p;                                                                                     
                                                                                                              
    jmp$general_purpose_cluster_rpc (target_mainframe_id, jmc$gpro_get_output_attributes,                     
          {data_packet_size} result_element_size, mainframes_processed, target_options_p, jm_work_area_p,     
          target_mainframe_reached, mainframes_processed, number_of_data_packets, status);                    
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$work_area_too_small THEN                                                      
        number_of_outputs_found := number_of_data_packets;                                                    
      IFEND;                                                                                                  
      mmp$delete_scratch_segment (scratch_segment, ignore_status);                                            
      osp$disestablish_cond_handler;                                                                          
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    number_of_outputs_found := number_of_data_packets;                                                        
    IF number_of_outputs_found = 0 THEN                                                                       
      osp$set_status_condition (jme$no_outputs_were_found, status);                                           
    ELSEIF output_attribute_results_keys_p <> NIL THEN                                                        
      RESET jm_work_area_p;                                                                                   
      save_work_area_p := work_area_p;                                                                        
      jmp$copy_seq_to_result_array (UPPERBOUND (output_attribute_results_keys_p^), number_of_outputs_found,   
            output_attribute_results_keys_p, jm_work_area_p, work_area_p, status);                            
      NEXT output_attribute_results_p: [1 .. number_of_outputs_found] IN save_work_area_p;                    
    IFEND;                                                                                                    
                                                                                                              
    IF status.normal THEN                                                                                     
      mmp$delete_scratch_segment (scratch_segment, status);                                                   
    ELSE                                                                                                      
      mmp$delete_scratch_segment (scratch_segment, ignore_status);                                            
    IFEND;                                                                                                    
                                                                                                              
    osp$disestablish_cond_handler;                                                                            
  PROCEND jmp$get_output_attributes;                                                                          
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$get_output_path_elements', EJECT ??                                         
*copy jmh$get_output_path_elements                                                                            
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$get_output_path_elements                                                        
    (    system_file_name: jmt$system_supplied_name;                                                          
     VAR path: jmt$queue_file_path;                                                                           
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      candidate_name: jmt$name,                                                                               
      good_name: jmt$name,                                                                                    
      local_path_p: ^pft$path,                                                                                
      number_of_outputs_found: jmt$output_status_count,                                                       
      output_status_options_p: ^jmt$output_status_options,                                                    
      output_status_results_p: ^jmt$output_status_results,                                                    
      privileged_job: boolean,                                                                                
      status_results_keys_p: ^jmt$results_keys,                                                               
      status_result_size: ost$segment_length,                                                                 
      status_work_area_p: ^SEQ ( * );                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    number_of_outputs_found := 0;                                                                             
    privileged_job := avp$system_administrator ();                                                            
    IF NOT privileged_job THEN                                                                                
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'system_administration', status);                    
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    candidate_name.kind := jmc$system_supplied_name;                                                          
    candidate_name.system_supplied_name := system_file_name;                                                  
    jmp$validate_name (candidate_name, good_name, status);                                                    
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    PUSH output_status_options_p: [1 .. 2];                                                                   
    output_status_options_p^ [1].key := jmc$name_list;                                                        
    PUSH output_status_options_p^ [1].name_list: [1 .. 1];                                                    
    output_status_options_p^ [1].name_list^ [1] := good_name;                                                 
    output_status_options_p^ [2].key := jmc$privilege;                                                        
    output_status_options_p^ [2].privilege := jmc$privileged;                                                 
                                                                                                              
    PUSH status_results_keys_p: [1 .. 2];                                                                     
    status_results_keys_p^ [1] := jmc$system_file_name;                                                       
    status_results_keys_p^ [2] := jmc$output_destination_usage;                                               
                                                                                                              
    jmp$get_result_size ({number_of_items} 1, #SEQ (status_results_keys_p^), status_result_size);             
    PUSH status_work_area_p: [[REP status_result_size OF cell]];                                              
    RESET status_work_area_p;                                                                                 
                                                                                                              
    jmp$get_output_status (output_status_options_p, status_results_keys_p, status_work_area_p,                
          output_status_results_p, number_of_outputs_found, status);                                          
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$no_outputs_were_found THEN                                                    
        osp$set_status_abnormal ('JM', jme$name_not_found, system_file_name, status);                         
      IFEND;                                                                                                  
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Determine the output's file path.                                                                           
                                                                                                              
    determine_file_path (output_status_results_p^ [1]^ [2].output_destination_usage,                          
          output_status_results_p^ [1]^ [1].system_file_name, local_path_p);                                  
    path := local_path_p^;                                                                                    
                                                                                                              
  PROCEND jmp$get_output_path_elements;                                                                       
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$get_output_status', EJECT ??                                                
*copy jmh$get_output_status                                                                                   
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$get_output_status                                                               
    (    output_status_options_p: ^jmt$output_status_options;                                                 
         output_status_results_keys_p: ^jmt$results_keys;                                                     
     VAR work_area_p: ^jmt$work_area;                                                                         
     VAR output_status_results_p: ^jmt$output_status_results;                                                 
     VAR number_of_outputs_found: jmt$output_status_count;                                                    
     VAR status: ost$status);                                                                                 
                                                                                                              
    CONST                                                                                                     
      bytes_that_can_be_pushed = 32767;                                                                       
                                                                                                              
    VAR                                                                                                       
      caller_id: ost$caller_identifier,                                                                       
      caller_privileged: boolean,                                                                             
      continue_request_to_servers: boolean,                                                                   
      good_name: jmt$name,                                                                                    
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_parameters_p: ^mainframe_getos_parameters,                                                        
      local_status: ost$status,                                                                               
      local_status_name_count_p: ^ost$non_negative_integers,                                                  
      local_status_options_p: ^jmt$output_status_options,                                                     
      local_status_results_keys_p: ^jmt$results_keys,                                                         
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      name_index: integer,                                                                                    
      number_of_data_packets: ost$non_negative_integers,                                                      
      option_index: integer,                                                                                  
      options_p: ^SEQ ( * ),                                                                                  
      options_size: ost$non_negative_integers,                                                                
      output_index: integer,                                                                                  
      privileged_job: boolean,                                                                                
      result_index: integer,                                                                                  
      save_work_area_p: ^jmt$work_area,                                                                       
      scl_name: ost$name,                                                                                     
      seq_output_status_results_size: ost$segment_length,                                                     
      specified_keys: jmt$attribute_keys_set,                                                                 
      target_mainframe_id: pmt$mainframe_id,                                                                  
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * ),                                                                           
      user_identification: ost$user_identification,                                                           
      valid_name: boolean;                                                                                    
                                                                                                              
                                                                                                              
    #CALLER_ID (caller_id);                                                                                   
    status.normal := TRUE;                                                                                    
    number_of_outputs_found := 0;                                                                             
    continue_request_to_servers := FALSE;                                                                     
    jm_work_area_p := NIL;                                                                                    
                                                                                                              
    IF work_area_p <> NIL THEN                                                                                
      IF (jmv$job_management_work_area_p = NIL) AND (#SIZE (work_area_p^) <= bytes_that_can_be_pushed) THEN   
        PUSH jm_work_area_p: [[REP #SIZE (work_area_p^) OF cell]];                                            
      ELSE                                                                                                    
        jmp$get_jm_work_area (jm_work_area_p, status);                                                        
        IF NOT status.normal THEN                                                                             
          RETURN;                                                                                             
        IFEND;                                                                                                
      IFEND;                                                                                                  
    IFEND;                                                                                                    
    PUSH target_options_p: [[REP dfc$maximum_user_data_area OF cell]];                                        
                                                                                                              
    RESET target_options_p;                                                                                   
                                                                                                              
    NEXT local_parameters_p IN target_options_p;                                                              
                                                                                                              
    pmp$get_user_identification (local_parameters_p^.user_identification, status);                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    local_parameters_p^.privileged_job := avp$system_operator () OR avp$system_displays ();                   
                                                                                                              
    IF output_status_options_p = NIL THEN                                                                     
      local_parameters_p^.status_option_count := 0;                                                           
    ELSE                                                                                                      
      caller_privileged := osp$is_caller_system_privileged () AND (caller_id.ring <= osc$tsrv_ring);          
      jmp$validate_status_options (jmc$get_output_status, 'OUTPUT_STATUS_OPTIONS_P',                          
            #SEQ (output_status_options_p^), caller_privileged, local_parameters_p^.privileged_job,           
            local_parameters_p^.user_identification, continue_request_to_servers,                             
            local_parameters_p^.status_option_count, target_options_p, status);                               
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
    IFEND;                                                                                                    
                                                                                                              
{ Verify that result is only asking for valid fields                                                          
                                                                                                              
    IF output_status_results_keys_p = NIL THEN                                                                
      local_parameters_p^.status_results_count := 0;                                                          
      seq_output_status_results_size := 0;                                                                    
    ELSE                                                                                                      
      local_parameters_p^.status_results_count := UPPERBOUND (output_status_results_keys_p^);                 
      NEXT local_status_results_keys_p: [1 .. local_parameters_p^.status_results_count] IN target_options_p;  
                                                                                                              
      local_status_results_keys_p^ := output_status_results_keys_p^;                                          
                                                                                                              
      FOR result_index := 1 TO UPPERBOUND (local_status_results_keys_p^) DO                                   
        CASE local_status_results_keys_p^ [result_index] OF                                                   
        = jmc$client_mainframe_id, jmc$control_family, jmc$control_user, jmc$login_family, jmc$login_user,    
              jmc$null_attribute, jmc$output_deferred_by_operator, jmc$output_deferred_by_user,               
              jmc$output_destination_usage, jmc$output_state, jmc$system_file_name, jmc$system_job_name,      
              jmc$user_file_name, jmc$user_job_name =                                                         
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (local_status_results_keys_p^ [result_index], scl_name);                     
          osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter, scl_name, status);           
          osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_STATUS_RESULTS_KEYS_P',        
                status);                                                                                      
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$get_output_status, status);        
          RETURN;                                                                                             
        CASEND;                                                                                               
      FOREND;                                                                                                 
                                                                                                              
      jmp$get_data_packet_size (local_status_results_keys_p, seq_output_status_results_size, status);         
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
    IF continue_request_to_servers THEN                                                                       
      target_mainframe_id := pmc$null_mainframe_id;                                                           
    ELSE                                                                                                      
      pmp$get_mainframe_id (target_mainframe_id, {ignore} local_status);                                      
    IFEND;                                                                                                    
    mainframes_processed.count := 0;                                                                          
                                                                                                              
    options_size := i#current_sequence_position (target_options_p);                                           
    RESET target_options_p;                                                                                   
    NEXT options_p: [[REP options_size OF cell]] IN target_options_p;                                         
                                                                                                              
    jmp$general_purpose_cluster_rpc (target_mainframe_id, jmc$gpro_get_output_status,                         
          {data_packet_size} seq_output_status_results_size, mainframes_processed, options_p, jm_work_area_p, 
          target_mainframe_reached, mainframes_processed, number_of_data_packets, status);                    
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$work_area_too_small THEN                                                      
        number_of_outputs_found := number_of_data_packets;                                                    
      IFEND;                                                                                                  
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    number_of_outputs_found := number_of_data_packets;                                                        
    IF number_of_outputs_found = 0 THEN                                                                       
      osp$set_status_condition (jme$no_outputs_were_found, status);                                           
    ELSEIF (output_status_results_keys_p <> NIL) THEN                                                         
      RESET jm_work_area_p;                                                                                   
      save_work_area_p := work_area_p;                                                                        
      jmp$copy_seq_to_result_array (UPPERBOUND (output_status_results_keys_p^), number_of_outputs_found,      
            output_status_results_keys_p, jm_work_area_p, work_area_p, status);                               
      NEXT output_status_results_p: [1 .. number_of_outputs_found] IN save_work_area_p;                       
    IFEND;                                                                                                    
  PROCEND jmp$get_output_status;                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$log_restored_output', EJECT ??                                              
*copy jmh$log_restored_output                                                                                 
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$log_restored_output                                                             
    (    system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      candidate_name: jmt$name,                                                                               
      cycle_selector: pft$cycle_selector,                                                                     
      date_time: ost$date_time,                                                                               
      good_name: jmt$name,                                                                                    
      ignore_status: ost$status,                                                                              
      local_file: boolean,                                                                                    
      local_file_name: amt$local_file_name,                                                                   
      name_index: integer,                                                                                    
      operator_restore: ost$name,                                                                             
      output_label: jmt$output_system_label,                                                                  
      password: pft$password,                                                                                 
      path: jmt$queue_file_path,                                                                              
      result_index: integer,                                                                                  
      scl_name: ost$name,                                                                                     
      share_selections: pft$share_selections,                                                                 
      specified_keys: jmt$attribute_keys_set,                                                                 
      usage_selections: pft$usage_selections,                                                                 
      valid_name: boolean;                                                                                    
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    ignore_status.normal := TRUE;                                                                             
                                                                                                              
    IF NOT (avp$system_administrator () OR avp$system_operator ()) THEN                                       
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'system_administration OR system_operation', status);
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Check for active job history statistic logging.                                                             
                                                                                                              
    IF NOT jmv$job_history_active THEN                                                                        
      osp$set_status_condition (jme$jh_job_history_not_active, status);                                       
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    candidate_name.kind := jmc$system_supplied_name;                                                          
    candidate_name.system_supplied_name := system_file_name;                                                  
    jmp$validate_name (candidate_name, good_name, status);                                                    
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    jmp$get_output_path_elements (good_name.system_supplied_name, path, status);                              
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Attach the file so we can read the system label.                                                            
                                                                                                              
    pmp$get_unique_name (local_file_name, ignore_status);                                                     
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
    usage_selections := $pft$usage_selections [pfc$read];                                                     
                                                                                                              
    osp$establish_block_exit_hndlr (^handle_block_exit);                                                      
    pfp$begin_system_authority;                                                                               
    pfp$attach (local_file_name, path, cycle_selector, password, usage_selections, usage_selections, pfc$wait,
          status);                                                                                            
    IF NOT status.normal THEN                                                                                 
      pfp$purge (path, cycle_selector, password, ignore_status);                                              
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Read the output file's system label.                                                                        
                                                                                                              
    qfp$read_output_system_label (local_file_name, output_label, status);                                     
    amp$return (local_file_name, ignore_status);                                                              
                                                                                                              
    IF NOT status.normal THEN                                                                                 
      pfp$purge (path, cycle_selector, password, ignore_status);                                              
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    pfp$end_system_authority;                                                                                 
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
    operator_restore := osc$null_name;                                                                        
    osp$get_status_condition_name (jme$operator_queue_restore, operator_restore, ignore_status);              
                                                                                                              
    jmp$emit_job_history_statistics (jml$output_queuing_started, osc$null_name, output_label.system_job_name, 
          output_label.system_file_name, NIL, ^output_label, operator_restore, jmc$blank_system_supplied_name,
          status);                                                                                            
                                                                                                              
  PROCEND jmp$log_restored_output;                                                                            
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$mainframe_change_output_att', EJECT ??                                      
*copy jmh$mainframe_change_output_att                                                                         
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$mainframe_change_output_att                                                     
    (    target_options_p: ^SEQ ( * );                                                                        
     VAR data_area_p: {input, output} ^SEQ ( * );                                                             
     VAR number_of_data_packets: ost$non_negative_integers;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      application_gtid: ost$global_task_id,                                                                   
      change_index: integer,                                                                                  
      changed_output_controller: boolean,                                                                     
      cycle_selector: pft$cycle_selector,                                                                     
      current_date_time: ost$date_time,                                                                       
      current_microsecond_clock: jmt$clock_time,                                                              
      date_time: ost$date_time,                                                                               
      delete_output_file: boolean,                                                                            
      earliest_clock_time_to_print: jmt$clock_time,                                                           
      ignore_status: ost$status,                                                                              
      latest_clock_time_to_print: jmt$clock_time,                                                             
      local_file_name: amt$local_file_name,                                                                   
      local_attribute_changes_p: ^jmt$output_attribute_changes,                                               
      local_parameters_p: ^mainframe_chaoa_parameters,                                                        
      local_purge_delay_p: ^jmt$time_increment,                                                               
      local_remote_host_directive_p: ^jmt$remote_host_directive,                                              
      local_site_information_p: ^jmt$site_information,                                                        
      local_user_information_p: ^jmt$user_information,                                                        
      new_path_p: ^pft$path,                                                                                  
      notify_application: boolean,                                                                            
      number_of_outputs_found: jmt$output_status_count,                                                       
      old_destination_usage: jmt$destination_usage,                                                           
      options_p: ^SEQ ( * ),                                                                                  
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      privileged_job: boolean,                                                                                
      purge_delay_clock_time: jmt$clock_time,                                                                 
      reprint_disposition: jmt$reprint_disposition,                                                           
      scl_name: ost$name,                                                                                     
      scratch_segment: amt$segment_pointer,                                                                   
      share_selections: pft$share_selections,                                                                 
      system_label: jmt$output_system_label,                                                                  
      usage_selections: pft$usage_selections,                                                                 
      valid_name: boolean;                                                                                    
                                                                                                              
?? NEWTITLE := 'condition_handler', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit and interactive                                  
{   conditions that arise from the attempt to attach a file in the input queue.                               
{   If the file is busy, the attach processor goes into long term wait without                                
{   establishing a condition handler for interactive conditions - so it does                                  
{   not exit.  When pfp$attach gets changed to work correctly, this handler                                   
{   will no longer need to handle interactive conditions.                                                     
                                                                                                              
    PROCEDURE condition_handler                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      CASE condition.selector OF                                                                              
      = pmc$block_exit_processing =                                                                           
        pfp$end_system_authority;                                                                             
        IF status.normal THEN                                                                                 
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
        IFEND;                                                                                                
                                                                                                              
      = ifc$interactive_condition =                                                                           
        IF condition.interactive_condition = ifc$pause_break THEN                                             
          ifp$invoke_pause_utility (handler_status);                                                          
        ELSE                                                                                                  
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
          pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                             
          EXIT jmp$mainframe_change_output_att;                                                               
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                               
      CASEND;                                                                                                 
    PROCEND condition_handler;                                                                                
                                                                                                              
?? OLDTITLE ??                                                                                                
*if false                                                                                                     
?? NEWTITLE := 'move_file_to_another_queue', EJECT ??                                                         
                                                                                                              
{ PURPOSE:                                                                                                    
{   This procedure will move a file from one physical output queue catalog to another one.                    
{                                                                                                             
{ DESIGN:                                                                                                     
{   Copy the file from the source catalog to the destination catalog.  Write the label to                     
{ the destination file.  Write a damaged label to the source file.  Purge the source file.                    
{                                                                                                             
{ Writing the labels to the files are memory operations - NOT I/O operations.  This reduces                   
{ the likelyhood of failure.  It would be fatal to NOS/VE if a queue file with the same system                
{ supplied name was recovered twice on the same mainframe.   The damaged label is written to                  
{ insure that this won't happen.                                                                              
{                                                                                                             
{ NOTES:                                                                                                      
{   Currently, this procedure is not used.                                                                    
{                                                                                                             
{   There is a window if the system fails and the label for the destination file has been flushed             
{ to the catalog yet the label for the source file has not been updated or flushed to disk.                   
                                                                                                              
    PROCEDURE move_file_to_another_queue                                                                      
      (    source_path_p: ^pft$path,                                                                          
           destination_path_p: ^pft$path;                                                                     
           system_label: jmt$output_system_label;                                                             
       VAR source_file_name: amt$local_file_name;                                                             
       VAR status: ost$status);                                                                               
                                                                                                              
      CONST                                                                                                   
        unit_separator = $CHAR (1f(16)),                                                                      
        damaged = 'Damaged_Label';                                                                            
                                                                                                              
      VAR                                                                                                     
        cycle_selector: pft$cycle_selector,                                                                   
        destination_file_name: amt$local_file_name,                                                           
        ignore_status: ost$status,                                                                            
        input_validation_attributes_p: ^fst$file_cycle_attributes,                                            
        local_system_label: jmt$output_system_label,                                                          
        null_file_access_procedure: pmt$entry_point_reference,                                                
        output_creation_attributes_p: ^fst$file_cycle_attributes,                                             
        password: pft$password;                                                                               
                                                                                                              
      status.normal := TRUE;                                                                                  
      local_system_label := system_label;                                                                     
                                                                                                              
      password := osc$null_name;                                                                              
      destination_file_name := system_label.system_file_name;                                                 
      osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                                
      pfp$begin_system_authority;                                                                             
      pfp$define (destination_file_name, destination_path_p^, cycle_selector, password, pfc$maximum_retention,
            pfc$log, status);                                                                                 
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
{ Make the appropriate copy - to t-record if the file is coded - raw copy if the file is transparent.         
                                                                                                              
      null_file_access_procedure.entry_point := osc$null_name;                                                
      null_file_access_procedure.object_library := '';                                                        
      PUSH input_validation_attributes_p: [1 .. 1];                                                           
      input_validation_attributes_p^ [1].selector := fsc$file_access_procedure_name;                          
      input_validation_attributes_p^ [1].file_access_procedure_name := ^null_file_access_procedure;           
                                                                                                              
      IF system_label.data_mode = jmc$coded_data THEN                                                         
        PUSH output_creation_attributes_p: [1 .. 6];                                                          
        output_creation_attributes_p^ [2].selector := fsc$file_contents_and_processor;                        
        output_creation_attributes_p^ [2].file_contents := fsc$list;                                          
        output_creation_attributes_p^ [2].file_processor := fsc$unknown_processor;                            
        output_creation_attributes_p^ [3].selector := fsc$block_type;                                         
        output_creation_attributes_p^ [3].block_type := amc$system_specified;                                 
        output_creation_attributes_p^ [4].selector := fsc$record_delimiting_character;                        
        output_creation_attributes_p^ [4].record_delimiting_character := unit_separator;                      
        output_creation_attributes_p^ [5].selector := fsc$record_type;                                        
        output_creation_attributes_p^ [5].record_type := amc$trailing_char_delimited;                         
        output_creation_attributes_p^ [6].selector := fsc$file_organization;                                  
        output_creation_attributes_p^ [6].file_organization := amc$sequential;                                
                                                                                                              
      ELSE { transparent data }                                                                               
        PUSH output_creation_attributes_p: [1 .. 1];                                                          
      IFEND;                                                                                                  
      output_creation_attributes_p^ [1].selector := fsc$ring_attributes;                                      
      output_creation_attributes_p^ [1].ring_attributes.r1 := osc$tsrv_ring;                                  
      output_creation_attributes_p^ [1].ring_attributes.r2 := osc$tsrv_ring;                                  
      output_creation_attributes_p^ [1].ring_attributes.r3 := osc$tsrv_ring;                                  
                                                                                                              
      fsp$copy_file (source_file_name, destination_file_name, input_validation_attributes_p, NIL,             
            output_creation_attributes_p, status);                                                            
      IF NOT status.normal THEN                                                                               
        amp$return (destination_file_name, ignore_status);                                                    
        osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                              
        pfp$begin_system_authority;                                                                           
        pfp$purge (destination_path_p^, cycle_selector, password, ignore_status);                             
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
{ Write the label in the file that was just created.                                                          
                                                                                                              
      qfp$write_output_system_label (destination_file_name, {  write_label } TRUE, local_system_label,        
            status);                                                                                          
      IF NOT status.normal THEN                                                                               
        amp$return (destination_file_name, ignore_status);                                                    
        osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                              
        pfp$begin_system_authority;                                                                           
        pfp$purge (destination_path_p^, cycle_selector, password, ignore_status);                             
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
      amp$return (destination_file_name, status);                                                             
      IF NOT status.normal THEN                                                                               
        osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                              
        pfp$begin_system_authority;                                                                           
        pfp$purge (destination_path_p^, cycle_selector, password, ignore_status);                             
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
      source_file_name := destination_file_name;                                                              
                                                                                                              
{ Damage the original file and then purge it.                                                                 
                                                                                                              
      local_system_label.version := damaged;                                                                  
      qfp$write_output_system_label (source_file_name, { write_label } TRUE, local_system_label,              
            ignore_status);                                                                                   
      osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                                
      pfp$begin_system_authority;                                                                             
      pfp$purge (source_path_p^, cycle_selector, password, status);                                           
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
    PROCEND move_file_to_another_queue;                                                                       
                                                                                                              
?? OLDTITLE ??                                                                                                
*ifend                                                                                                        
?? EJECT ??                                                                                                   
                                                                                                              
{ BEGIN: jmp$mainframe_change_output_att                                                                      
                                                                                                              
    ignore_status.normal := TRUE;                                                                             
    status.normal := TRUE;                                                                                    
    number_of_data_packets := 0;                                                                              
                                                                                                              
    pmp$get_compact_date_time (current_date_time, ignore_status);                                             
    changed_output_controller := FALSE;                                                                       
                                                                                                              
    options_p := target_options_p;                                                                            
    RESET options_p;                                                                                          
    NEXT local_parameters_p IN options_p;                                                                     
                                                                                                              
{ Attach the file so we can read the system label and get the attributes                                      
                                                                                                              
    pmp$get_unique_name (local_file_name, status);                                                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    determine_file_path (local_parameters_p^.output_destination_usage, local_parameters_p^.system_file_name,  
          path_p);                                                                                            
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
    usage_selections := $pft$usage_selections [pfc$read, pfc$modify];                                         
    share_selections := $pft$share_selections [pfc$read];                                                     
                                                                                                              
{ Prepare in case the file is busy and the attach goes into long-term-wait.                                   
                                                                                                              
    osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                                  
                                                                                                              
    pfp$begin_system_authority;                                                                               
    pfp$attach (local_file_name, path_p^, cycle_selector, password, usage_selections, share_selections,       
          pfc$wait, status);                                                                                  
    pfp$end_system_authority;                                                                                 
    osp$disestablish_cond_handler;                                                                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Read the output file's system label                                                                         
                                                                                                              
    qfp$read_output_system_label (local_file_name, system_label, status);                                     
    IF NOT status.normal THEN                                                                                 
      amp$return (local_file_name, ignore_status);                                                            
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Save the destination usage of the file.                                                                     
                                                                                                              
    old_destination_usage := system_label.output_destination_usage;                                           
    reprint_disposition := jmc$rd_no_change;                                                                  
                                                                                                              
{ Check attribute changes and change the local copy of the system label                                       
                                                                                                              
    IF local_parameters_p^.attribute_change_count > 0 THEN                                                    
                                                                                                              
      NEXT local_attribute_changes_p: [1 .. local_parameters_p^.attribute_change_count] IN options_p;         
                                                                                                              
    /process_changes/                                                                                         
      FOR change_index := 1 TO local_parameters_p^.attribute_change_count DO                                  
        CASE local_attribute_changes_p^ [change_index].key OF                                                 
        = jmc$comment_banner =                                                                                
          system_label.comment_banner := local_attribute_changes_p^ [change_index].comment_banner;            
                                                                                                              
        = jmc$copies =                                                                                        
          system_label.copy_count := local_attribute_changes_p^ [change_index].copies;                        
                                                                                                              
        = jmc$device =                                                                                        
          system_label.device := local_attribute_changes_p^ [change_index].device;                            
                                                                                                              
        = jmc$earliest_print_time =                                                                           
          system_label.earliest_print_time := local_attribute_changes_p^ [change_index].earliest_print_time;  
                                                                                                              
        = jmc$external_characteristics =                                                                      
          system_label.external_characteristics := local_attribute_changes_p^ [change_index].                 
                external_characteristics;                                                                     
                                                                                                              
        = jmc$forms_code =                                                                                    
          system_label.forms_code := local_attribute_changes_p^ [change_index].forms_code;                    
                                                                                                              
        = jmc$latest_print_time =                                                                             
          system_label.latest_print_time := local_attribute_changes_p^ [change_index].latest_print_time;      
                                                                                                              
        = jmc$null_attribute =                                                                                
          ;                                                                                                   
                                                                                                              
        = jmc$output_class =                                                                                  
          system_label.output_class := local_attribute_changes_p^ [change_index].output_class;                
                                                                                                              
        = jmc$output_deferred_by_operator =                                                                   
          system_label.output_deferred_by_operator := local_attribute_changes_p^ [change_index].              
                output_deferred_by_operator;                                                                  
                                                                                                              
        = jmc$output_deferred_by_user =                                                                       
          system_label.output_deferred_by_user := local_attribute_changes_p^ [change_index].                  
                output_deferred_by_user;                                                                      
                                                                                                              
        = jmc$output_destination =                                                                            
          system_label.output_destination := local_attribute_changes_p^ [change_index].output_destination;    
          changed_output_controller := TRUE;                                                                  
                                                                                                              
        = jmc$output_destination_family =                                                                     
          system_label.output_destination_family := local_attribute_changes_p^ [change_index].                
                output_destination_family;                                                                    
          changed_output_controller := TRUE;                                                                  
                                                                                                              
        = jmc$output_destination_usage =                                                                      
          system_label.output_destination_usage := local_attribute_changes_p^ [change_index].                 
                output_destination_usage;                                                                     
                                                                                                              
{ If the file's data mode was transparent - don't allow remote host to get the file.                          
                                                                                                              
          IF (system_label.data_mode = jmc$transparent_data) AND                                              
                (system_label.output_destination_usage = jmc$dual_state_usage) THEN                           
            osp$set_status_condition (jme$invalid_data_mode, status);                                         
            EXIT /process_changes/;                                                                           
          IFEND;                                                                                              
          changed_output_controller := TRUE;                                                                  
                                                                                                              
        = jmc$output_priority =                                                                               
          system_label.output_priority := local_attribute_changes_p^ [change_index].output_priority;          
                                                                                                              
        = jmc$purge_delay =                                                                                   
                                                                                                              
{ If the purge delay has changed, the output disposition time has changed.                                    
                                                                                                              
          NEXT local_purge_delay_p IN options_p;                                                              
          system_label.output_disposition_time.date_time := current_date_time;                                
          system_label.purge_delay := local_purge_delay_p^;                                                   
                                                                                                              
        = jmc$remote_host_directive =                                                                         
          NEXT local_remote_host_directive_p IN options_p;                                                    
          system_label.remote_host_directive := local_remote_host_directive_p^;                               
                                                                                                              
        = jmc$reprint_disposition =                                                                           
          reprint_disposition := local_attribute_changes_p^ [change_index].reprint_disposition;               
                                                                                                              
        = jmc$routing_banner =                                                                                
          system_label.routing_banner := local_attribute_changes_p^ [change_index].routing_banner;            
                                                                                                              
        = jmc$site_information =                                                                              
          NEXT local_site_information_p IN options_p;                                                         
          system_label.site_information := local_site_information_p^;                                         
                                                                                                              
        = jmc$station =                                                                                       
          system_label.station := local_attribute_changes_p^ [change_index].station;                          
                                                                                                              
        = jmc$station_operator =                                                                              
          system_label.station_operator := local_attribute_changes_p^ [change_index].station_operator;        
          changed_output_controller := TRUE;                                                                  
                                                                                                              
        = jmc$user_information =                                                                              
          NEXT local_user_information_p IN options_p;                                                         
          system_label.user_information := local_user_information_p^;                                         
                                                                                                              
        = jmc$vertical_print_density =                                                                        
          system_label.vertical_print_density := local_attribute_changes_p^ [change_index].                   
                vertical_print_density;                                                                       
                                                                                                              
        = jmc$vfu_load_procedure =                                                                            
          system_label.vfu_load_procedure := local_attribute_changes_p^ [change_index].vfu_load_procedure;    
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (local_attribute_changes_p^ [change_index].key, scl_name);                   
          osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter, scl_name, status);           
          osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_ATTRIBUTE_CHANGES', status);   
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$change_output_attributes, status); 
          EXIT /process_changes/;                                                                             
        CASEND;                                                                                               
      FOREND /process_changes/;                                                                               
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
{ React to special change requirements                                                                        
                                                                                                              
      IF changed_output_controller THEN                                                                       
        IF (system_label.output_destination_usage = jmc$private_usage) OR                                     
              (system_label.output_destination_usage = jmc$ntf_usage) THEN                                    
          system_label.output_controller.user := system_label.station_operator;                               
          system_label.output_controller.family := system_label.output_destination_family;                    
        ELSE                                                                                                  
          changed_output_controller := FALSE;                                                                 
        IFEND;                                                                                                
      IFEND;                                                                                                  
                                                                                                              
{ Check to see if the destination usage has changed                                                           
                                                                                                              
      IF old_destination_usage <> system_label.output_destination_usage THEN                                  
        determine_file_path (system_label.output_destination_usage, system_label.system_file_name,            
              new_path_p);                                                                                    
        IF new_path_p^ [3] <> path_p^ [3] THEN                                                                
                                                                                                              
{ If the file requires a different path as a result of the change in the destination usage it must be moved.  
                                                                                                              
{ For now.. Don't allow it to happen - if a store and forward queue is required, allow it then.               
                                                                                                              
          jmp$get_attribute_name (jmc$output_destination_usage, scl_name);                                    
          osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter_value, scl_name, status);     
          osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_ATTRIBUTE_CHANGES', status);   
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$change_output_attributes, status); 
        IFEND;                                                                                                
      IFEND;                                                                                                  
                                                                                                              
{ Calculate the earliest_print_time, latest_print_time and purge_delay if necessary.                          
                                                                                                              
      pmp$get_microsecond_clock (current_microsecond_clock, ignore_status);                                   
                                                                                                              
      IF system_label.earliest_print_time.specified THEN                                                      
        jmp$convert_date_time_dif_to_us (current_date_time, system_label.earliest_print_time.date_time,       
              current_microsecond_clock, earliest_clock_time_to_print);                                       
      ELSE                                                                                                    
        earliest_clock_time_to_print := jmc$earliest_clock_time;                                              
      IFEND;                                                                                                  
                                                                                                              
      IF system_label.latest_print_time.specified THEN                                                        
        jmp$convert_date_time_dif_to_us (current_date_time, system_label.latest_print_time.date_time,         
              current_microsecond_clock, latest_clock_time_to_print);                                         
      ELSE                                                                                                    
        latest_clock_time_to_print := jmc$latest_clock_time;                                                  
      IFEND;                                                                                                  
                                                                                                              
{ If the file has been printed (i.e. disposition time is available) and a purge delay has been supplied then  
{ calculate the free-running clock value at which the file can be purged.                                     
{ At this point the output disposition time is the current time .. so the net result                          
{ is that no matter what time the file was printed, it will be purged according to the purge delay            
{ supplied.  If the purge_delay has not changed, the output disposition time will be the previous output      
{ disposition time.  This value is typically the time at which the file was printed.                          
                                                                                                              
      IF system_label.purge_delay.specified AND system_label.output_disposition_time.specified THEN           
        pmp$compute_date_time (system_label.output_disposition_time.date_time,                                
              system_label.purge_delay.time_increment, date_time, status);                                    
        IF NOT status.normal THEN                                                                             
          amp$return (local_file_name, ignore_status);                                                        
          RETURN;                                                                                             
        IFEND;                                                                                                
        jmp$convert_date_time_dif_to_us (current_date_time, date_time, current_microsecond_clock,             
              purge_delay_clock_time);                                                                        
      ELSE                                                                                                    
        purge_delay_clock_time := jmc$earliest_clock_time;                                                    
      IFEND;                                                                                                  
                                                                                                              
      IF system_label.output_disposition_time.specified AND (reprint_disposition = jmc$rd_reprint_file) THEN  
        IF latest_clock_time_to_print <= current_microsecond_clock THEN                                       
          osp$set_status_abnormal (jmc$job_management_id, jme$latest_print_time_expired, '', status);         
          amp$return (local_file_name, ignore_status);                                                        
          RETURN;                                                                                             
        ELSE                                                                                                  
          system_label.output_disposition_time.specified := FALSE;                                            
        IFEND;                                                                                                
      IFEND;                                                                                                  
                                                                                                              
{ If request was not made by an operator then change the output submission time.                              
                                                                                                              
      IF NOT local_parameters_p^.privileged_job THEN                                                          
        system_label.output_submission_time := current_date_time;                                             
      IFEND;                                                                                                  
                                                                                                              
{ Update the Known Output List                                                                                
                                                                                                              
      qfp$change_output_attributes (system_label, earliest_clock_time_to_print, latest_clock_time_to_print,   
            purge_delay_clock_time, current_microsecond_clock, reprint_disposition, notify_application,       
            application_gtid, delete_output_file, status);                                                    
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
      IF jmv$job_history_active THEN                                                                          
        jmp$emit_job_history_statistics (jml$change_output_attributes, osc$null_name,                         
              system_label.system_job_name, system_label.system_file_name, NIL, ^system_label, osc$null_name, 
              jmc$blank_system_supplied_name, ignore_status);                                                 
      IFEND;                                                                                                  
                                                                                                              
      IF delete_output_file THEN                                                                              
                                                                                                              
{ We only want control on block exit - not for interactive so only establish the                              
{ condition handler for block exit.                                                                           
                                                                                                              
        osp$establish_block_exit_hndlr (^condition_handler);                                                  
        pfp$begin_system_authority;                                                                           
        pfp$purge (path_p^, cycle_selector, password, status);                                                
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
{ Write the result system label to the output file                                                            
                                                                                                              
      qfp$write_output_system_label (local_file_name, { write_label } TRUE, system_label, status);            
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN;                                                                                               
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
{ Release the file in case somebody needs it                                                                  
                                                                                                              
    amp$return (local_file_name, status);                                                                     
    IF notify_application THEN                                                                                
      pmp$ready_task (application_gtid, ignore_status);                                                       
    IFEND;                                                                                                    
  PROCEND jmp$mainframe_change_output_att;                                                                    
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$mainframe_get_output_attrib', EJECT ??                                             
*copy jmh$mainframe_get_output_attrib                                                                         
                                                                                                              
  PROCEDURE [XDCL] jmp$mainframe_get_output_attrib                                                            
    (    target_options_p: ^SEQ ( * );                                                                        
     VAR data_area_p: {input, output} ^SEQ ( * );                                                             
     VAR number_of_data_packets: ost$non_negative_integers;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      boolean_p: ^boolean,                                                                                    
      contains_data: boolean,                                                                                 
      copies_p: ^jmt$output_copy_count,                                                                       
      current_date_time: ost$date_time,                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      data_mode_p: ^jmt$data_mode,                                                                            
      date_time: ost$date_time,                                                                               
      date_time_p: ^jmt$date_time,                                                                            
      device_type_p: ^jmt$output_device_type,                                                                 
      external_characteristics_p: ^jmt$external_characteristics,                                              
      file_attributes: ^amt$get_attributes,                                                                   
      file_position_p: ^jmt$output_file_position,                                                             
      file_size_p: ^jmt$output_file_size,                                                                     
      forms_code_p: ^jmt$forms_code,                                                                          
      ignore_status: ost$status,                                                                              
      local_file: boolean,                                                                                    
      local_file_name: amt$local_file_name,                                                                   
      local_parameters_p: ^mainframe_getoa_parameters,                                                        
      local_results_keys_p: ^jmt$results_keys,                                                                
      local_status_keys_p: ^jmt$results_keys,                                                                 
      local_status_name_count_p: ^ost$non_negative_integers,                                                  
      local_status_options_p: ^jmt$output_status_options,                                                     
      name_value_p: ^ost$name,                                                                                
      number_of_outputs_statused: jmt$output_count_range,                                                     
      old_file: boolean,                                                                                      
      options_seq_p: ^SEQ ( * ),                                                                              
      os_date_time_p: ^ost$date_time,                                                                         
      output_index: jmt$output_count_range,                                                                   
      output_state_p: ^jmt$output_state,                                                                      
      output_status_results_p: ^jmt$output_status_results,                                                    
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      remote_host_directive_p: ^jmt$remote_host_directive,                                                    
      result_index: ost$positive_integers,                                                                    
      scratch_segment: amt$segment_pointer,                                                                   
      share_selections: pft$share_selections,                                                                 
      site_information_p: ^jmt$site_information,                                                              
      status_option_index: ost$non_negative_integers,                                                         
      status_results_keys_p: ^jmt$results_keys,                                                               
      system_file_name_p: ^jmt$system_supplied_name,                                                          
      system_label: jmt$output_system_label,                                                                  
      time_increment_p: ^jmt$time_increment,                                                                  
      usage_selections: pft$usage_selections,                                                                 
      user_identification: ost$user_identification,                                                           
      user_information_p: ^jmt$user_information,                                                              
      vertical_print_density_p: ^jmt$vertical_print_density,                                                  
      work_area_full: boolean;                                                                                
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      mmp$delete_scratch_segment (scratch_segment, ignore_status);                                            
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
    options_seq_p := target_options_p;                                                                        
    RESET options_seq_p;                                                                                      
    NEXT local_parameters_p IN options_seq_p;                                                                 
                                                                                                              
{ By definition, the number of status options is non-zero.                                                    
                                                                                                              
    NEXT local_status_options_p: [1 .. local_parameters_p^.status_option_count] IN options_seq_p;             
    FOR status_option_index := 1 TO local_parameters_p^.status_option_count DO                                
      CASE local_status_options_p^ [status_option_index].key OF                                               
      = jmc$name_list =                                                                                       
        NEXT local_status_name_count_p IN options_seq_p;                                                      
        IF local_status_name_count_p^ = 0 THEN                                                                
          local_status_options_p^ [status_option_index].name_list := NIL;                                     
        ELSE                                                                                                  
          NEXT local_status_options_p^ [status_option_index].name_list: [1 .. local_status_name_count_p^] IN  
                options_seq_p;                                                                                
        IFEND;                                                                                                
                                                                                                              
      = jmc$user_identification =                                                                             
        NEXT local_status_options_p^ [status_option_index].user_identification IN options_seq_p;              
                                                                                                              
      ELSE                                                                                                    
      CASEND;                                                                                                 
    FOREND;                                                                                                   
                                                                                                              
    IF local_parameters_p^.results_keys_count = 0 THEN                                                        
      local_results_keys_p := NIL;                                                                            
      local_status_keys_p := NIL;                                                                             
    ELSE                                                                                                      
      NEXT local_results_keys_p: [1 .. local_parameters_p^.results_keys_count] IN options_seq_p;              
      NEXT local_status_keys_p: [1 .. local_parameters_p^.results_keys_count] IN options_seq_p;               
    IFEND;                                                                                                    
                                                                                                              
    IF local_status_keys_p <> NIL THEN                                                                        
      PUSH status_results_keys_p: [1 .. local_parameters_p^.results_keys_count + 2];                          
      FOR result_index := 1 TO local_parameters_p^.results_keys_count DO                                      
        status_results_keys_p^ [result_index] := local_status_keys_p^ [result_index];                         
      FOREND;                                                                                                 
      status_results_keys_p^ [local_parameters_p^.results_keys_count + 1] := jmc$system_file_name;            
      status_results_keys_p^ [local_parameters_p^.results_keys_count + 2] := jmc$output_destination_usage;    
    ELSE                                                                                                      
      status_results_keys_p := NIL;                                                                           
    IFEND;                                                                                                    
                                                                                                              
    mmp$create_scratch_segment (amc$sequence_pointer, mmc$as_sequential, scratch_segment, status);            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    RESET scratch_segment.sequence_pointer;                                                                   
    jmp$get_output_status (local_status_options_p, status_results_keys_p, scratch_segment.sequence_pointer,   
          output_status_results_p, number_of_outputs_statused, status);                                       
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$no_outputs_were_found THEN                                                    
        number_of_outputs_statused := 0;                                                                      
        status.normal := TRUE;                                                                                
      ELSE                                                                                                    
        mmp$delete_scratch_segment (scratch_segment, ignore_status);                                          
        RETURN;                                                                                               
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
    number_of_data_packets := 0;                                                                              
    work_area_full := FALSE;                                                                                  
    IF local_results_keys_p <> NIL THEN                                                                       
                                                                                                              
    /fetch_attributes_for_files/                                                                              
      FOR output_index := 1 TO number_of_outputs_statused DO                                                  
                                                                                                              
{ Only attach the file if attributes are being requested that require us to do so.  The procedure             
{ jmp$get_output_attributes determines this once and passes the result to all mainframes.                     
                                                                                                              
        IF local_parameters_p^.attach_file THEN                                                               
                                                                                                              
{ Attach the file so we can read the system label and get the attributes                                      
                                                                                                              
          pmp$get_unique_name (local_file_name, { ignore } status);                                           
                                                                                                              
          determine_file_path (output_status_results_p^ [output_index]^                                       
                [local_parameters_p^.results_keys_count + 2].output_destination_usage,                        
                output_status_results_p^ [output_index]^ [local_parameters_p^.results_keys_count +            
                1].system_file_name, path_p);                                                                 
          cycle_selector.cycle_option := pfc$specific_cycle;                                                  
          cycle_selector.cycle_number := 1;                                                                   
          password := osc$null_name;                                                                          
          usage_selections := $pft$usage_selections [pfc$read];                                               
          share_selections := $pft$share_selections [pfc$read, pfc$modify];                                   
                                                                                                              
          osp$establish_block_exit_hndlr (^handle_block_exit);                                                
          pfp$begin_system_authority;                                                                         
          pfp$attach (local_file_name, path_p^, cycle_selector, password, usage_selections, share_selections, 
                pfc$wait, status);                                                                            
          pfp$end_system_authority;                                                                           
          osp$disestablish_cond_handler;                                                                      
          IF NOT status.normal THEN                                                                           
            status.normal := TRUE;                                                                            
            CYCLE /fetch_attributes_for_files/;                                                               
          IFEND;                                                                                              
                                                                                                              
{ Read the output file's system label                                                                         
                                                                                                              
          qfp$read_output_system_label (local_file_name, system_label, status);                               
          IF NOT status.normal THEN                                                                           
            amp$return (local_file_name, ignore_status);                                                      
            mmp$delete_scratch_segment (scratch_segment, ignore_status);                                      
            RETURN;                                                                                           
          IFEND;                                                                                              
                                                                                                              
{ Get the necessary file attributes for the output file                                                       
                                                                                                              
          PUSH file_attributes: [1 .. 1];                                                                     
          file_attributes^ [1].key := amc$file_length;                                                        
          amp$get_file_attributes (local_file_name, file_attributes^, local_file, old_file, contains_data,    
                status);                                                                                      
          IF NOT status.normal THEN                                                                           
            amp$return (local_file_name, ignore_status);                                                      
            mmp$delete_scratch_segment (scratch_segment, ignore_status);                                      
            RETURN;                                                                                           
          IFEND;                                                                                              
                                                                                                              
{ Release the file in case somebody needs it for write access                                                 
                                                                                                              
          amp$return (local_file_name, status);                                                               
        IFEND;                                                                                                
                                                                                                              
        number_of_data_packets := number_of_data_packets + 1;                                                 
                                                                                                              
        IF NOT work_area_full THEN                                                                            
                                                                                                              
        /fill_in_each_result_field/                                                                           
          FOR result_index := 1 TO local_parameters_p^.results_keys_count DO                                  
            CASE local_results_keys_p^ [result_index] OF                                                      
            = jmc$comment_banner =                                                                            
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.comment_banner;                                                   
                                                                                                              
            = jmc$control_family =                                                                            
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := output_status_results_p^ [output_index]^ [result_index].control_family;        
                                                                                                              
            = jmc$control_user =                                                                              
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := output_status_results_p^ [output_index]^ [result_index].control_user;          
                                                                                                              
            = jmc$copies =                                                                                    
              NEXT copies_p IN data_area_p;                                                                   
              IF copies_p = NIL THEN                                                                          
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              copies_p^ := system_label.copy_count;                                                           
                                                                                                              
            = jmc$copies_printed =                                                                            
              NEXT copies_p IN data_area_p;                                                                   
              IF copies_p = NIL THEN                                                                          
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              copies_p^ := system_label.copies_printed;                                                       
                                                                                                              
            = jmc$data_mode =                                                                                 
              NEXT data_mode_p IN data_area_p;                                                                
              IF data_mode_p = NIL THEN                                                                       
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              data_mode_p^ := system_label.data_mode;                                                         
                                                                                                              
            = jmc$device =                                                                                    
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.device;                                                           
                                                                                                              
            = jmc$device_type =                                                                               
              NEXT device_type_p IN data_area_p;                                                              
              IF device_type_p = NIL THEN                                                                     
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              device_type_p^ := system_label.device_type;                                                     
                                                                                                              
            = jmc$earliest_print_time =                                                                       
              NEXT date_time_p IN data_area_p;                                                                
              IF date_time_p = NIL THEN                                                                       
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              date_time_p^ := system_label.earliest_print_time;                                               
                                                                                                              
            = jmc$external_characteristics =                                                                  
              NEXT external_characteristics_p IN data_area_p;                                                 
              IF external_characteristics_p = NIL THEN                                                        
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              external_characteristics_p^ := system_label.external_characteristics;                           
                                                                                                              
            = jmc$file_position =                                                                             
              NEXT file_position_p IN data_area_p;                                                            
              IF file_position_p = NIL THEN                                                                   
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              file_position_p^ := system_label.file_position;                                                 
                                                                                                              
            = jmc$file_size =                                                                                 
              NEXT file_size_p IN data_area_p;                                                                
              IF file_size_p = NIL THEN                                                                       
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              file_size_p^ := file_attributes^ [1].file_length;                                               
                                                                                                              
            = jmc$forms_code =                                                                                
              NEXT forms_code_p IN data_area_p;                                                               
              IF forms_code_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              forms_code_p^ := system_label.forms_code;                                                       
                                                                                                              
            = jmc$latest_print_time =                                                                         
              NEXT date_time_p IN data_area_p;                                                                
              IF date_time_p = NIL THEN                                                                       
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              date_time_p^ := system_label.latest_print_time;                                                 
                                                                                                              
            = jmc$login_account =                                                                             
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.login_account;                                                    
                                                                                                              
            = jmc$login_family =                                                                              
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := output_status_results_p^ [output_index]^ [result_index].login_family;          
                                                                                                              
            = jmc$login_project =                                                                             
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.login_project;                                                    
                                                                                                              
            = jmc$login_user =                                                                                
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := output_status_results_p^ [output_index]^ [result_index].login_user;            
                                                                                                              
            = jmc$null_attribute =                                                                            
              ;                                                                                               
                                                                                                              
            = jmc$origin_application_name =                                                                   
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.originating_application_name;                                     
                                                                                                              
            = jmc$output_class =                                                                              
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.output_class;                                                     
                                                                                                              
            = jmc$output_deferred_by_operator =                                                               
              NEXT boolean_p IN data_area_p;                                                                  
              IF boolean_p = NIL THEN                                                                         
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              boolean_p^ := output_status_results_p^ [output_index]^ [result_index].                          
                    output_deferred_by_operator;                                                              
                                                                                                              
            = jmc$output_deferred_by_user =                                                                   
              NEXT boolean_p IN data_area_p;                                                                  
              IF boolean_p = NIL THEN                                                                         
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              boolean_p^ := output_status_results_p^ [output_index]^ [result_index].output_deferred_by_user;  
                                                                                                              
            = jmc$output_destination =                                                                        
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.output_destination;                                               
                                                                                                              
            = jmc$output_destination_family =                                                                 
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.output_destination_family;                                        
                                                                                                              
            = jmc$output_destination_usage =                                                                  
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := output_status_results_p^ [output_index]^ [result_index].                       
                    output_destination_usage;                                                                 
                                                                                                              
            = jmc$output_priority =                                                                           
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.output_priority;                                                  
                                                                                                              
            = jmc$output_state =                                                                              
              NEXT output_state_p IN data_area_p;                                                             
              IF output_state_p = NIL THEN                                                                    
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              output_state_p^ := output_status_results_p^ [output_index]^ [result_index].output_state;        
                                                                                                              
            = jmc$output_submission_time =                                                                    
              NEXT os_date_time_p IN data_area_p;                                                             
              IF os_date_time_p = NIL THEN                                                                    
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              os_date_time_p^ := system_label.output_submission_time;                                         
                                                                                                              
            = jmc$purge_delay =                                                                               
              NEXT time_increment_p IN data_area_p;                                                           
              IF time_increment_p = NIL THEN                                                                  
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              IF system_label.output_disposition_time.specified THEN                                          
                pmp$compute_date_time (system_label.output_disposition_time.date_time,                        
                      system_label.purge_delay.time_increment, date_time, ignore_status);                     
                pmp$get_compact_date_time (current_date_time, ignore_status);                                 
                pmp$compute_date_time_increment (current_date_time, date_time,                                
                      time_increment_p^.time_increment, ignore_status);                                       
                time_increment_p^.specified := TRUE;                                                          
              ELSE                                                                                            
                time_increment_p^ := system_label.purge_delay;                                                
              IFEND;                                                                                          
                                                                                                              
            = jmc$remote_host_directive =                                                                     
              NEXT remote_host_directive_p IN data_area_p;                                                    
              IF remote_host_directive_p = NIL THEN                                                           
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              remote_host_directive_p^ := system_label.remote_host_directive;                                 
                                                                                                              
            = jmc$routing_banner =                                                                            
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.routing_banner;                                                   
                                                                                                              
            = jmc$site_information =                                                                          
              NEXT site_information_p IN data_area_p;                                                         
              IF site_information_p = NIL THEN                                                                
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              site_information_p^ := system_label.site_information;                                           
                                                                                                              
            = jmc$station =                                                                                   
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.station;                                                          
                                                                                                              
            = jmc$station_operator =                                                                          
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.station_operator;                                                 
                                                                                                              
            = jmc$system_file_name =                                                                          
              NEXT system_file_name_p IN data_area_p;                                                         
              IF system_file_name_p = NIL THEN                                                                
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              system_file_name_p^ := output_status_results_p^ [output_index]^ [result_index].system_file_name;
                                                                                                              
            = jmc$system_job_name =                                                                           
              NEXT system_file_name_p IN data_area_p;                                                         
              IF system_file_name_p = NIL THEN                                                                
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              system_file_name_p^ := output_status_results_p^ [output_index]^ [result_index].system_job_name; 
                                                                                                              
            = jmc$user_file_name =                                                                            
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := output_status_results_p^ [output_index]^ [result_index].user_file_name;        
                                                                                                              
            = jmc$user_information =                                                                          
              NEXT user_information_p IN data_area_p;                                                         
              IF user_information_p = NIL THEN                                                                
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              user_information_p^ := system_label.user_information;                                           
                                                                                                              
            = jmc$user_job_name =                                                                             
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := output_status_results_p^ [output_index]^ [result_index].user_job_name;         
                                                                                                              
            = jmc$vertical_print_density =                                                                    
              NEXT vertical_print_density_p IN data_area_p;                                                   
              IF vertical_print_density_p = NIL THEN                                                          
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              vertical_print_density_p^ := system_label.vertical_print_density;                               
                                                                                                              
            = jmc$vfu_load_procedure =                                                                        
              NEXT name_value_p IN data_area_p;                                                               
              IF name_value_p = NIL THEN                                                                      
                work_area_full := TRUE;                                                                       
                EXIT /fill_in_each_result_field/;                                                             
              IFEND;                                                                                          
              name_value_p^ := system_label.vfu_load_procedure;                                               
                                                                                                              
            ELSE                                                                                              
              ;                                                                                               
            CASEND;                                                                                           
          FOREND /fill_in_each_result_field/;                                                                 
        IFEND;                                                                                                
      FOREND /fetch_attributes_for_files/;                                                                    
                                                                                                              
      IF work_area_full THEN                                                                                  
        osp$set_status_condition (jme$work_area_too_small, status);                                           
      IFEND;                                                                                                  
                                                                                                              
      mmp$delete_scratch_segment (scratch_segment, ignore_status);                                            
    IFEND;                                                                                                    
  PROCEND jmp$mainframe_get_output_attrib;                                                                    
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$mainframe_get_output_status', EJECT ??                                             
*copy jmh$mainframe_get_output_status                                                                         
                                                                                                              
  PROCEDURE [XDCL] jmp$mainframe_get_output_status                                                            
    (    target_options_p: ^SEQ ( * );                                                                        
     VAR data_area_p: {input, output} ^SEQ ( * );                                                             
     VAR number_of_data_packets: ost$non_negative_integers;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      local_parameters_p: ^mainframe_getos_parameters,                                                        
      local_status_name_count_p: ^ost$non_negative_integers,                                                  
      local_status_options_p: ^jmt$output_status_options,                                                     
      local_status_results_keys_p: ^jmt$results_keys,                                                         
      number_of_outputs_found: jmt$output_status_count,                                                       
      options_seq_p: ^SEQ ( * ),                                                                              
      status_option_index: ost$non_negative_integers;                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    options_seq_p := target_options_p;                                                                        
    RESET options_seq_p;                                                                                      
    NEXT local_parameters_p IN options_seq_p;                                                                 
                                                                                                              
    IF local_parameters_p^.status_option_count = 0 THEN                                                       
      local_status_options_p := NIL;                                                                          
    ELSE                                                                                                      
      NEXT local_status_options_p: [1 .. local_parameters_p^.status_option_count] IN options_seq_p;           
                                                                                                              
      FOR status_option_index := 1 TO local_parameters_p^.status_option_count DO                              
        IF local_status_options_p^ [status_option_index].key = jmc$name_list THEN                             
          NEXT local_status_name_count_p IN options_seq_p;                                                    
          IF local_status_name_count_p^ = 0 THEN                                                              
            local_status_options_p^ [status_option_index].name_list := NIL;                                   
          ELSE                                                                                                
            NEXT local_status_options_p^ [status_option_index].name_list: [1 .. local_status_name_count_p^] IN
                  options_seq_p;                                                                              
          IFEND;                                                                                              
        IFEND;                                                                                                
      FOREND;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    IF local_parameters_p^.status_results_count = 0 THEN                                                      
      local_status_results_keys_p := NIL;                                                                     
    ELSE                                                                                                      
      NEXT local_status_results_keys_p: [1 .. local_parameters_p^.status_results_count] IN options_seq_p;     
    IFEND;                                                                                                    
                                                                                                              
    qfp$get_output_status (local_parameters_p^.user_identification, local_parameters_p^.privileged_job,       
          local_status_options_p, local_status_results_keys_p, data_area_p, number_of_outputs_found, status); 
    number_of_data_packets := number_of_outputs_found;                                                        
  PROCEND jmp$mainframe_get_output_status;                                                                    
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$mainframe_terminate_output', EJECT ??                                              
*copy jmh$mainframe_terminate_output                                                                          
                                                                                                              
  PROCEDURE [XDCL] jmp$mainframe_terminate_output                                                             
    (    target_options_p: ^SEQ ( * );                                                                        
     VAR data_area_p: {input, output} ^SEQ ( * );                                                             
     VAR number_of_data_packets: ost$non_negative_integers;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      delete_output_file: boolean,                                                                            
      local_parameters_p: ^mainframe_tero_parameters,                                                         
      options_seq_p: ^SEQ ( * ),                                                                              
      output_destination_usage: jmt$destination_usage,                                                        
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      statistic_data: jmt$comm_acct_statistic_data,                                                           
      system_job_name: jmt$system_supplied_name;                                                              
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
    status.normal := TRUE;                                                                                    
    number_of_data_packets := 0;                                                                              
    options_seq_p := target_options_p;                                                                        
    RESET options_seq_p;                                                                                      
    NEXT local_parameters_p IN options_seq_p;                                                                 
                                                                                                              
    qfp$terminate_output (local_parameters_p^.system_file_name, local_parameters_p^.output_state_set,         
          system_job_name, output_destination_usage, delete_output_file, status);                             
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    IF delete_output_file THEN                                                                                
                                                                                                              
      IF jmv$job_history_active THEN                                                                          
        jmp$emit_job_history_statistics (jml$output_file_deleted, osc$null_name, system_job_name,             
              local_parameters_p^.system_file_name, NIL, NIL, local_parameters_p^.reason,                     
              jmc$blank_system_supplied_name, status);                                                        
      IFEND;                                                                                                  
                                                                                                              
      determine_file_path (output_destination_usage, local_parameters_p^.system_file_name, path_p);           
                                                                                                              
      statistic_data.statistic_id := jmc$ca_output_queue_residency;                                           
      PUSH statistic_data.output_queue_residency;                                                             
      statistic_data.output_queue_residency^.output_file_path := path_p;                                      
      jmp$emit_communication_stat (statistic_data);                                                           
                                                                                                              
      cycle_selector.cycle_option := pfc$specific_cycle;                                                      
      cycle_selector.cycle_number := 1;                                                                       
      password := osc$null_name;                                                                              
      osp$establish_block_exit_hndlr (^handle_block_exit);                                                    
      pfp$begin_system_authority;                                                                             
      pfp$purge (path_p^, cycle_selector, password, status);                                                  
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
    IFEND;                                                                                                    
  PROCEND jmp$mainframe_terminate_output;                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$modified_output_exists', EJECT ??                                           
*copy jmh$modified_output_exists                                                                              
                                                                                                              
  FUNCTION [XDCL, #GATE] jmp$modified_output_exists                                                           
    (    output_destination_usage: jmt$destination_usage): boolean;                                           
                                                                                                              
    VAR                                                                                                       
      application_index: jmt$output_application_index,                                                        
      output_exists: boolean;                                                                                 
                                                                                                              
    application_index := UPPERBOUND (jmv$known_output_list.application_table);                                
    WHILE (jmv$known_output_list.application_table [application_index].destination_usage <>                   
          output_destination_usage) AND (application_index <> jmc$unassigned_output_index) DO                 
      application_index := application_index - 1;                                                             
    WHILEND;                                                                                                  
                                                                                                              
    output_exists := (application_index <> jmc$unassigned_output_index) AND                                   
          (jmv$known_output_list.application_table [application_index].                                       
          state_data [jmc$kol_application_modified].number_of_entries > 0);                                   
    jmp$modified_output_exists := output_exists AND (NOT syp$system_is_idling ());                            
                                                                                                              
  FUNCEND jmp$modified_output_exists;                                                                         
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$new_output_exists', EJECT ??                                                
*copy jmh$new_output_exists                                                                                   
                                                                                                              
  FUNCTION [XDCL, #GATE] jmp$new_output_exists                                                                
    (    output_destination_usage: jmt$destination_usage): boolean;                                           
                                                                                                              
    VAR                                                                                                       
      application_index: jmt$output_application_index,                                                        
      output_exists: boolean;                                                                                 
                                                                                                              
    application_index := UPPERBOUND (jmv$known_output_list.application_table);                                
    WHILE (jmv$known_output_list.application_table [application_index].destination_usage <>                   
          output_destination_usage) AND (application_index <> jmc$unassigned_output_index) DO                 
      application_index := application_index - 1;                                                             
    WHILEND;                                                                                                  
                                                                                                              
    output_exists := (application_index <> jmc$unassigned_output_index) AND                                   
          (jmv$known_output_list.application_table [application_index].state_data [jmc$kol_application_new].  
          number_of_entries > 0);                                                                             
    jmp$new_output_exists := output_exists AND (NOT syp$system_is_idling ());                                 
                                                                                                              
  FUNCEND jmp$new_output_exists;                                                                              
                                                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$open_files_for_copof', EJECT ??                                             
*copy jmh$open_files_for_copof                                                                                
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$open_files_for_copof                                                            
    (    output_file_name: jmt$name;                                                                          
         target_file: fst$file_reference;                                                                     
     VAR control_info: fst$copy_control_information;                                                          
     VAR output_fid: amt$file_identifier;                                                                     
     VAR output_lfn: amt$local_file_name;                                                                     
     VAR target_fid: amt$file_identifier;                                                                     
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      attribute_override_p: ^fst$file_cycle_attributes,                                                       
      caller_id: ost$caller_identifier,                                                                       
      copof_capability: boolean,                                                                              
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      number_of_outputs_found: jmt$output_status_count,                                                       
      output_attachment_options_p: ^fst$attachment_options,                                                   
      output_file_user_id: ost$user_identification,                                                           
      output_local_file_name: amt$local_file_name,                                                            
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      result_size: ost$segment_length,                                                                        
      share_selections: pft$share_selections,                                                                 
      status_options_p: ^jmt$output_status_options,                                                           
      status_results_keys_p: ^jmt$results_keys,                                                               
      status_results_p: ^jmt$output_status_results,                                                           
      status_work_area_p: ^jmt$work_area,                                                                     
      target_attachment_options_p: ^fst$attachment_options,                                                   
      target_creation_attributes_p: ^fst$file_cycle_attributes,                                               
      usage_selections: pft$usage_selections,                                                                 
      user_identification: ost$user_identification;                                                           
                                                                                                              
?? NEWTITLE := 'condition_handler', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit and interactive                                  
{   conditions that arise from the attempt to attach a file in the input queue.                               
{   If the file is busy, the attach processor goes into long term wait without                                
{   establishing a condition handler for interactive conditions - so it does                                  
{   not exit.  When pfp$attach gets changed to work correctly, this handler                                   
{   will no longer need to handle interactive conditions.                                                     
                                                                                                              
    PROCEDURE condition_handler                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      CASE condition.selector OF                                                                              
      = pmc$block_exit_processing =                                                                           
        pfp$end_system_authority;                                                                             
        IF status.normal THEN                                                                                 
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
        IFEND;                                                                                                
                                                                                                              
      = ifc$interactive_condition =                                                                           
        IF condition.interactive_condition = ifc$pause_break THEN                                             
          ifp$invoke_pause_utility (handler_status);                                                          
        ELSE                                                                                                  
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
          pmp$continue_to_cause (pmc$execute_standard_procedure, ignore_status);                              
          EXIT jmp$open_files_for_copof;                                                                      
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                               
      CASEND;                                                                                                 
    PROCEND condition_handler;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    ignore_status.normal := TRUE;                                                                             
    output_fid := amv$nil_file_identifier;                                                                    
    target_fid := amv$nil_file_identifier;                                                                    
                                                                                                              
    pmp$get_unique_name (output_local_file_name, ignore_status);                                              
    output_lfn := output_local_file_name;                                                                     
                                                                                                              
    #CALLER_ID (caller_id);                                                                                   
                                                                                                              
{ Verify that the caller is part of NOS/VE, not an application.                                               
                                                                                                              
    osp$verify_system_privilege;                                                                              
                                                                                                              
{ Verify that the user has the copy_output_files validation capability.                                       
                                                                                                              
    avp$get_capability (avc$copy_output_files, avc$user, copof_capability, status);                           
    IF NOT status.normal THEN                                                                                 
      IF (status.condition = ave$unknown_field) OR (status.condition = ave$field_was_deleted) THEN            
        osp$set_status_condition (jme$not_validated_for_copof, status);                                       
      IFEND;                                                                                                  
      RETURN;                                                                                                 
    IFEND;                                                                                                    
    IF NOT copof_capability THEN                                                                              
      osp$set_status_condition (jme$not_validated_for_copof, status);                                         
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Process output_file_name parameter.  Validate the supplied name.                                            
                                                                                                              
    PUSH status_options_p: [1 .. 1];                                                                          
    status_options_p^ [1].key := jmc$name_list;                                                               
    status_options_p^ [1].name_list := NIL;                                                                   
    PUSH status_options_p^ [1].name_list: [1 .. 1];                                                           
    status_options_p^ [1].name_list^ [1] := output_file_name;                                                 
                                                                                                              
    PUSH status_results_keys_p: [1 .. 6];                                                                     
    status_results_keys_p^ [1] := jmc$system_file_name;                                                       
    status_results_keys_p^ [2] := jmc$output_destination_usage;                                               
    status_results_keys_p^ [3] := jmc$control_family;                                                         
    status_results_keys_p^ [4] := jmc$control_user;                                                           
    status_results_keys_p^ [5] := jmc$login_family;                                                           
    status_results_keys_p^ [6] := jmc$login_user;                                                             
                                                                                                              
    jmp$get_result_size ({number_of_items} 1, #SEQ (status_results_keys_p^), result_size);                    
    PUSH status_work_area_p: [[REP result_size OF cell]];                                                     
    RESET status_work_area_p;                                                                                 
    jmp$get_output_status (status_options_p, status_results_keys_p, status_work_area_p, status_results_p,     
          number_of_outputs_found, status);                                                                   
                                                                                                              
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$no_outputs_were_found THEN                                                    
        IF output_file_name.kind = jmc$system_supplied_name THEN                                              
          osp$set_status_abnormal ('JM', jme$name_not_found, output_file_name.system_supplied_name, status);  
        ELSE                                                                                                  
          osp$set_status_abnormal ('JM', jme$name_not_found, output_file_name.user_supplied_name, status);    
        IFEND;                                                                                                
      ELSE                                                                                                    
        IF status.condition = jme$work_area_too_small THEN                                                    
          IF output_file_name.kind = jmc$system_supplied_name THEN                                            
            osp$set_status_abnormal ('JM', jme$duplicate_name, output_file_name.system_supplied_name, status);
          ELSE                                                                                                
            osp$set_status_abnormal ('JM', jme$duplicate_name, output_file_name.user_supplied_name, status);  
          IFEND;                                                                                              
        IFEND;                                                                                                
      IFEND;                                                                                                  
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Verify that the calling user is the login or control user for the output file.                              
                                                                                                              
    pmp$get_user_identification (user_identification, status);                                                
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    IF NOT avp$system_operator () THEN                                                                        
      IF (user_identification.family <> status_results_p^ [1]^ [5].login_family) OR                           
            (user_identification.user <> status_results_p^ [1]^ [6].login_user) THEN                          
        IF (user_identification.family <> status_results_p^ [1]^ [3].control_family) OR                       
              (user_identification.user <> status_results_p^ [1]^ [4].control_user) THEN                      
          IF output_file_name.kind = jmc$system_supplied_name THEN                                            
            osp$set_status_abnormal ('JM', jme$name_not_found, output_file_name.system_supplied_name, status);
          ELSE                                                                                                
            osp$set_status_abnormal ('JM', jme$name_not_found, output_file_name.user_supplied_name, status);  
          IFEND;                                                                                              
          RETURN;                                                                                             
        IFEND;                                                                                                
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
{ Attach the output queue file.                                                                               
                                                                                                              
    determine_file_path (status_results_p^ [1]^ [2].output_destination_usage,                                 
          status_results_p^ [1]^ [1].system_file_name, path_p);                                               
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
    usage_selections := $pft$usage_selections [pfc$read];                                                     
    share_selections := $pft$share_selections [pfc$read, pfc$modify];                                         
                                                                                                              
    osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                                  
    pfp$begin_system_authority;                                                                               
    pfp$attach (output_local_file_name, path_p^, cycle_selector, password, usage_selections, share_selections,
          pfc$wait, status);                                                                                  
    pfp$end_system_authority;                                                                                 
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
    IF NOT status.normal THEN                                                                                 
      amp$return (output_local_file_name, ignore_status);                                                     
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Set up options for opening the output queue file.                                                           
                                                                                                              
    PUSH output_attachment_options_p: [1 .. 2];                                                               
    output_attachment_options_p^ [1].selector := fsc$access_and_share_modes;                                  
    output_attachment_options_p^ [1].access_modes.selector := fsc$specific_access_modes;                      
    output_attachment_options_p^ [1].access_modes.value := $fst$file_access_options [fsc$read];               
    output_attachment_options_p^ [1].share_modes.selector := fsc$specific_share_modes;                        
    output_attachment_options_p^ [1].share_modes.value := $fst$file_access_options [fsc$read, fsc$modify];    
    output_attachment_options_p^ [2].selector := fsc$open_share_modes;                                        
    output_attachment_options_p^ [2].open_share_modes := $fst$file_access_options [fsc$read, fsc$modify];     
                                                                                                              
{ Set up attachment options for opening the target file.                                                      
                                                                                                              
    PUSH target_attachment_options_p: [1 .. 3];                                                               
    target_attachment_options_p^ [1].selector := fsc$access_and_share_modes;                                  
    target_attachment_options_p^ [1].access_modes.selector := fsc$specific_access_modes;                      
    target_attachment_options_p^ [1].access_modes.value := $fst$file_access_options                           
          [fsc$append, fsc$modify, fsc$shorten];                                                              
    target_attachment_options_p^ [1].share_modes.selector := fsc$specific_share_modes;                        
    target_attachment_options_p^ [1].share_modes.value := $fst$file_access_options [];                        
    target_attachment_options_p^ [2].selector := fsc$open_share_modes;                                        
    target_attachment_options_p^ [2].open_share_modes := -$fst$file_access_options [];                        
    target_attachment_options_p^ [3].selector := fsc$validation_ring;                                         
    target_attachment_options_p^ [3].validation_ring := caller_id.ring;                                       
                                                                                                              
    PUSH target_creation_attributes_p: [1 .. 1];                                                              
    target_creation_attributes_p^ [1].selector := fsc$ring_attributes;                                        
    target_creation_attributes_p^ [1].ring_attributes.r1 := caller_id.ring;                                   
    target_creation_attributes_p^ [1].ring_attributes.r2 := caller_id.ring;                                   
    target_creation_attributes_p^ [1].ring_attributes.r3 := caller_id.ring;                                   
                                                                                                              
{ Open the files and obtain the copy control information.                                                     
                                                                                                              
    fsp$open_and_get_type_of_copy (output_local_file_name, target_file, output_attachment_options_p,          
          target_attachment_options_p, { input_attribute_validation } NIL,                                    
          { output_attribute_validation } NIL, target_creation_attributes_p, output_fid, target_fid,          
          control_info, status);                                                                              
    IF NOT status.normal THEN                                                                                 
      IF (output_fid <> amv$nil_file_identifier) THEN                                                         
        fsp$close_file (output_fid, ignore_status);                                                           
        output_fid := amv$nil_file_identifier;                                                                
        #SPOIL (output_fid);                                                                                  
      IFEND;                                                                                                  
                                                                                                              
      amp$return (output_local_file_name, ignore_status);                                                     
                                                                                                              
      IF (target_fid <> amv$nil_file_identifier) THEN                                                         
        fsp$close_file (target_fid, ignore_status);                                                           
        target_fid := amv$nil_file_identifier;                                                                
        #SPOIL (target_fid);                                                                                  
      IFEND;                                                                                                  
                                                                                                              
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    fsp$close_file (output_fid, ignore_status);                                                               
    output_fid := amv$nil_file_identifier;                                                                    
    #SPOIL (output_fid);                                                                                      
                                                                                                              
{ Reopen the output queue file for read access at the caller's ring.                                          
                                                                                                              
    PUSH attribute_override_p: [1 .. 1];                                                                      
    attribute_override_p^ [1].selector := fsc$ring_attributes;                                                
    attribute_override_p^ [1].ring_attributes.r1 := osc$tsrv_ring;                                            
    attribute_override_p^ [1].ring_attributes.r2 := caller_id.ring;                                           
    attribute_override_p^ [1].ring_attributes.r3 := caller_id.ring;                                           
                                                                                                              
    fsp$open_file (output_local_file_name, amc$record, output_attachment_options_p,                           
          { default_creation_attributes } NIL, { mandated_creation_attributes } NIL,                          
          { attribute_validation } NIL, attribute_override_p, output_fid, status);                            
    IF NOT status.normal THEN                                                                                 
      amp$return (output_local_file_name, ignore_status);                                                     
      IF (target_fid <> amv$nil_file_identifier) THEN                                                         
        fsp$close_file (target_fid, ignore_status);                                                           
        target_fid := amv$nil_file_identifier;                                                                
        #SPOIL (target_fid);                                                                                  
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$open_files_for_copof;                                                                           
                                                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL #GATE] jmp$open_output_file', EJECT ??                                                  
*copy jmh$open_output_file                                                                                    
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$open_output_file                                                                
    (    system_file_name: jmt$system_supplied_name;                                                          
         access_level: amt$access_level;                                                                      
         destination_usage: jmt$destination_usage;                                                            
         queue_file_password: jmt$queue_file_password;                                                        
     VAR file_identifier: amt$file_identifier;                                                                
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      attachment_options_p: ^fst$attachment_options,                                                          
      attribute_override_p: ^fst$file_cycle_attributes,                                                       
      caller_id: ost$caller_identifier,                                                                       
      file_path: fst$path,                                                                                    
      file_path_size: 0 .. fsc$max_path_size,                                                                 
      ignore_status: ost$status,                                                                              
      sub_catalog: ost$name;                                                                                  
                                                                                                              
?? NEWTITLE := '[INLINE] add_to_file_path', EJECT ??                                                          
                                                                                                              
    PROCEDURE [INLINE] add_to_file_path                                                                       
      (    path_string: string ( * <= osc$max_name_size));                                                    
                                                                                                              
      VAR                                                                                                     
        string_length: 1 .. osc$max_name_size;                                                                
                                                                                                              
      string_length := clp$trimmed_string_size (path_string);                                                 
      file_path (file_path_size + 1, string_length) := path_string;                                           
      file_path_size := file_path_size + string_length;                                                       
    PROCEND add_to_file_path;                                                                                 
                                                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    ignore_status.normal := TRUE;                                                                             
    #CALLER_ID (caller_id);                                                                                   
                                                                                                              
{ Validate that the caller deserves access to the file.                                                       
                                                                                                              
    qfp$validate_output_file_access (system_file_name, destination_usage, queue_file_password, status);       
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Build the file path for the open request.                                                                   
                                                                                                              
    file_path_size := 0;                                                                                      
    add_to_file_path (':');                                                                                   
    add_to_file_path (jmc$system_family);                                                                     
    add_to_file_path ('.');                                                                                   
    add_to_file_path (jmc$system_user);                                                                       
    add_to_file_path ('.');                                                                                   
    determine_file_catalog (destination_usage, sub_catalog);                                                  
    add_to_file_path (sub_catalog);                                                                           
    add_to_file_path ('.');                                                                                   
    add_to_file_path (system_file_name);                                                                      
                                                                                                              
{ Attach the file for read access and open the file with the rings of the caller                              
                                                                                                              
    PUSH attribute_override_p: [1 .. 1];                                                                      
    attribute_override_p^ [1].selector := fsc$ring_attributes;                                                
    attribute_override_p^ [1].ring_attributes.r1 := osc$tsrv_ring;                                            
    attribute_override_p^ [1].ring_attributes.r2 := caller_id.ring;                                           
    attribute_override_p^ [1].ring_attributes.r3 := caller_id.ring;                                           
                                                                                                              
    PUSH attachment_options_p: [1 .. 2];                                                                      
    attachment_options_p^ [1].selector := fsc$access_and_share_modes;                                         
    attachment_options_p^ [1].access_modes.selector := fsc$specific_access_modes;                             
    attachment_options_p^ [1].access_modes.value := $fst$file_access_options [fsc$read];                      
    attachment_options_p^ [1].share_modes.selector := fsc$specific_share_modes;                               
    attachment_options_p^ [1].share_modes.value := $fst$file_access_options [fsc$read];                       
    attachment_options_p^ [2].selector := fsc$open_share_modes;                                               
    attachment_options_p^ [2].open_share_modes := $fst$file_access_options [fsc$read];                        
                                                                                                              
    osp$establish_block_exit_hndlr (^handle_block_exit);                                                      
    pfp$begin_system_authority;                                                                               
    fsp$open_file (file_path (1, file_path_size), access_level, attachment_options_p, NIL, NIL, NIL,          
          attribute_override_p, file_identifier, status);                                                     
    pfp$end_system_authority;                                                                                 
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
  PROCEND jmp$open_output_file;                                                                               
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$print_file', EJECT ??                                                       
*copy jmh$print_file                                                                                          
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$print_file                                                                      
    (    file_reference: fst$file_reference;                                                                  
         output_submission_options: ^jmt$output_submission_options;                                           
     VAR system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    CONST                                                                                                     
      wait_queue = '$WAIT_QUEUE',                                                                             
      unit_separator = $CHAR (1f(16));                                                                        
                                                                                                              
    VAR                                                                                                       
      caller_identifier: ost$caller_identifier,                                                               
      contains_data: boolean,                                                                                 
      current_date_time: ost$date_time,                                                                       
      current_microsecond_clock: jmt$clock_time,                                                              
      cycle_selector: pft$cycle_selector,                                                                     
      date_time: ost$date_time,                                                                               
      earliest_clock_time_to_print: jmt$clock_time,                                                           
      file: clt$file,                                                                                         
      file_attributes: ^amt$get_attributes,                                                                   
      file_name: ost$name,                                                                                    
      files_vert_print_density: jmt$vertical_print_density,                                                   
      ignore_status: ost$status,                                                                              
      input_attachment_options_p: ^fst$attachment_options,                                                    
      input_validation_attributes_p: ^fst$file_cycle_attributes,                                              
      latest_clock_time_to_print: jmt$clock_time,                                                             
      local_file: boolean,                                                                                    
      null_file_access_procedure: pmt$entry_point_reference,                                                  
      old_file: boolean,                                                                                      
      output_attachment_options_p: ^fst$attachment_options,                                                   
      output_creation_attributes_p: ^fst$file_cycle_attributes,                                               
      output_disposition_key: jmt$output_disposition_keys,                                                    
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      permanent_file_name: amt$local_file_name,                                                               
      privileged_job: boolean,                                                                                
      reason: ost$name,                                                                                       
      statistic_data: jmt$comm_acct_statistic_data,                                                           
      store_and_forward_file: boolean,                                                                        
      system_label: jmt$output_system_label,                                                                  
      system_label_already_existed: boolean,                                                                  
      user_identification: ost$user_identification,                                                           
      wait_queue_file: boolean;                                                                               
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'handle_out_of_space', EJECT ??                                                                
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with the out of space condition.                                 
                                                                                                              
    PROCEDURE handle_out_of_space                                                                             
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      IF (condition.selector = pmc$user_defined_condition) AND                                                
            (condition.user_condition_name = osc$space_unavailable_condition) THEN                            
        osp$set_status_condition (jme$no_space_for_file, status);                                             
        amp$return (permanent_file_name, ignore_status);                                                      
        osp$establish_block_exit_hndlr (^handle_block_exit);                                                  
        pfp$begin_system_authority;                                                                           
        pfp$purge (path_p^, cycle_selector, password, ignore_status);                                         
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        EXIT jmp$print_file;                                                                                  
      ELSEIF condition.selector = pmc$block_exit_processing THEN                                              
        pfp$end_system_authority;                                                                             
        IF status.normal THEN                                                                                 
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                               
      IFEND;                                                                                                  
    PROCEND handle_out_of_space;                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'build_standard_label', EJECT ??                                                               
                                                                                                              
{ PURPOSE:                                                                                                    
{   Build the label for the queued output file.                                                               
                                                                                                              
    PROCEDURE build_standard_label                                                                            
      (    file_name: ost$name;                                                                               
       VAR files_vert_print_density: jmt$vertical_print_density;                                              
       VAR system_label: jmt$output_system_label;                                                             
       VAR status: ost$status);                                                                               
                                                                                                              
      VAR                                                                                                     
        contains_data: boolean,                                                                               
        evaluated_file_reference: fst$evaluated_file_reference,                                               
        file_attributes: ^amt$get_attributes,                                                                 
        ignore_status: ost$status,                                                                            
        job_mode: jmt$job_mode,                                                                               
        link_user_descriptor: rht$link_user_descriptor,                                                       
        local_file: boolean,                                                                                  
        old_file: boolean;                                                                                    
                                                                                                              
      status.normal := TRUE;                                                                                  
                                                                                                              
{ Determine the file attributes.                                                                              
                                                                                                              
      PUSH file_attributes: [1 .. 1];                                                                         
      file_attributes^ [1].key := amc$vertical_print_density;                                                 
      amp$get_file_attributes (file_name, file_attributes^, local_file, old_file, contains_data, status);     
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
      IF file_attributes^ [1].vertical_print_density = LOWERVALUE (amt$vertical_print_density) THEN           
        files_vert_print_density := jmc$vertical_print_density_6;                                             
      ELSE                                                                                                    
        files_vert_print_density := jmc$vertical_print_density_8;                                             
      IFEND;                                                                                                  
                                                                                                              
      pmp$get_job_names (system_label.user_job_name, system_label.system_job_name, ignore_status);            
      pmp$get_user_identification (system_label.login_user_identification, ignore_status);                    
                                                                                                              
      job_mode := pmf$job_mode ();                                                                            
      IF job_mode <> jmc$batch THEN                                                                           
        job_mode := jmc$interactive_connected;                                                                
      IFEND;                                                                                                  
                                                                                                              
      rhp$get_link_user_descriptor (link_user_descriptor, status);                                            
      IF status.normal THEN                                                                                   
        system_label.dual_state_account := link_user_descriptor.charge;                                       
        system_label.dual_state_family_name := link_user_descriptor.family;                                   
        system_label.dual_state_password := link_user_descriptor.password;                                    
        system_label.dual_state_project := link_user_descriptor.project;                                      
        system_label.dual_state_user := link_user_descriptor.user;                                            
      ELSE                                                                                                    
        system_label.dual_state_account := osc$null_name;                                                     
        system_label.dual_state_family_name := osc$null_name;                                                 
        system_label.dual_state_password := osc$null_name;                                                    
        system_label.dual_state_project := osc$null_name;                                                     
        system_label.dual_state_user := osc$null_name;                                                        
      IFEND;                                                                                                  
                                                                                                              
{ Determine the default user_file_name                                                                        
                                                                                                              
      clp$get_fs_path_elements (file_name, evaluated_file_reference, status);                                 
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
      system_label.user_file_name := fsp$path_element (^evaluated_file_reference,                             
            evaluated_file_reference.number_of_path_elements) ^;                                              
                                                                                                              
{ system_label.version is not used.                                                                           
                                                                                                              
      system_label.comment_banner := jmv$job_attributes.comment_banner;                                       
      system_label.copies_printed := 0;                                                                       
      system_label.copy_count := jmv$job_attributes.copy_count;                                               
      system_label.data_declaration := '';                                                                    
      system_label.data_mode := jmc$coded_data;                                                               
      system_label.device_type := jmc$output_device_printer;                                                  
      system_label.disposition_code := jmv$job_disposition_code;                                              
      system_label.earliest_print_time := jmv$job_attributes.earliest_print_time;                             
      system_label.external_characteristics := jmv$job_attributes.external_characteristics;                   
      system_label.file_position := 0;                                                                        
      system_label.forms_code := jmv$job_attributes.forms_code;                                               
      system_label.implicit_routing_text := jmv$job_attributes.implicit_routing_text;                         
      system_label.latest_print_time := jmv$job_attributes.latest_print_time;                                 
      system_label.login_account := avv$account_name;                                                         
      system_label.login_project := avv$project_name;                                                         
      system_label.originating_application_name := jmv$job_attributes.originating_application_name;           
      system_label.output_class := jmv$job_attributes.output_class;                                           
      system_label.output_controller := jmv$job_attributes.job_controller;                                    
      system_label.output_deferred_by_operator := jmv$default_job_attributes [job_mode].                      
            output_deferred_by_operator;                                                                      
      system_label.output_deferred_by_user := jmv$job_attributes.output_deferred_by_user;                     
      system_label.output_destination := jmv$job_attributes.output_destination;                               
      system_label.output_destination_family := jmv$job_attributes.output_destination_family;                 
                                                                                                              
{ If the output_disposition for the job is local then use the system default for the output_destination_usage.
                                                                                                              
      IF (jmv$kjlx_p^ [jmv$jcb.job_id].output_disposition_key = jmc$local_output_disposition) THEN            
        IF job_mode = jmc$batch THEN                                                                          
          system_label.output_destination_usage := jmv$default_job_attributes [jmc$batch].                    
                output_destination_usage;                                                                     
        ELSE                                                                                                  
          system_label.output_destination_usage := jmv$default_job_attributes [jmc$interactive_connected].    
                output_destination_usage;                                                                     
        IFEND;                                                                                                
      ELSE                                                                                                    
        system_label.output_destination_usage := jmv$job_attributes.output_destination_usage;                 
      IFEND;                                                                                                  
      system_label.device := jmv$job_attributes.device;                                                       
      system_label.output_disposition_key := jmv$kjlx_p^ [jmv$jcb.job_id].output_disposition_key;             
      system_label.output_disposition_time.date_time := system_label.output_submission_time;                  
      system_label.output_disposition_time.specified := FALSE;                                                
      system_label.output_priority := jmv$job_attributes.output_priority;                                     
      system_label.output_submission_time := current_date_time;                                               
      system_label.purge_delay := jmv$job_attributes.purge_delay;                                             
      system_label.remote_host_directive := jmv$job_attributes.remote_host_directive;                         
      system_label.routing_banner := jmv$job_attributes.routing_banner;                                       
      system_label.site_information := jmv$job_attributes.site_information;                                   
      system_label.source_logical_id := jmv$job_attributes.source_logical_id;                                 
      system_label.station := jmv$job_attributes.station;                                                     
      system_label.station_operator := jmv$job_attributes.station_operator;                                   
      system_label.system_file_name := '';                                                                    
      system_label.system_routing_text.size := 0;                                                             
      system_label.system_routing_text.parameters := '';                                                      
      system_label.user_information := jmv$job_attributes.user_information;                                   
      system_label.vfu_load_procedure := jmv$job_attributes.vfu_load_procedure;                               
                                                                                                              
{ Reassign the vertical print density if the job attributes specify a vertical print density                  
                                                                                                              
      IF jmv$job_attributes.vertical_print_density = jmc$vertical_print_density_file THEN                     
        system_label.vertical_print_density := files_vert_print_density;                                      
      ELSE                                                                                                    
        system_label.vertical_print_density := jmv$job_attributes.vertical_print_density;                     
      IFEND;                                                                                                  
                                                                                                              
    PROCEND build_standard_label;                                                                             
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'update_label_with_user_options', EJECT ??                                                     
                                                                                                              
{ PURPOSE:                                                                                                    
{   Validates the submission options and updates the system label.                                            
                                                                                                              
    PROCEDURE update_label_with_user_options                                                                  
      (    output_submission_options: ^jmt$output_submission_options;                                         
           files_vert_print_density: jmt$vertical_print_density;                                              
       VAR system_label: jmt$output_system_label;                                                             
       VAR status: ost$status);                                                                               
                                                                                                              
      VAR                                                                                                     
        candidate_system_file_name: jmt$name,                                                                 
        candidate_usn: jmt$name,                                                                              
        option_index: integer,                                                                                
        scl_name: ost$name,                                                                                   
        valid_name: boolean,                                                                                  
        valid_system_file_name: jmt$name,                                                                     
        valid_usn: jmt$name;                                                                                  
                                                                                                              
      status.normal := TRUE;                                                                                  
      IF output_submission_options = NIL THEN                                                                 
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
      FOR option_index := 1 TO UPPERBOUND (output_submission_options^) DO                                     
        CASE output_submission_options^ [option_index].key OF                                                 
        = jmc$comment_banner =                                                                                
          system_label.comment_banner := output_submission_options^ [option_index].comment_banner;            
                                                                                                              
        = jmc$copies =                                                                                        
          system_label.copy_count := output_submission_options^ [option_index].copies;                        
                                                                                                              
        = jmc$data_mode =                                                                                     
          system_label.data_mode := output_submission_options^ [option_index].data_mode;                      
                                                                                                              
        = jmc$device =                                                                                        
          clp$validate_name (output_submission_options^ [option_index].device, scl_name, valid_name);         
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name, output_submission_options^ [option_index].      
                  device, status);                                                                            
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.device := scl_name;                                                                    
                                                                                                              
        = jmc$device_type =                                                                                   
          system_label.device_type := output_submission_options^ [option_index].device_type;                  
                                                                                                              
        = jmc$earliest_print_time =                                                                           
          system_label.earliest_print_time := output_submission_options^ [option_index].earliest_print_time;  
                                                                                                              
        = jmc$external_characteristics =                                                                      
          #TRANSLATE (osv$lower_to_upper, output_submission_options^ [option_index].external_characteristics, 
                system_label.external_characteristics);                                                       
                                                                                                              
        = jmc$forms_code =                                                                                    
          #TRANSLATE (osv$lower_to_upper, output_submission_options^ [option_index].forms_code,               
                system_label.forms_code);                                                                     
                                                                                                              
        = jmc$latest_print_time =                                                                             
          system_label.latest_print_time := output_submission_options^ [option_index].latest_print_time;      
                                                                                                              
        = jmc$null_attribute =                                                                                
          ;                                                                                                   
                                                                                                              
        = jmc$output_class =                                                                                  
          clp$validate_name (output_submission_options^ [option_index].output_class, scl_name, valid_name);   
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].output_class, status);                            
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.output_class := scl_name;                                                              
                                                                                                              
        = jmc$output_deferred_by_user =                                                                       
          system_label.output_deferred_by_user := output_submission_options^ [option_index].                  
                output_deferred_by_user;                                                                      
                                                                                                              
        = jmc$output_destination =                                                                            
          clp$validate_name (output_submission_options^ [option_index].output_destination, scl_name,          
                valid_name);                                                                                  
          IF valid_name THEN                                                                                  
            system_label.output_destination := scl_name;                                                      
          ELSE                                                                                                
            #TRANSLATE (osv$lower_to_upper, output_submission_options^ [option_index].output_destination,     
                  system_label.output_destination);                                                           
          IFEND;                                                                                              
                                                                                                              
        = jmc$output_destination_family =                                                                     
          clp$validate_name (output_submission_options^ [option_index].output_destination_family, scl_name,   
                valid_name);                                                                                  
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].output_destination_family, status);               
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.output_destination_family := scl_name;                                                 
                                                                                                              
        = jmc$output_destination_usage =                                                                      
          clp$validate_name (output_submission_options^ [option_index].output_destination_usage, scl_name,    
                valid_name);                                                                                  
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].output_destination_usage, status);                
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.output_destination_usage := scl_name;                                                  
                                                                                                              
        = jmc$output_disposition =                                                                            
          output_disposition_key := output_submission_options^ [option_index].output_disposition.key;         
          IF (output_disposition_key = jmc$local_output_disposition) OR                                       
                (output_disposition_key = jmc$normal_output_disposition) OR                                   
                (output_disposition_key = jmc$wait_queue_path) THEN                                           
            system_label.output_disposition_key := output_submission_options^ [option_index].                 
                  output_disposition.key;                                                                     
          ELSE                                                                                                
            jmp$get_attribute_name (output_submission_options^ [option_index].key, scl_name);                 
            osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter_value, scl_name, status);   
            osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_SUBMISSION_OPTIONS', status);
            osp$append_status_parameter (osc$status_parameter_delimiter, jmc$print_file, status);             
            RETURN;                                                                                           
          IFEND;                                                                                              
                                                                                                              
        = jmc$output_priority =                                                                               
          clp$validate_name (output_submission_options^ [option_index].output_priority, scl_name, valid_name);
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].output_priority, status);                         
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.output_priority := scl_name;                                                           
                                                                                                              
        = jmc$purge_delay =                                                                                   
          system_label.purge_delay := output_submission_options^ [option_index].purge_delay^;                 
                                                                                                              
        = jmc$remote_host_directive =                                                                         
          system_label.remote_host_directive := output_submission_options^ [option_index].                    
                remote_host_directive^;                                                                       
                                                                                                              
        = jmc$routing_banner =                                                                                
          system_label.routing_banner := output_submission_options^ [option_index].routing_banner;            
                                                                                                              
        = jmc$station =                                                                                       
          clp$validate_name (output_submission_options^ [option_index].station, scl_name, valid_name);        
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].station, status);                                 
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.station := scl_name;                                                                   
                                                                                                              
        = jmc$station_operator =                                                                              
          clp$validate_name (output_submission_options^ [option_index].station_operator, scl_name,            
                valid_name);                                                                                  
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].station_operator, status);                        
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.station_operator := scl_name;                                                          
                                                                                                              
        = jmc$user_file_name =                                                                                
          candidate_usn.kind := jmc$user_supplied_name;                                                       
          candidate_usn.user_supplied_name := output_submission_options^ [option_index].user_file_name;       
          jmp$validate_name (candidate_usn, valid_usn, status);                                               
          IF NOT status.normal THEN                                                                           
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.user_file_name := valid_usn.user_supplied_name;                                        
                                                                                                              
        = jmc$user_information =                                                                              
          system_label.user_information := output_submission_options^ [option_index].user_information^;       
                                                                                                              
        = jmc$vertical_print_density =                                                                        
          system_label.vertical_print_density := output_submission_options^ [option_index].                   
                vertical_print_density;                                                                       
                                                                                                              
          IF system_label.vertical_print_density = jmc$vertical_print_density_file THEN                       
            system_label.vertical_print_density := files_vert_print_density;                                  
          ELSEIF system_label.vertical_print_density > jmc$vertical_print_density_6 THEN                      
            system_label.vertical_print_density := jmc$vertical_print_density_8;                              
          IFEND;                                                                                              
                                                                                                              
        = jmc$vfu_load_procedure =                                                                            
          IF output_submission_options^ [option_index].vfu_load_procedure <> osc$null_name THEN               
            clp$validate_name (output_submission_options^ [option_index].vfu_load_procedure, scl_name,        
                  valid_name);                                                                                
            IF NOT valid_name THEN                                                                            
              osp$set_status_abnormal ('CL', cle$improper_name,                                               
                    output_submission_options^ [option_index].vfu_load_procedure, status);                    
              RETURN;                                                                                         
            IFEND;                                                                                            
            system_label.vfu_load_procedure := scl_name;                                                      
          ELSE                                                                                                
            system_label.vfu_load_procedure := osc$null_name;                                                 
          IFEND;                                                                                              
                                                                                                              
{ The following set of attributes require special privilege to specify them                                   
                                                                                                              
        = jmc$control_family =                                                                                
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].control_family, scl_name, valid_name); 
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].control_family, status);                          
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.output_controller.family := scl_name;                                                  
                                                                                                              
        = jmc$control_user =                                                                                  
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].control_user, scl_name, valid_name);   
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].control_user, status);                            
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.output_controller.user := scl_name;                                                    
                                                                                                              
        = jmc$data_declaration =                                                                              
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          system_label.data_declaration := output_submission_options^ [option_index].data_declaration;        
                                                                                                              
        = jmc$disposition_code =                                                                              
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          system_label.disposition_code := output_submission_options^ [option_index].disposition_code;        
                                                                                                              
        = jmc$implicit_routing_text =                                                                         
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          system_label.implicit_routing_text := output_submission_options^ [option_index].                    
                implicit_routing_text^;                                                                       
                                                                                                              
        = jmc$login_account =                                                                                 
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].login_account, scl_name, valid_name);  
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].login_account, status);                           
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.login_account := scl_name;                                                             
                                                                                                              
        = jmc$login_family =                                                                                  
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].login_family, scl_name, valid_name);   
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].login_family, status);                            
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.login_user_identification.family := scl_name;                                          
                                                                                                              
        = jmc$login_project =                                                                                 
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].login_project, scl_name, valid_name);  
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].login_project, status);                           
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.login_project := scl_name;                                                             
                                                                                                              
        = jmc$login_user =                                                                                    
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].login_user, scl_name, valid_name);     
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].login_user, status);                              
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.login_user_identification.user := scl_name;                                            
                                                                                                              
        = jmc$origin_application_name =                                                                       
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].origin_application_name, scl_name,     
                valid_name);                                                                                  
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].origin_application_name, status);                 
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.originating_application_name := scl_name;                                              
                                                                                                              
        = jmc$source_logical_id =                                                                             
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          system_label.source_logical_id := output_submission_options^ [option_index].source_logical_id;      
                                                                                                              
        = jmc$system_file_name =                                                                              
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
                                                                                                              
{ A blank system supplied name indicates that a "new" system file name should be assigned.                    
{ This provides output applications with the ability to perform a "Loopback".                                 
                                                                                                              
          IF output_submission_options^ [option_index].system_file_name <> jmc$blank_system_supplied_name THEN
            candidate_system_file_name.kind := jmc$system_supplied_name;                                      
            candidate_system_file_name.system_supplied_name :=                                                
                  output_submission_options^ [option_index].system_file_name;                                 
            jmp$validate_name (candidate_system_file_name, valid_system_file_name, status);                   
            IF NOT status.normal THEN                                                                         
              RETURN;                                                                                         
            IFEND;                                                                                            
            system_label.system_file_name := valid_system_file_name.system_supplied_name;                     
          ELSE                                                                                                
            system_label.system_file_name := jmc$blank_system_supplied_name;                                  
          IFEND;                                                                                              
                                                                                                              
        = jmc$system_routing_text =                                                                           
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          system_label.system_routing_text := output_submission_options^ [option_index].system_routing_text^; 
                                                                                                              
        = jmc$user_job_name =                                                                                 
                                                                                                              
{ If the caller is not privileged abort the task by forcing an access violation.                              
                                                                                                              
          IF NOT privileged_job THEN                                                                          
            osp$force_access_violation;                                                                       
          IFEND;                                                                                              
          clp$validate_name (output_submission_options^ [option_index].user_job_name, scl_name, valid_name);  
          IF NOT valid_name THEN                                                                              
            osp$set_status_abnormal ('CL', cle$improper_name,                                                 
                  output_submission_options^ [option_index].user_job_name, status);                           
            RETURN;                                                                                           
          IFEND;                                                                                              
          system_label.user_job_name := scl_name;                                                             
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (output_submission_options^ [option_index].key, scl_name);                   
          osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter, scl_name, status);           
          osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_SUBMISSION_OPTIONS', status);  
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$print_file, status);               
          RETURN;                                                                                             
        CASEND;                                                                                               
      FOREND;                                                                                                 
    PROCEND update_label_with_user_options;                                                                   
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    ignore_status.normal := TRUE;                                                                             
                                                                                                              
    #CALLER_ID (caller_identifier);                                                                           
    privileged_job := (caller_identifier.ring <= osc$sj_ring_3) OR jmv$enable_queue_file_access OR            
          jmp$system_job ();                                                                                  
                                                                                                              
{ Set up static and default values                                                                            
                                                                                                              
    pmp$get_compact_date_time (current_date_time, { ignore } status);                                         
                                                                                                              
    clp$convert_string_to_file (file_reference, file, status);                                                
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
    file_name := file.local_file_name;                                                                        
                                                                                                              
{ Test to see if the user is validated to print the file at his/her current ring level.                       
                                                                                                              
    #CALLER_ID (caller_identifier);                                                                           
                                                                                                              
{ Test to see if the output file already has a system label.  If it does then the                             
{ defaulting does not take place.                                                                             
                                                                                                              
    qfp$read_output_system_label (file_name, system_label, status);                                           
    IF status.normal THEN                                                                                     
                                                                                                              
      files_vert_print_density := system_label.vertical_print_density;                                        
      system_label_already_existed := TRUE;                                                                   
    ELSE {NOT status.normal ==> The file did not have a system label                                          
                                                                                                              
      IF status.condition = jme$read_output_system_label THEN                                                 
        osp$set_status_abnormal (jmc$job_management_id, jme$sl_version_mismatch, '', status);                 
        RETURN;                                                                                               
      IFEND;                                                                                                  
      status.normal := TRUE;                                                                                  
                                                                                                              
      system_label_already_existed := FALSE;                                                                  
      build_standard_label (file_name, files_vert_print_density, system_label, status);                       
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
    IFEND; {NOT status.normal ==> The file did not have a system label                                        
                                                                                                              
{ Override default values for the system label - if necessary                                                 
                                                                                                              
    update_label_with_user_options (output_submission_options, files_vert_print_density, system_label,        
          status);                                                                                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Is the output file destined for the store and forward queue??                                               
                                                                                                              
    store_and_forward_file := NOT ((system_label.output_destination_usage = jmc$public_usage) OR              
          (system_label.output_destination_usage = jmc$private_usage) OR                                      
          (system_label.output_destination_usage = jmc$dual_state_usage));                                    
                                                                                                              
{ Check destination usage for special cases                                                                   
                                                                                                              
    IF system_label.output_destination_usage = jmc$dual_state_usage THEN                                      
                                                                                                              
{ remote host cannot handle transparent data - change it to coded                                             
                                                                                                              
      system_label.data_mode := jmc$coded_data;                                                               
                                                                                                              
    ELSEIF (system_label.output_destination_usage = jmc$private_usage) OR                                     
          (system_label.output_destination_usage = jmc$ntf_usage) THEN                                        
      system_label.output_controller.family := system_label.output_destination_family;                        
      system_label.output_controller.user := system_label.station_operator;                                   
    IFEND;                                                                                                    
                                                                                                              
{ Assign defaults to the routing and comment banners if they are empty.                                       
                                                                                                              
    IF system_label.comment_banner = osc$null_name THEN                                                       
      system_label.comment_banner := system_label.user_file_name;                                             
    IFEND;                                                                                                    
    IF system_label.routing_banner = osc$null_name THEN                                                       
      system_label.routing_banner := system_label.output_controller.user;                                     
    IFEND;                                                                                                    
                                                                                                              
{ Determine if the file should be printed or NOT.  If the file should not be printed simply exit              
{ with normal status.                                                                                         
                                                                                                              
    IF (system_label.output_disposition_key = jmc$discard_all_output) THEN                                    
      system_file_name := jmc$blank_system_supplied_name;                                                     
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Calculate the earliest_print_time, latest_print_time and purge_delay if necessary.                          
                                                                                                              
    pmp$get_microsecond_clock (current_microsecond_clock, ignore_status);                                     
                                                                                                              
    IF system_label.earliest_print_time.specified THEN                                                        
      jmp$convert_date_time_dif_to_us (current_date_time, system_label.earliest_print_time.date_time,         
            current_microsecond_clock, earliest_clock_time_to_print);                                         
    ELSE                                                                                                      
      earliest_clock_time_to_print := jmc$earliest_clock_time;                                                
    IFEND;                                                                                                    
                                                                                                              
    IF system_label.latest_print_time.specified THEN                                                          
      jmp$convert_date_time_dif_to_us (current_date_time, system_label.latest_print_time.date_time,           
            current_microsecond_clock, latest_clock_time_to_print);                                           
    ELSE                                                                                                      
      latest_clock_time_to_print := jmc$latest_clock_time;                                                    
    IFEND;                                                                                                    
                                                                                                              
{ The output system label is now completely built                                                             
                                                                                                              
    password := osc$null_name;                                                                                
                                                                                                              
{ Make the appropriate copy - to t-record if the file is coded - raw copy if the file is transparent.         
                                                                                                              
    null_file_access_procedure.entry_point := osc$null_name;                                                  
    null_file_access_procedure.object_library := '';                                                          
    PUSH input_validation_attributes_p: [1 .. 1];                                                             
    input_validation_attributes_p^ [1].selector := fsc$file_access_procedure_name;                            
    input_validation_attributes_p^ [1].file_access_procedure_name := ^null_file_access_procedure;             
                                                                                                              
    PUSH input_attachment_options_p: [1 .. 8];                                                                
    input_attachment_options_p^ [1].selector := fsc$access_and_share_modes;                                   
    input_attachment_options_p^ [1].access_modes.selector := fsc$specific_access_modes;                       
    input_attachment_options_p^ [1].access_modes.value := $fst$file_access_options [fsc$read];                
    input_attachment_options_p^ [1].share_modes.selector := fsc$specific_share_modes;                         
    input_attachment_options_p^ [1].share_modes.value := $fst$file_access_options [fsc$read, fsc$execute];    
    input_attachment_options_p^ [2].selector := fsc$allowed_device_classes;                                   
    input_attachment_options_p^ [2].allowed_device_classes := $fst$device_classes [fsc$mass_storage_device];  
    input_attachment_options_p^ [3].selector := fsc$create_file;                                              
    input_attachment_options_p^ [3].create_file := FALSE;                                                     
    input_attachment_options_p^ [4].selector := fsc$free_behind;                                              
    input_attachment_options_p^ [4].free_behind := TRUE;                                                      
    input_attachment_options_p^ [5].selector := fsc$open_position;                                            
    input_attachment_options_p^ [5].open_position := amc$open_at_boi;                                         
    input_attachment_options_p^ [6].selector := fsc$private_read;                                             
    input_attachment_options_p^ [6].private_read := TRUE;                                                     
    input_attachment_options_p^ [7].selector := fsc$sequential_access;                                        
    input_attachment_options_p^ [7].sequential_access := TRUE;                                                
    input_attachment_options_p^ [8].selector := fsc$validation_ring;                                          
    input_attachment_options_p^ [8].validation_ring := caller_identifier.ring;                                
                                                                                                              
    PUSH output_attachment_options_p: [1 .. 2];                                                               
    output_attachment_options_p^ [1].selector := fsc$free_behind;                                             
    output_attachment_options_p^ [1].free_behind := TRUE;                                                     
    output_attachment_options_p^ [2].selector := fsc$sequential_access;                                       
    output_attachment_options_p^ [2].sequential_access := TRUE;                                               
                                                                                                              
    IF system_label.data_mode = jmc$coded_data THEN                                                           
      PUSH output_creation_attributes_p: [1 .. 6];                                                            
      output_creation_attributes_p^ [1].selector := fsc$ring_attributes;                                      
                                                                                                              
{ Ring attributes are set below.                                                                              
                                                                                                              
      output_creation_attributes_p^ [2].selector := fsc$file_contents_and_processor;                          
      output_creation_attributes_p^ [2].file_contents := fsc$list;                                            
      output_creation_attributes_p^ [2].file_processor := fsc$unknown_processor;                              
      output_creation_attributes_p^ [3].selector := fsc$block_type;                                           
      output_creation_attributes_p^ [3].block_type := amc$system_specified;                                   
      output_creation_attributes_p^ [4].selector := fsc$record_delimiting_character;                          
      output_creation_attributes_p^ [4].record_delimiting_character := unit_separator;                        
      output_creation_attributes_p^ [5].selector := fsc$record_type;                                          
      output_creation_attributes_p^ [5].record_type := amc$trailing_char_delimited;                           
      output_creation_attributes_p^ [6].selector := fsc$file_organization;                                    
      output_creation_attributes_p^ [6].file_organization := amc$sequential;                                  
                                                                                                              
    ELSE { transparent data }                                                                                 
      PUSH output_creation_attributes_p: [1 .. 1];                                                            
      output_creation_attributes_p^ [1].selector := fsc$ring_attributes;                                      
                                                                                                              
{ Ring attributes are set below.                                                                              
                                                                                                              
    IFEND;                                                                                                    
                                                                                                              
    wait_queue_file := (system_label.output_disposition_key = jmc$wait_queue_path) AND                        
          (system_label.source_logical_id = '');                                                              
                                                                                                              
    IF system_label.system_file_name = '' THEN                                                                
      qfp$assign_system_supplied_name (system_label.system_file_name);                                        
    IFEND;                                                                                                    
                                                                                                              
  /print_file/                                                                                                
    WHILE TRUE DO                                                                                             
                                                                                                              
      permanent_file_name := system_label.system_file_name;                                                   
      system_file_name := system_label.system_file_name;                                                      
                                                                                                              
      IF jmv$job_history_active THEN                                                                          
        IF NOT jmp$system_job () THEN                                                                         
          jmp$emit_job_history_statistics (jml$print_plot_file_executed, osc$null_name,                       
                system_label.system_job_name, system_file_name, NIL, ^system_label, osc$null_name,            
                jmc$blank_system_supplied_name, ignore_status);                                               
        IFEND;                                                                                                
      IFEND;                                                                                                  
                                                                                                              
{ If the file is not going to the store-and-forward queue it may belong in the user's wait                    
{ queue.  The catalog :$FAMILY.$USER.$WAIT_QUEUE is created and the file will be placed                       
{ there without a label.                                                                                      
                                                                                                              
      IF wait_queue_file THEN                                                                                 
        PUSH path_p: [1 .. 3];                                                                                
        path_p^ [1] := system_label.login_user_identification.family;                                         
        path_p^ [2] := system_label.login_user_identification.user;                                           
        path_p^ [3] := wait_queue;                                                                            
        pfp$define_catalog (path_p^, ignore_status);                                                          
                                                                                                              
        PUSH path_p: [1 .. 4];                                                                                
        path_p^ [1] := system_label.login_user_identification.family;                                         
        path_p^ [2] := system_label.login_user_identification.user;                                           
        path_p^ [3] := wait_queue;                                                                            
        path_p^ [4] := system_label.user_job_name;                                                            
                                                                                                              
        cycle_selector.cycle_option := pfc$highest_cycle;                                                     
        pfp$define (permanent_file_name, path_p^, cycle_selector, password, pfc$maximum_retention, pfc$log,   
              status);                                                                                        
        IF status.normal THEN                                                                                 
          output_creation_attributes_p^ [1].ring_attributes.r1 := avp$ring_nominal ();                        
          output_creation_attributes_p^ [1].ring_attributes.r2 := avp$ring_nominal ();                        
          output_creation_attributes_p^ [1].ring_attributes.r3 := avp$ring_nominal ();                        
                                                                                                              
          fsp$subsystem_copy_file (file_name, permanent_file_name, input_attachment_options_p,                
                output_attachment_options_p, input_validation_attributes_p, {output_attribute_validation} NIL,
                output_creation_attributes_p, status);                                                        
        IFEND;                                                                                                
        IF status.normal THEN                                                                                 
          amp$return (permanent_file_name, status);                                                           
          IF jmv$job_history_active THEN                                                                      
            jmp$emit_job_history_statistics (jml$output_queuing_started, osc$null_name,                       
                  system_label.system_job_name, system_file_name, NIL, ^system_label, osc$null_name,          
                  jmc$blank_system_supplied_name, ignore_status);                                             
          IFEND;                                                                                              
          EXIT /print_file/;                                                                                  
        IFEND;                                                                                                
        amp$return (permanent_file_name, ignore_status);                                                      
        wait_queue_file := FALSE;                                                                             
      IFEND;                                                                                                  
                                                                                                              
      determine_file_path (system_label.output_destination_usage, system_file_name, path_p);                  
      cycle_selector.cycle_option := pfc$specific_cycle;                                                      
      cycle_selector.cycle_number := 1;                                                                       
                                                                                                              
{ Force variables used by the out of space condition handler to memory.                                       
{ Establish the condition handler.                                                                            
                                                                                                              
      #SPOIL (path_p, permanent_file_name, cycle_selector, password);                                         
                                                                                                              
      osp$establish_condition_handler (^handle_out_of_space, {block_exit} TRUE);                              
      pfp$begin_system_authority;                                                                             
      pfp$define (permanent_file_name, path_p^, cycle_selector, password, pfc$maximum_retention, pfc$log,     
            status);                                                                                          
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
      IF NOT status.normal THEN                                                                               
        IF (status.condition = pfe$duplicate_cycle) THEN                                                      
          status.normal := TRUE;                                                                              
          qfp$assign_system_supplied_name (system_label.system_file_name);                                    
          CYCLE /print_file/;                                                                                 
        IFEND;                                                                                                
        EXIT /print_file/;                                                                                    
      IFEND;                                                                                                  
                                                                                                              
      output_creation_attributes_p^ [1].ring_attributes.r1 := osc$tsrv_ring;                                  
      output_creation_attributes_p^ [1].ring_attributes.r2 := osc$tsrv_ring;                                  
      output_creation_attributes_p^ [1].ring_attributes.r3 := osc$tsrv_ring;                                  
                                                                                                              
      osp$establish_condition_handler (^handle_out_of_space, {block_exit} FALSE);                             
                                                                                                              
      fsp$subsystem_copy_file (file_name, permanent_file_name, input_attachment_options_p,                    
            output_attachment_options_p, input_validation_attributes_p, {output_attribute_validation} NIL,    
            output_creation_attributes_p, status);                                                            
      IF NOT status.normal THEN                                                                               
        amp$return (permanent_file_name, ignore_status);                                                      
                                                                                                              
{ This overwrites the out of space handler's definition so we don't need to                                   
{ disestablish it.                                                                                            
                                                                                                              
        osp$establish_block_exit_hndlr (^handle_block_exit);                                                  
        pfp$begin_system_authority;                                                                           
        pfp$purge (path_p^, cycle_selector, password, ignore_status);                                         
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        EXIT /print_file/;                                                                                    
      IFEND;                                                                                                  
      osp$disestablish_cond_handler;                                                                          
                                                                                                              
      PUSH file_attributes: [1 .. 1];                                                                         
      file_attributes^ [1].key := amc$file_length;                                                            
      amp$get_file_attributes (permanent_file_name, file_attributes^, local_file, old_file, contains_data,    
            ignore_status);                                                                                   
      system_label.file_size := file_attributes^ [1].file_length;                                             
                                                                                                              
      qfp$write_output_system_label (permanent_file_name, { write_label } TRUE, system_label, status);        
      IF NOT status.normal THEN                                                                               
        amp$return (permanent_file_name, ignore_status);                                                      
        osp$establish_block_exit_hndlr (^handle_block_exit);                                                  
        pfp$begin_system_authority;                                                                           
        pfp$purge (path_p^, cycle_selector, password, ignore_status);                                         
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        EXIT /print_file/;                                                                                    
      IFEND;                                                                                                  
                                                                                                              
      amp$return (permanent_file_name, status);                                                               
      IF NOT status.normal THEN                                                                               
        osp$establish_block_exit_hndlr (^handle_block_exit);                                                  
        pfp$begin_system_authority;                                                                           
        pfp$purge (path_p^, cycle_selector, password, ignore_status);                                         
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        EXIT /print_file/;                                                                                    
      IFEND;                                                                                                  
                                                                                                              
      IF jmv$job_history_active THEN                                                                          
        jmp$emit_job_history_statistics (jml$output_queuing_started, osc$null_name,                           
              system_label.system_job_name, system_file_name, NIL, ^system_label, osc$null_name,              
              jmc$blank_system_supplied_name, ignore_status);                                                 
      IFEND;                                                                                                  
                                                                                                              
{ Enter the file in the Known Output List.                                                                    
                                                                                                              
      qfp$print_file (system_label, earliest_clock_time_to_print, latest_clock_time_to_print,                 
            current_microsecond_clock, status);                                                               
      IF NOT status.normal THEN                                                                               
        IF jmv$job_history_active THEN                                                                        
          reason := '';                                                                                       
          osp$get_status_condition_name (status.condition, reason, ignore_status);                            
          jmp$emit_job_history_statistics (jml$output_queuing_aborted, osc$null_name,                         
                system_label.system_job_name, system_file_name, NIL, NIL, reason,                             
                jmc$blank_system_supplied_name, ignore_status);                                               
        IFEND;                                                                                                
        osp$establish_block_exit_hndlr (^handle_block_exit);                                                  
        pfp$begin_system_authority;                                                                           
        pfp$purge (path_p^, cycle_selector, password, ignore_status);                                         
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
        IF status.condition = jme$duplicate_name THEN                                                         
          status.normal := TRUE;                                                                              
          qfp$assign_system_supplied_name (system_label.system_file_name);                                    
          CYCLE /print_file/;                                                                                 
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$get_user_identification (user_identification, ignore_status);                                     
        IF (NOT jmp$system_job ()) OR (user_identification = system_label.login_user_identification) THEN     
          statistic_data.statistic_id := jmc$ca_print_file;                                                   
          PUSH statistic_data.print_file;                                                                     
          statistic_data.print_file^.file_size := system_label.file_size;                                     
          statistic_data.print_file^.user_file_name := system_label.user_file_name;                           
          statistic_data.print_file^.system_file_name := system_label.system_file_name;                       
          jmp$emit_communication_stat (statistic_data);                                                       
        IFEND;                                                                                                
                                                                                                              
      IFEND;                                                                                                  
      EXIT /print_file/;                                                                                      
    WHILEND /print_file/;                                                                                     
                                                                                                              
  PROCEND jmp$print_file;                                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$purge_expired_file', EJECT ??                                                      
*copy jmh$purge_expired_file                                                                                  
                                                                                                              
  PROCEDURE [XDCL] jmp$purge_expired_file;                                                                    
                                                                                                              
    VAR                                                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      output_destination_usage: jmt$destination_usage,                                                        
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      statistic_data: jmt$comm_acct_statistic_data,                                                           
      system_file_name: jmt$system_supplied_name;                                                             
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      pfp$end_system_authority;                                                                               
    PROCEND handle_block_exit;                                                                                
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
                                                                                                              
    qfp$purge_expired_file (system_file_name, output_destination_usage);                                      
    IF system_file_name <> jmc$blank_system_supplied_name THEN                                                
      determine_file_path (output_destination_usage, system_file_name, path_p);                               
                                                                                                              
      statistic_data.statistic_id := jmc$ca_output_queue_residency;                                           
      PUSH statistic_data.output_queue_residency;                                                             
      statistic_data.output_queue_residency^.output_file_path := path_p;                                      
      jmp$emit_communication_stat (statistic_data);                                                           
                                                                                                              
      cycle_selector.cycle_option := pfc$specific_cycle;                                                      
      cycle_selector.cycle_number := 1;                                                                       
      password := osc$null_name;                                                                              
      osp$establish_block_exit_hndlr (^handle_block_exit);                                                    
      pfp$begin_system_authority;                                                                             
      pfp$purge (path_p^, cycle_selector, password, ignore_status);                                           
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
    IFEND;                                                                                                    
  PROCEND jmp$purge_expired_file;                                                                             
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$purge_printed_file', EJECT ??                                                      
*copy jmh$purge_printed_file                                                                                  
                                                                                                              
  PROCEDURE [XDCL] jmp$purge_printed_file;                                                                    
                                                                                                              
    VAR                                                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      output_destination_usage: jmt$destination_usage,                                                        
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      statistic_data: jmt$comm_acct_statistic_data,                                                           
      system_file_name: jmt$system_supplied_name;                                                             
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      pfp$end_system_authority;                                                                               
    PROCEND handle_block_exit;                                                                                
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
                                                                                                              
    qfp$purge_printed_file (system_file_name, output_destination_usage);                                      
    IF system_file_name <> jmc$blank_system_supplied_name THEN                                                
      determine_file_path (output_destination_usage, system_file_name, path_p);                               
                                                                                                              
      statistic_data.statistic_id := jmc$ca_output_queue_residency;                                           
      PUSH statistic_data.output_queue_residency;                                                             
      statistic_data.output_queue_residency^.output_file_path := path_p;                                      
      jmp$emit_communication_stat (statistic_data);                                                           
                                                                                                              
      cycle_selector.cycle_option := pfc$specific_cycle;                                                      
      cycle_selector.cycle_number := 1;                                                                       
      password := osc$null_name;                                                                              
      osp$establish_block_exit_hndlr (^handle_block_exit);                                                    
      pfp$begin_system_authority;                                                                             
      pfp$purge (path_p^, cycle_selector, password, ignore_status);                                           
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
    IFEND;                                                                                                    
  PROCEND jmp$purge_printed_file;                                                                             
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$rebuild_output_queue', EJECT ??                                                    
*copy jmh$rebuild_output_queue                                                                                
                                                                                                              
  PROCEDURE [XDCL] jmp$rebuild_output_queue                                                                   
    (    system_file_name: jmt$system_supplied_name;                                                          
         subcatalog_name: ost$name;                                                                           
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      current_date_time: ost$date_time,                                                                       
      current_microsecond_clock: jmt$clock_time,                                                              
      cycle_selector: pft$cycle_selector,                                                                     
      date_time: ost$date_time,                                                                               
      earliest_clock_time_to_print: jmt$clock_time,                                                           
      ignore_status: ost$status,                                                                              
      latest_clock_time_to_print: jmt$clock_time,                                                             
      local_file_name: amt$local_file_name,                                                                   
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      purge_delay_clock_time: jmt$clock_time,                                                                 
      scl_name: ost$name,                                                                                     
      system_label: jmt$output_system_label,                                                                  
      system_supplied_name: jmt$system_supplied_name,                                                         
      usage_selections: pft$usage_selections,                                                                 
      valid_name: boolean;                                                                                    
                                                                                                              
    status.normal := TRUE;                                                                                    
    ignore_status.normal := TRUE;                                                                             
                                                                                                              
                                                                                                              
    clp$validate_name (system_file_name, scl_name, valid_name);                                               
    IF NOT valid_name THEN                                                                                    
      osp$set_status_abnormal ('CL', cle$improper_name, system_file_name, status);                            
      RETURN;                                                                                                 
    IFEND;                                                                                                    
    system_supplied_name := scl_name;                                                                         
                                                                                                              
    pmp$get_unique_name (local_file_name, status);                                                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    PUSH path_p: [1 .. 4];                                                                                    
    path_p^ [1] := jmc$system_family;                                                                         
    path_p^ [2] := jmc$system_user;                                                                           
    path_p^ [3] := subcatalog_name;                                                                           
    path_p^ [4] := system_supplied_name;                                                                      
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
    usage_selections := $pft$usage_selections [pfc$read];                                                     
                                                                                                              
    pfp$attach (local_file_name, path_p^, cycle_selector, password, usage_selections, usage_selections,       
          pfc$wait, status);                                                                                  
    IF NOT status.normal THEN                                                                                 
      pfp$purge (path_p^, cycle_selector, password, ignore_status);                                           
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ If we can't read the system label - don't recover it                                                        
{ In fact, delete the output file                                                                             
                                                                                                              
    qfp$read_output_system_label (local_file_name, system_label, status);                                     
    IF NOT status.normal THEN                                                                                 
      amp$return (local_file_name, ignore_status);                                                            
      pfp$purge (path_p^, cycle_selector, password, ignore_status);                                           
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Calculate the earliest_print_time, latest_print_time and purge_delay if necessary.                          
                                                                                                              
    pmp$get_microsecond_clock (current_microsecond_clock, ignore_status);                                     
    pmp$get_compact_date_time (current_date_time, ignore_status);                                             
                                                                                                              
                                                                                                              
{ If the file has been printed (i.e. disposition time is available) and a purge delay has been supplied then  
{ calculate the free-running clock value at which the file can be purged.                                     
{ The desired algorithm for a file that has been printed is:                                                  
{                                                                                                             
{   output_disposition_time = output_disposition_time + down_time;                                            
{   purge_delay_clock_time = output_disposition_time + purge_delay - current_time + microsecond_clock;        
{                                                                                                             
{ Currently the quantity (DOWN_TIME) is unknown so a file may get purged                                      
{ due to the system being down when its purge delay expires.                                                  
                                                                                                              
    IF system_label.output_disposition_time.specified THEN                                                    
      earliest_clock_time_to_print := jmc$earliest_clock_time;                                                
      latest_clock_time_to_print := jmc$latest_clock_time;                                                    
      IF system_label.purge_delay.specified THEN                                                              
        pmp$compute_date_time (system_label.output_disposition_time.date_time,                                
              system_label.purge_delay.time_increment, date_time, status);                                    
        IF NOT status.normal THEN                                                                             
          amp$return (local_file_name, ignore_status);                                                        
          RETURN;                                                                                             
        IFEND;                                                                                                
        jmp$convert_date_time_dif_to_us (current_date_time, date_time, current_microsecond_clock,             
              purge_delay_clock_time);                                                                        
      ELSE                                                                                                    
        purge_delay_clock_time := jmc$earliest_clock_time;                                                    
      IFEND;                                                                                                  
    ELSE                                                                                                      
      IF system_label.earliest_print_time.specified THEN                                                      
        jmp$convert_date_time_dif_to_us (current_date_time, system_label.earliest_print_time.date_time,       
              current_microsecond_clock, earliest_clock_time_to_print);                                       
      ELSE                                                                                                    
        earliest_clock_time_to_print := jmc$earliest_clock_time;                                              
      IFEND;                                                                                                  
                                                                                                              
      IF system_label.latest_print_time.specified THEN                                                        
        jmp$convert_date_time_dif_to_us (current_date_time, system_label.latest_print_time.date_time,         
              current_microsecond_clock, latest_clock_time_to_print);                                         
      ELSE                                                                                                    
        latest_clock_time_to_print := jmc$latest_clock_time;                                                  
      IFEND;                                                                                                  
      purge_delay_clock_time := jmc$earliest_clock_time;                                                      
    IFEND;                                                                                                    
                                                                                                              
    qfp$rebuild_output_queue (system_label, earliest_clock_time_to_print, latest_clock_time_to_print,         
          purge_delay_clock_time, current_microsecond_clock, status);                                         
    IF NOT status.normal THEN                                                                                 
      amp$return (local_file_name, ignore_status);                                                            
    ELSE                                                                                                      
      amp$return (local_file_name, status);                                                                   
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$rebuild_output_queue;                                                                           
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$register_output_application', EJECT ??                                      
*copy jmh$register_output_application                                                                         
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$register_output_application                                                     
    (    application_name: ost$name;                                                                          
         output_destination_usage: jmt$destination_usage;                                                     
     VAR queue_file_password: jmt$queue_file_password;                                                        
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      caller_id: ost$caller_identifier,                                                                       
      privileged_job: boolean,                                                                                
      valid_name: boolean,                                                                                    
      valid_application_name: ost$name,                                                                       
      valid_destination_usage: ost$name;                                                                      
                                                                                                              
    status.normal := TRUE;                                                                                    
    #CALLER_ID (caller_id);                                                                                   
                                                                                                              
    privileged_job := (caller_id.ring <= osc$sj_ring_3) OR jmv$enable_queue_file_access OR jmp$system_job (); 
    IF NOT privileged_job THEN                                                                                
      osp$force_access_violation;                                                                             
    IFEND;                                                                                                    
                                                                                                              
    clp$validate_name (application_name, valid_application_name, valid_name);                                 
    IF NOT valid_name THEN                                                                                    
      osp$set_status_abnormal ('CL', cle$improper_name, application_name, status);                            
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    clp$validate_name (output_destination_usage, valid_destination_usage, valid_name);                        
    IF NOT valid_name THEN                                                                                    
      osp$set_status_abnormal ('CL', cle$improper_name, output_destination_usage, status);                    
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    pmp$get_unique_name (queue_file_password, status);                                                        
    IF status.normal THEN                                                                                     
      qfp$register_output_application (valid_application_name, valid_destination_usage, queue_file_password,  
            status);                                                                                          
      IF status.normal THEN                                                                                   
        task_has_registered_application := TRUE;                                                              
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$register_output_application;                                                                    
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$release_output_files', EJECT ??                                                    
*copy jmh$release_output_files                                                                                
                                                                                                              
  PROCEDURE [XDCL] jmp$release_output_files;                                                                  
                                                                                                              
    VAR                                                                                                       
      release_file_list: ^jmt$release_output_file_list,                                                       
      release_file_count: jmt$output_count_range,                                                             
      release_file_index: jmt$output_count_range,                                                             
      ignore_status: ost$status,                                                                              
      path_p: ^pft$path,                                                                                      
      statistic_data: jmt$comm_acct_statistic_data,                                                           
      cycle_selector: pft$cycle_selector,                                                                     
      password: pft$password;                                                                                 
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        local_status: ost$status;                                                                             
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF ignore_status.normal THEN                                                                            
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, ignore_status, local_status);
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    IF NOT task_has_registered_application THEN                                                               
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    ignore_status.normal := TRUE;                                                                             
                                                                                                              
    statistic_data.statistic_id := jmc$ca_output_queue_residency;                                             
    PUSH statistic_data.output_queue_residency;                                                               
                                                                                                              
    PUSH release_file_list: [1 .. jmc$maximum_output_count];                                                  
    release_file_count := 0;                                                                                  
                                                                                                              
{ Since the release_file_list is at the maximum, no test will be necessary to verify that                     
{ the release_file_count does not exceed the upperbound of the list.                                          
                                                                                                              
    qfp$release_output_files (release_file_list, release_file_count);                                         
                                                                                                              
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
    PUSH path_p: [1 .. 4];                                                                                    
    path_p^ [1] := jmc$system_family;                                                                         
    path_p^ [2] := jmc$system_user;                                                                           
                                                                                                              
    osp$establish_block_exit_hndlr (^handle_block_exit);                                                      
    pfp$begin_system_authority;                                                                               
                                                                                                              
  /purge_all_released_files/                                                                                  
    FOR release_file_index := 1 TO release_file_count DO                                                      
      determine_file_catalog (release_file_list^ [release_file_index].output_destination_usage, path_p^ [3]); 
      path_p^ [4] := release_file_list^ [release_file_index].system_file_name;                                
      statistic_data.output_queue_residency^.output_file_path := path_p;                                      
      jmp$emit_communication_stat (statistic_data);                                                           
      pfp$purge (path_p^, cycle_selector, password, ignore_status);                                           
    FOREND /purge_all_released_files/;                                                                        
                                                                                                              
    pfp$end_system_authority;                                                                                 
    osp$disestablish_cond_handler;                                                                            
  PROCEND jmp$release_output_files;                                                                           
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$set_output_completed', EJECT ??                                             
*copy jmh$set_output_completed                                                                                
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$set_output_completed                                                            
    (    output_destination_usage: jmt$destination_usage;                                                     
         system_file_name: jmt$system_supplied_name;                                                          
         completed_successfully: boolean;                                                                     
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      current_clock_time: jmt$clock_time,                                                                     
      date_time: ost$date_time,                                                                               
      delete_output_file: boolean,                                                                            
      ignore_status: ost$status,                                                                              
      local_file_name: amt$local_file_name,                                                                   
      local_status: ost$status,                                                                               
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      purge_delay_clock_time: jmt$clock_time,                                                                 
      share_selections: pft$usage_selections,                                                                 
      statistic_data: jmt$comm_acct_statistic_data,                                                           
      system_job_name: jmt$system_supplied_name,                                                              
      system_label: jmt$output_system_label,                                                                  
      usage_selections: pft$usage_selections;                                                                 
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    determine_file_path (output_destination_usage, system_file_name, path_p);                                 
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
                                                                                                              
    IF completed_successfully THEN                                                                            
      pmp$get_unique_name (local_file_name, ignore_status);                                                   
      usage_selections := $pft$usage_selections [pfc$read, pfc$modify];                                       
      share_selections := $pft$share_selections [pfc$read];                                                   
      osp$establish_block_exit_hndlr (^handle_block_exit);                                                    
      pfp$begin_system_authority;                                                                             
      pfp$attach (local_file_name, path_p^, cycle_selector, password, usage_selections, usage_selections,     
            pfc$wait, status);                                                                                
      pfp$end_system_authority;                                                                               
                                                                                                              
{ The attach has completed - dump the handler                                                                 
                                                                                                              
      osp$disestablish_cond_handler;                                                                          
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
      qfp$read_output_system_label (local_file_name, system_label, status);                                   
      IF NOT status.normal THEN                                                                               
        RETURN;                                                                                               
      IFEND;                                                                                                  
      pmp$get_microsecond_clock (current_clock_time, ignore_status);                                          
      pmp$get_compact_date_time (system_label.output_disposition_time.date_time, ignore_status);              
      system_label.output_disposition_time.specified := TRUE;                                                 
      IF system_label.purge_delay.specified THEN                                                              
        pmp$compute_date_time (system_label.output_disposition_time.date_time,                                
              system_label.purge_delay.time_increment, date_time, ignore_status);                             
        jmp$convert_date_time_dif_to_us (system_label.output_disposition_time.date_time, date_time,           
              current_clock_time, purge_delay_clock_time);                                                    
      ELSE                                                                                                    
        purge_delay_clock_time := jmc$earliest_clock_time;                                                    
      IFEND;                                                                                                  
    ELSE                                                                                                      
      purge_delay_clock_time := jmc$earliest_clock_time;                                                      
    IFEND;                                                                                                    
                                                                                                              
    qfp$set_output_completed (output_destination_usage, system_file_name, completed_successfully,             
          purge_delay_clock_time, current_clock_time, delete_output_file, system_job_name, status);           
    IF status.normal THEN                                                                                     
      IF jmv$job_history_active THEN                                                                          
        IF (output_destination_usage = jmc$dual_state_usage) OR                                               
              (output_destination_usage = jmc$private_usage) OR                                               
              (output_destination_usage = jmc$public_usage) THEN                                              
          jmp$emit_job_history_statistics (jml$print_plot_terminated, osc$null_name, system_job_name,         
                system_file_name, NIL, NIL, osc$null_name, jmc$blank_system_supplied_name, local_status);     
        IFEND;                                                                                                
      IFEND;                                                                                                  
                                                                                                              
      IF delete_output_file THEN                                                                              
                                                                                                              
{ The file must be detached because the output queue residency statistic will                                 
{ require that the file be re-attached to emit the correct information.                                       
                                                                                                              
        IF completed_successfully THEN                                                                        
          amp$return (local_file_name, ignore_status);                                                        
        IFEND;                                                                                                
        statistic_data.statistic_id := jmc$ca_output_queue_residency;                                         
        PUSH statistic_data.output_queue_residency;                                                           
        statistic_data.output_queue_residency^.output_file_path := path_p;                                    
        jmp$emit_communication_stat (statistic_data);                                                         
                                                                                                              
        osp$establish_block_exit_hndlr (^handle_block_exit);                                                  
        pfp$begin_system_authority;                                                                           
        pfp$purge (path_p^, cycle_selector, password, status);                                                
        pfp$end_system_authority;                                                                             
        osp$disestablish_cond_handler;                                                                        
      ELSEIF completed_successfully THEN                                                                      
                                                                                                              
{ Write the updated output file's system label                                                                
                                                                                                              
        qfp$write_output_system_label (local_file_name, { write_label } TRUE, system_label, status);          
        IF status.normal THEN                                                                                 
          amp$return (local_file_name, status);                                                               
        ELSE                                                                                                  
          amp$return (local_file_name, ignore_status);                                                        
        IFEND;                                                                                                
      IFEND;                                                                                                  
    ELSE                                                                                                      
      amp$return (local_file_name, ignore_status);                                                            
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$set_output_completed;                                                                           
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$set_output_initiated', EJECT ??                                             
*copy jmh$set_output_initiated                                                                                
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$set_output_initiated                                                            
    (    output_destination_usage: jmt$destination_usage;                                                     
         system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      application_name: ost$name,                                                                             
      local_status: ost$status,                                                                               
      system_job_name: jmt$system_supplied_name;                                                              
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
    qfp$set_output_initiated (output_destination_usage, system_file_name, system_job_name, status);           
    IF status.normal AND jmv$job_history_active THEN                                                          
      qfp$get_application_name (output_destination_usage, application_name);                                  
      IF (output_destination_usage = jmc$dual_state_usage) OR                                                 
            (output_destination_usage = jmc$private_usage) OR                                                 
            (output_destination_usage = jmc$public_usage) THEN                                                
        jmp$emit_job_history_statistics (jml$print_plot_initiated, osc$null_name, system_job_name,            
              system_file_name, NIL, NIL, application_name, jmc$blank_system_supplied_name, local_status);    
      ELSE                                                                                                    
        jmp$emit_job_history_statistics (jml$output_forwarding_started, osc$null_name, system_job_name,       
              system_file_name, NIL, NIL, application_name, jmc$blank_system_supplied_name, local_status);    
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$set_output_initiated;                                                                           
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$terminate_acquired_output', EJECT ??                                        
*copy jmh$terminate_acquired_output                                                                           
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$terminate_acquired_output                                                       
    (    output_destination_usage: jmt$destination_usage;                                                     
     VAR system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      delete_output_file: boolean,                                                                            
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      path_p: ^pft$path,                                                                                      
      password: pft$password,                                                                                 
      statistic_data: jmt$comm_acct_statistic_data,                                                           
      system_job_name: jmt$system_supplied_name;                                                              
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
    qfp$terminate_acquired_output (output_destination_usage, system_file_name, system_job_name,               
          delete_output_file, status);                                                                        
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    IF delete_output_file THEN                                                                                
      IF jmv$job_history_active THEN                                                                          
        jmp$emit_job_history_statistics (jml$print_plot_terminated, osc$null_name, system_job_name,           
              system_file_name, NIL, NIL, osc$null_name, jmc$blank_system_supplied_name, ignore_status);      
      IFEND;                                                                                                  
      determine_file_path (output_destination_usage, system_file_name, path_p);                               
                                                                                                              
      statistic_data.statistic_id := jmc$ca_output_queue_residency;                                           
      PUSH statistic_data.output_queue_residency;                                                             
      statistic_data.output_queue_residency^.output_file_path := path_p;                                      
      jmp$emit_communication_stat (statistic_data);                                                           
                                                                                                              
      cycle_selector.cycle_option := pfc$specific_cycle;                                                      
      cycle_selector.cycle_number := 1;                                                                       
      password := osc$null_name;                                                                              
      osp$establish_block_exit_hndlr (^handle_block_exit);                                                    
      pfp$begin_system_authority;                                                                             
      pfp$purge (path_p^, cycle_selector, password, status);                                                  
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$terminate_acquired_output;                                                                      
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$terminated_output_exists', EJECT ??                                         
*copy jmh$terminated_output_exists                                                                            
                                                                                                              
  FUNCTION [XDCL, #GATE] jmp$terminated_output_exists                                                         
    (    output_destination_usage: jmt$destination_usage): boolean;                                           
                                                                                                              
    VAR                                                                                                       
      application_index: jmt$output_application_index,                                                        
      output_exists: boolean;                                                                                 
                                                                                                              
    application_index := UPPERBOUND (jmv$known_output_list.application_table);                                
    WHILE (jmv$known_output_list.application_table [application_index].destination_usage <>                   
          output_destination_usage) AND (application_index <> jmc$unassigned_output_index) DO                 
      application_index := application_index - 1;                                                             
    WHILEND;                                                                                                  
                                                                                                              
    output_exists := (application_index <> jmc$unassigned_output_index) AND                                   
          (jmv$known_output_list.application_table [application_index].                                       
          state_data [jmc$kol_application_terminated].number_of_entries > 0);                                 
    jmp$terminated_output_exists := output_exists AND (NOT syp$system_is_idling ());                          
                                                                                                              
  FUNCEND jmp$terminated_output_exists;                                                                       
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$terminate_output', EJECT ??                                                 
*copy jmh$terminate_output                                                                                    
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$terminate_output                                                                
    (    output_name: jmt$name;                                                                               
         output_termination_options: ^jmt$output_termination_options;                                         
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      caller_id: ost$caller_identifier,                                                                       
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_parameters_p: ^mainframe_tero_parameters,                                                         
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      number_of_data_packets: ost$non_negative_integers,                                                      
      number_of_outputs_found: jmt$output_status_count,                                                       
      option_index: integer,                                                                                  
      output_state_set: jmt$output_state_set,                                                                 
      output_to_terminate: jmt$name,                                                                          
      reason: ost$name,                                                                                       
      scl_name: ost$name,                                                                                     
      status_options_p: ^jmt$output_status_options,                                                           
      status_results_keys_p: ^jmt$results_keys,                                                               
      status_results_p: ^jmt$output_status_results,                                                           
      status_result_size: ost$segment_length,                                                                 
      status_work_area_p: ^SEQ ( * ),                                                                         
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * );                                                                           
                                                                                                              
    #CALLER_ID (caller_id);                                                                                   
    status.normal := TRUE;                                                                                    
                                                                                                              
{ Set defaults                                                                                                
                                                                                                              
    output_state_set := -$jmt$output_state_set [];                                                            
    reason := osc$null_name;                                                                                  
                                                                                                              
{ Override defaults if necessary                                                                              
                                                                                                              
    IF output_termination_options <> NIL THEN                                                                 
      FOR option_index := 1 TO UPPERBOUND (output_termination_options^) DO                                    
        CASE output_termination_options^ [option_index].key OF                                                
        = jmc$null_attribute =                                                                                
          ;                                                                                                   
                                                                                                              
        = jmc$output_state_set =                                                                              
          IF output_termination_options^ [option_index].output_state_set = $jmt$output_state_set [] THEN      
            osp$set_status_abnormal (jmc$job_management_id, jme$output_state_is_null, '', status);            
            RETURN;                                                                                           
          IFEND;                                                                                              
          output_state_set := output_termination_options^ [option_index].output_state_set;                    
                                                                                                              
        = jmc$termination_reason =                                                                            
          reason := output_termination_options^ [option_index].reason;                                        
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (output_termination_options^ [option_index].key, scl_name);                  
          osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter, scl_name, status);           
          osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_TERMINATION_OPTIONS', status); 
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$terminate_output, status);         
          RETURN;                                                                                             
        CASEND;                                                                                               
      FOREND;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    jmp$validate_name (output_name, output_to_terminate, status);                                             
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    PUSH status_options_p: [1 .. 4];                                                                          
    status_options_p^ [1].key := jmc$name_list;                                                               
    PUSH status_options_p^ [1].name_list: [1 .. 1];                                                           
    status_options_p^ [1].name_list^ [1] := output_to_terminate;                                              
    status_options_p^ [2].key := jmc$output_state_set;                                                        
    status_options_p^ [2].output_state_set := output_state_set;                                               
    status_options_p^ [3].key := jmc$privilege;                                                               
    IF avp$system_operator () OR (caller_id.ring <= osc$tsrv_ring) THEN                                       
      status_options_p^ [3].privilege := jmc$privileged;                                                      
    ELSE                                                                                                      
      status_options_p^ [3].privilege := jmc$not_privileged;                                                  
    IFEND;                                                                                                    
    status_options_p^ [4].key := jmc$continue_request_to_servers;                                             
    status_options_p^ [4].continue_request_to_servers := TRUE;                                                
                                                                                                              
    PUSH status_results_keys_p: [1 .. 2];                                                                     
    status_results_keys_p^ [1] := jmc$system_file_name;                                                       
    status_results_keys_p^ [2] := jmc$client_mainframe_id;                                                    
                                                                                                              
{ If we are able to status the output file, we have control over the file                                     
{ so we can change the attributes of the file                                                                 
                                                                                                              
    jmp$get_result_size ({number_of_items} 1, #SEQ (status_results_keys_p^), status_result_size);             
    PUSH status_work_area_p: [[REP status_result_size OF cell]];                                              
    RESET status_work_area_p;                                                                                 
                                                                                                              
    jmp$get_output_status (status_options_p, status_results_keys_p, status_work_area_p, status_results_p,     
          number_of_outputs_found, status);                                                                   
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$work_area_too_small THEN                                                      
        IF output_name.kind = jmc$system_supplied_name THEN { Can't ever happen                               
          osp$set_status_abnormal (jmc$job_management_id, jme$duplicate_name,                                 
                output_name.system_supplied_name, status);                                                    
        ELSE                                                                                                  
          osp$set_status_abnormal (jmc$job_management_id, jme$duplicate_name, output_name.user_supplied_name, 
                status);                                                                                      
        IFEND;                                                                                                
      ELSEIF status.condition = jme$no_outputs_were_found THEN                                                
        IF output_name.kind = jmc$system_supplied_name THEN                                                   
          osp$set_status_abnormal ('JM', jme$name_not_found, output_name.system_supplied_name, status);       
        ELSE                                                                                                  
          osp$set_status_abnormal ('JM', jme$name_not_found, output_name.user_supplied_name, status);         
        IFEND;                                                                                                
      IFEND;                                                                                                  
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    PUSH target_options_p: [[REP (#SIZE (jmt$system_supplied_name) + #SIZE (reason) +                         
          #SIZE (jmt$output_state_set)) OF cell]];                                                            
    RESET target_options_p;                                                                                   
    NEXT local_parameters_p IN target_options_p;                                                              
    local_parameters_p^.system_file_name := status_results_p^ [1]^ [1].system_file_name;                      
    local_parameters_p^.reason := reason;                                                                     
    local_parameters_p^.output_state_set := output_state_set;                                                 
                                                                                                              
{ Call the general purpose RPC processor to terminate the output file.                                        
                                                                                                              
    mainframes_processed.count := 0;                                                                          
    jm_work_area_p := NIL;                                                                                    
    jmp$general_purpose_cluster_rpc (status_results_p^ [1]^ [2].client_mainframe_id,                          
          jmc$gpro_terminate_output, {data_packet_size} 0, mainframes_processed, target_options_p,            
          jm_work_area_p, target_mainframe_reached, mainframes_processed, number_of_data_packets, status);    
                                                                                                              
  PROCEND jmp$terminate_output;                                                                               
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$update_output_status', EJECT ??                                             
*copy jmh$update_output_status                                                                                
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$update_output_status                                                            
    (    system_file_name: jmt$system_supplied_name;                                                          
         destination_usage: jmt$destination_usage;                                                            
         queue_file_password: jmt$queue_file_password;                                                        
         output_status_updates: ^jmt$output_status_updates;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      local_file_name: amt$local_file_name,                                                                   
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      scl_name: ost$name,                                                                                     
      share_selections: pft$share_selections,                                                                 
      system_label: jmt$output_system_label,                                                                  
      update_index: integer,                                                                                  
      usage_selections: pft$usage_selections;                                                                 
                                                                                                              
?? NEWTITLE := 'handle_block_exit', EJECT ??                                                                  
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to deal with block exit conditions that                                  
{   arise while system_authority is in effect.                                                                
                                                                                                              
    PROCEDURE handle_block_exit                                                                               
      (    condition: pmt$condition;                                                                          
           condition_information_p: ^pmt$condition_information;                                               
           sfsa_p: ^ost$stack_frame_save_area;                                                                
       VAR handler_status: ost$status);                                                                       
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      pfp$end_system_authority;                                                                               
      IF status.normal THEN                                                                                   
        osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);      
      IFEND;                                                                                                  
    PROCEND handle_block_exit;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    ignore_status.normal := TRUE;                                                                             
    status.normal := TRUE;                                                                                    
                                                                                                              
{ Validate that the application has permission to access the file.                                            
                                                                                                              
    qfp$validate_output_file_access (system_file_name, destination_usage, queue_file_password, status);       
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    pmp$get_unique_name (local_file_name, status);                                                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    determine_file_path (destination_usage, system_file_name, path_p);                                        
    cycle_selector.cycle_option := pfc$specific_cycle;                                                        
    cycle_selector.cycle_number := 1;                                                                         
    password := osc$null_name;                                                                                
    usage_selections := $pft$usage_selections [pfc$read, pfc$modify];                                         
    share_selections := $pft$share_selections [pfc$read];                                                     
    osp$establish_block_exit_hndlr (^handle_block_exit);                                                      
    pfp$begin_system_authority;                                                                               
    pfp$attach (local_file_name, path_p^, cycle_selector, password, usage_selections, share_selections,       
          pfc$wait, status);                                                                                  
    pfp$end_system_authority;                                                                                 
    osp$disestablish_cond_handler;                                                                            
    IF NOT status.normal THEN                                                                                 
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Read the output file's system label                                                                         
                                                                                                              
    qfp$read_output_system_label (local_file_name, system_label, status);                                     
    IF NOT status.normal THEN                                                                                 
      amp$return (local_file_name, ignore_status);                                                            
      RETURN;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
{ Check update changes and change the local copy of the system label                                          
                                                                                                              
    IF output_status_updates <> NIL THEN                                                                      
                                                                                                              
    /process_changes/                                                                                         
      FOR update_index := 1 TO UPPERBOUND (output_status_updates^) DO                                         
        CASE output_status_updates^ [update_index].key OF                                                     
        = jmc$copies_printed =                                                                                
          system_label.copies_printed := output_status_updates^ [update_index].copies_printed;                
                                                                                                              
        = jmc$file_position =                                                                                 
          system_label.file_position := output_status_updates^ [update_index].file_position;                  
                                                                                                              
        = jmc$null_attribute =                                                                                
          ;                                                                                                   
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (output_status_updates^ [update_index].key, scl_name);                       
          osp$set_status_abnormal (jmc$job_management_id, jme$invalid_parameter, scl_name, status);           
          osp$append_status_parameter (osc$status_parameter_delimiter, 'OUTPUT_STATUS_UPDATES', status);      
          osp$append_status_parameter (osc$status_parameter_delimiter, 'jmp$update_output_status', status);   
          EXIT /process_changes/;                                                                             
        CASEND;                                                                                               
      FOREND /process_changes/;                                                                               
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN;                                                                                               
      IFEND;                                                                                                  
                                                                                                              
{ Write the result system label to the output file                                                            
                                                                                                              
      qfp$write_output_system_label (local_file_name, { write_label } TRUE, system_label, status);            
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN;                                                                                               
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
{ Release the file in case somebody needs it                                                                  
                                                                                                              
    amp$return (local_file_name, status);                                                                     
                                                                                                              
  PROCEND jmp$update_output_status;                                                                           
MODEND jmm$queue_file_output_manager;                                                                         
