?? RIGHT := 110 ??                                                                                            
?? NEWTITLE := 'NOS/VE: Job Management Generic Queue File Interfaces' ??                                      
MODULE jmm$generic_queue_file_manager;                                                                        
?? RIGHT := 110 ??                                                                                            
                                                                                                              
{ PURPOSE:                                                                                                    
{   This module contains the generic queue file management interfaces.  These interfaces control the          
{ access to, submission of, and manipulation of files in the generic queue.                                   
{                                                                                                             
{ 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 6.                                                                                                  
{                                                                                                             
{ NOTE:                                                                                                       
{   The jmp$ procedures in this module are in alphabetical order, preceded by all the non-jmp$                
{   procedures also in alphabetical order.                                                                    
                                                                                                              
?? NEWTITLE := 'Global Declarations Referenced by this Module', EJECT ??                                      
?? PUSH (LISTEXT := ON) ??                                                                                    
*copyc oss$task_private                                                                                       
*copyc jmc$get_qfile_attributes                                                                               
*copyc jmc$get_qfile_status                                                                                   
*copyc jmc$job_management_id                                                                                  
*copyc jmc$system_family                                                                                      
*copyc cle$ecc_lexical                                                                                        
*copyc fme$file_management_errors                                                                             
*copyc jme$appl_attr_size_exceeds_max                                                                         
*copyc jme$duplicate_attribute_key                                                                            
*copyc jme$duplicate_name                                                                                     
*copyc jme$internal_work_area_overflow                                                                        
*copyc jme$invalid_destination                                                                                
*copyc jme$invalid_parameter                                                                                  
*copyc jme$invalid_rhd                                                                                        
*copyc jme$latest_run_time_expired                                                                            
*copyc jme$no_qfiles_were_found                                                                               
*copyc jme$qfile_is_initiated                                                                                 
*copyc jme$qfile_state_is_null                                                                                
*copyc jme$requires_operator_privilege                                                                        
*copyc jme$system_label_internal_error                                                                        
*copyc jme$work_area_too_small                                                                                
*copyc ofe$error_codes                                                                                        
*copyc amt$access_level                                                                                       
*copyc amt$file_attributes                                                                                    
*copyc amt$get_attributes                                                                                     
*copyc amt$local_file_name                                                                                    
*copyc fst$evaluated_file_reference                                                                           
*copyc fst$file_reference                                                                                     
*copyc jmt$attribute_keys_set                                                                                 
*copyc jmt$name                                                                                               
*copyc jmt$name_list                                                                                          
*copyc jmt$qfile_application_attrs                                                                            
*copyc jmt$qfile_attribute_changes                                                                            
*copyc jmt$qfile_attribute_options                                                                            
*copyc jmt$qfile_attribute_results                                                                            
*copyc jmt$qfile_registration_options                                                                         
*copyc jmt$qfile_status_count                                                                                 
*copyc jmt$qfile_status_options                                                                               
*copyc jmt$qfile_status_results                                                                               
*copyc jmt$qfile_status_updates                                                                               
*copyc jmt$qfile_submission_options                                                                           
*copyc jmt$qfile_termination_options                                                                          
*copyc jmt$queue_file_password                                                                                
*copyc jmt$queue_file_path                                                                                    
*copyc jmt$results_keys                                                                                       
*copyc jmt$system_supplied_name                                                                               
*copyc ost$caller_identifier                                                                                  
*copyc ost$date_time                                                                                          
*copyc ost$status                                                                                             
*copyc pmt$entry_point_reference                                                                              
?? POP ??                                                                                                     
*copyc amp$return                                                                                             
*copyc avp$system_displays                                                                                    
*copyc avp$system_operator                                                                                    
*copyc bap$validate_file_identifier                                                                           
*copyc clp$trimmed_string_size                                                                                
*copyc clp$validate_name                                                                                      
*copyc fsp$close_file                                                                                         
*copyc fsp$open_and_get_type_of_copy                                                                          
*copyc fsp$open_file                                                                                          
*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$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$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_integer                                                                              
*copyc osp$append_status_parameter                                                                            
*copyc osp$disestablish_cond_handler                                                                          
*copyc osp$establish_block_exit_hndlr                                                                         
*copyc osp$establish_condition_handler                                                                        
*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_mode                                                                                       
*copyc pmp$get_mainframe_id                                                                                   
*copyc pmp$get_microsecond_clock                                                                              
*copyc pmp$get_unique_name                                                                                    
*copyc pmp$get_user_identification                                                                            
*copyc qfp$acquire_modified_qfile                                                                             
*copyc qfp$acquire_new_qfile                                                                                  
*copyc qfp$assign_system_supplied_name                                                                        
*copyc qfp$change_qfile_attributes                                                                            
*copyc qfp$get_qfile_counts                                                                                   
*copyc qfp$get_qfile_status                                                                                   
*copyc qfp$purge_expired_queue_file                                                                           
*copyc qfp$purge_processed_queue_file                                                                         
*copyc qfp$read_qfile_system_label                                                                            
*copyc qfp$rebuild_generic_queue                                                                              
*copyc qfp$register_qfile_application                                                                         
*copyc qfp$release_generic_queue_files                                                                        
*copyc qfp$set_qfile_completed                                                                                
*copyc qfp$set_qfile_initiated                                                                                
*copyc qfp$submit_qfile                                                                                       
*copyc qfp$terminate_acquired_qfile                                                                           
*copyc qfp$terminate_qfile                                                                                    
*copyc qfp$validate_qfile_access                                                                              
*copyc qfp$write_qfile_system_label                                                                           
*copyc syp$system_is_idling                                                                                   
*copyc amv$nil_file_identifier                                                                                
*copyc jmv$default_job_attributes                                                                             
*copyc jmv$job_attributes                                                                                     
*copyc jmv$job_management_work_area_p                                                                         
*copyc jmv$known_qfile_list                                                                                   
*copyc jmv$last_used_application_index                                                                        
*copyc osv$lower_to_upper                                                                                     
*copyc i#current_sequence_position                                                                            
*copyc i#move                                                                                                 
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'Global Declarations Declared by this Module', EJECT ??                                        
                                                                                                              
{ These constants are used as parameters in error messages.                                                   
                                                                                                              
  CONST                                                                                                       
    jmc$change_qfile_attributes = 'JMP$CHANGE_QFILE_ATTRIBUTES',                                              
    jmc$submit_qfile = 'JMP$SUBMIT_QFILE',                                                                    
    jmc$terminate_qfile = 'JMP$TERMINATE_QFILE',                                                              
    jmc$update_qfile_status = 'JMP$UPDATE_QFILE_STATUS';                                                      
                                                                                                              
  TYPE                                                                                                        
    t$mainframe_chaqa_parameters = record                                                                     
      privileged_job: boolean,                                                                                
      system_file_name: jmt$system_supplied_name,                                                             
      application_name: ost$name,                                                                             
      attribute_change_count: ost$non_negative_integers,                                                      
    recend;                                                                                                   
                                                                                                              
  TYPE                                                                                                        
    t$mainframe_getqa_parameters = record                                                                     
      status_option_count: ost$non_negative_integers,                                                         
      attach_file: boolean,                                                                                   
      get_application_attributes: boolean,                                                                    
      results_keys_count: ost$non_negative_integers,                                                          
    recend;                                                                                                   
                                                                                                              
  TYPE                                                                                                        
    t$mainframe_getqs_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                                                                                                        
    t$mainframe_terq_parameters = record                                                                      
      system_file_name: jmt$system_supplied_name,                                                             
      qfile_state_set: jmt$qfile_state_set,                                                                   
    recend;                                                                                                   
                                                                                                              
  TYPE                                                                                                        
    t$qfile_appl_attribute_choices = array [jmc$application_attributes_1 .. jmc$application_attributes_10] of 
          record                                                                                              
      key: jmt$attribute_keys,                                                                                
      application_attributes: jmt$qfile_application_attrs,                                                    
    recend;                                                                                                   
                                                                                                              
  VAR                                                                                                         
    task_has_registered_application: [STATIC, oss$task_private] boolean := FALSE;                             
                                                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'acquire_qfile', EJECT ??                                                                      
                                                                                                              
  PROCEDURE acquire_qfile                                                                                     
    (    application_name: ost$name;                                                                          
         new_qfile: boolean;                                                                                  
         attribute_keys_p: ^jmt$results_keys;                                                                 
     VAR attribute_work_area_p: ^jmt$work_area;                                                               
     VAR attribute_results_p: ^jmt$qfile_attribute_results;                                                   
     VAR system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      attribute_options_p: ^jmt$qfile_attribute_options,                                                      
      number_of_qfiles_found: jmt$qfile_status_count;                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    IF syp$system_is_idling () THEN                                                                           
      osp$set_status_condition (jme$generic_queue_is_empty, status);                                          
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
{ Acquire the file                                                                                            
    IF new_qfile THEN                                                                                         
      qfp$acquire_new_qfile (application_name, system_file_name, status);                                     
    ELSE                                                                                                      
      qfp$acquire_modified_qfile (application_name, system_file_name, status);                                
    IFEND;                                                                                                    
    IF NOT status.normal THEN                                                                                 
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
{ Set up parameters for call to jmp$get_qfile_attributes.                                                     
    IF attribute_work_area_p <> NIL THEN                                                                      
      PUSH attribute_options_p: [1 .. 1];                                                                     
      attribute_options_p^ [1].key := jmc$system_supplied_name_list;                                          
      PUSH attribute_options_p^ [1].system_supplied_name_list: [1 .. 1];                                      
      attribute_options_p^ [1].system_supplied_name_list^ [1] := system_file_name;                            
                                                                                                              
      jmp$get_qfile_attributes (attribute_options_p, attribute_keys_p, attribute_work_area_p,                 
            attribute_results_p, number_of_qfiles_found, status);                                             
    IFEND;                                                                                                    
                                                                                                              
  PROCEND acquire_qfile;                                                                                      
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[INLINE] determine_file_path', EJECT ??                                                       
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this request is to PUSH the correct path name for a queue file on the requester's          
{ stack.                                                                                                      
{                                                                                                             
{ NOTES:                                                                                                      
{   This procedure MUST be INLINE.                                                                            
                                                                                                              
  PROCEDURE [INLINE] determine_file_path                                                                      
    (    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;                                                                           
    path_p^ [3] := jmc$generic_queue_catalog;                                                                 
    path_p^ [4] := system_file_name;                                                                          
                                                                                                              
  PROCEND determine_file_path;                                                                                
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'pack_application_attributes', EJECT ??                                                        
                                                                                                              
{ PURPOSE:                                                                                                    
{     The purpose of this procedure is to take an array of application attributes                             
{ and pack it into the form expected in the queue file system label. It also                                  
{ calculates the total amount of space needed for the application attributes field                            
{ in the system label.                                                                                        
                                                                                                              
  PROCEDURE pack_application_attributes                                                                       
    (    qfile_appl_attribute_choices_p: ^t$qfile_appl_attribute_choices;                                     
         system_label_p {input, output} : ^jmt$qfile_system_label;                                            
     VAR total_size: jmt$qsl_appl_attr_contents_size;                                                         
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      attribute_index: integer,                                                                               
      attributes_p: ^SEQ ( * ),                                                                               
      key_p: ^jmt$attribute_keys,                                                                             
      local_total_size: integer,                                                                              
      qsl_appl_attr_contents_p: ^jmt$qsl_appl_attr_contents,                                                  
      size_p: ^jmt$qfile_appl_attr_size;                                                                      
                                                                                                              
    status.normal := TRUE;                                                                                    
    local_total_size := 0;                                                                                    
    total_size := 0;                                                                                          
    qsl_appl_attr_contents_p := ^system_label_p^.application_attributes;                                      
    RESET qsl_appl_attr_contents_p;                                                                           
                                                                                                              
{Check if the total amount of application attributes exceeds the maximum size.                                
    FOR attribute_index := jmc$application_attributes_1 TO jmc$application_attributes_10 DO                   
      total_size := total_size + qfile_appl_attribute_choices_p^ [attribute_index].application_attributes.    
            size;                                                                                             
    FOREND;                                                                                                   
                                                                                                              
    IF total_size > jmc$max_qfile_appl_attr_size THEN                                                         
      osp$set_status_condition (jme$appl_attr_size_exceeds_max, status);                                      
      osp$append_status_integer (osc$status_parameter_delimiter, total_size, 10, FALSE, status);              
      osp$append_status_integer (osc$status_parameter_delimiter, jmc$max_qfile_appl_attr_size, 10, FALSE,     
            status);                                                                                          
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    FOR attribute_index := jmc$application_attributes_1 TO jmc$application_attributes_10 DO                   
      NEXT key_p IN qsl_appl_attr_contents_p;                                                                 
      IF key_p = NIL THEN                                                                                     
        osp$set_status_condition (jme$system_label_internal_error, status);                                   
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
      key_p^ := qfile_appl_attribute_choices_p^ [attribute_index].key;                                        
      NEXT size_p IN qsl_appl_attr_contents_p;                                                                
      IF size_p = NIL THEN                                                                                    
        osp$set_status_condition (jme$system_label_internal_error, status);                                   
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
      size_p^ := qfile_appl_attribute_choices_p^ [attribute_index].application_attributes.size;               
      IF qfile_appl_attribute_choices_p^ [attribute_index].application_attributes.size > 0 THEN               
        NEXT attributes_p: [[REP size_p^ OF cell]] IN qsl_appl_attr_contents_p;                               
        IF attributes_p = NIL THEN                                                                            
          osp$set_status_condition (jme$system_label_internal_error, status);                                 
          RETURN; {----->                                                                                     
        IFEND;                                                                                                
        i#move (qfile_appl_attribute_choices_p^ [attribute_index].application_attributes.attributes_p,        
              attributes_p, size_p^);                                                                         
      IFEND;                                                                                                  
    FOREND;                                                                                                   
    total_size := i#current_sequence_position (qsl_appl_attr_contents_p);                                     
                                                                                                              
  PROCEND pack_application_attributes;                                                                        
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'unpack_application_attributes', EJECT ??                                                      
                                                                                                              
{ PURPOSE:                                                                                                    
{     The purpose of this procedure is to unpack the application attributes from the system label             
{ into an array.                                                                                              
                                                                                                              
  PROCEDURE unpack_application_attributes                                                                     
    (    system_label_p: ^jmt$qfile_system_label;                                                             
         attribute_choices_p {input, output} : ^t$qfile_appl_attribute_choices;                               
     VAR attribute_work_area_p: ^jmt$work_area;                                                               
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      application_attributes_p: ^SEQ ( * ),                                                                   
      appl_attr_work_area_p: ^jmt$work_area,                                                                  
      attribute_index: integer,                                                                               
      key_p: ^jmt$attribute_keys,                                                                             
      qsl_appl_attr_contents_p: ^jmt$qsl_appl_attr_contents,                                                  
      size_p: ^jmt$qfile_appl_attr_size;                                                                      
                                                                                                              
    status.normal := TRUE;                                                                                    
    IF attribute_choices_p <> NIL THEN                                                                        
      FOR attribute_index := jmc$application_attributes_1 TO jmc$application_attributes_10 DO                 
        attribute_choices_p^ [attribute_index].key := attribute_index;                                        
        attribute_choices_p^ [attribute_index].application_attributes.size := 0;                              
        attribute_choices_p^ [attribute_index].application_attributes.attributes_p := NIL;                    
      FOREND;                                                                                                 
      RESET attribute_work_area_p;                                                                            
                                                                                                              
      qsl_appl_attr_contents_p := ^system_label_p^.application_attributes;                                    
      RESET qsl_appl_attr_contents_p;                                                                         
      FOR attribute_index := jmc$application_attributes_1 TO jmc$application_attributes_10 DO                 
        NEXT key_p IN qsl_appl_attr_contents_p;                                                               
        IF key_p <> NIL THEN                                                                                  
          NEXT size_p IN qsl_appl_attr_contents_p;                                                            
          IF size_p <> NIL THEN                                                                               
            IF size_p^ > 0 THEN                                                                               
              NEXT application_attributes_p: [[REP size_p^ OF cell]] IN qsl_appl_attr_contents_p;             
              NEXT appl_attr_work_area_p: [[REP size_p^ OF cell]] IN attribute_work_area_p;                   
              IF application_attributes_p <> NIL THEN                                                         
                attribute_choices_p^ [key_p^].application_attributes.size := size_p^;                         
                i#move (application_attributes_p, appl_attr_work_area_p, size_p^);                            
                attribute_choices_p^ [key_p^].application_attributes.attributes_p := appl_attr_work_area_p;   
              ELSE                                                                                            
                osp$set_status_condition (jme$system_label_internal_error, status);                           
                RETURN; {----->                                                                               
              IFEND;                                                                                          
            IFEND;                                                                                            
          ELSE                                                                                                
            osp$set_status_condition (jme$system_label_internal_error, status);                               
            RETURN; {----->                                                                                   
          IFEND;                                                                                              
        ELSE                                                                                                  
          osp$set_status_condition (jme$system_label_internal_error, status);                                 
          RETURN; {----->                                                                                     
        IFEND;                                                                                                
      FOREND;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
  PROCEND unpack_application_attributes;                                                                      
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$acquire_modified_qfile', EJECT ??                                           
*copy jmh$acquire_modified_qfile                                                                              
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$acquire_modified_qfile                                                          
    (    application_name: ost$name;                                                                          
         attribute_keys_p: ^jmt$results_keys;                                                                 
     VAR attribute_work_area_p: ^jmt$work_area;                                                               
     VAR attribute_results_p: ^jmt$qfile_attribute_results;                                                   
     VAR system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    acquire_qfile (application_name, { new_qfile } FALSE, attribute_keys_p, attribute_work_area_p,            
          attribute_results_p, system_file_name, status);                                                     
                                                                                                              
  PROCEND jmp$acquire_modified_qfile;                                                                         
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$acquire_new_qfile', EJECT ??                                                
*copy jmh$acquire_new_qfile                                                                                   
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$acquire_new_qfile                                                               
    (    application_name: ost$name;                                                                          
         attribute_keys_p: ^jmt$results_keys;                                                                 
     VAR attribute_work_area_p: ^jmt$work_area;                                                               
     VAR attribute_results_p: ^jmt$qfile_attribute_results;                                                   
     VAR system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    acquire_qfile (application_name, { new_qfile } TRUE, attribute_keys_p, attribute_work_area_p,             
          attribute_results_p, system_file_name, status);                                                     
                                                                                                              
  PROCEND jmp$acquire_new_qfile;                                                                              
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$change_qfile_attributes', EJECT ??                                          
*copy jmh$change_qfile_attributes                                                                             
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$change_qfile_attributes                                                         
    (    system_file_name: jmt$system_supplied_name;                                                          
         attribute_changes_p: ^jmt$qfile_attribute_changes;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    CONST                                                                                                     
      c$system_file_name = 1,                                                                                 
      c$qfile_state = 2,                                                                                      
      c$application_name = 3,                                                                                 
      c$client_mainframe_id = 4;                                                                              
                                                                                                              
    VAR                                                                                                       
      change_index: integer,                                                                                  
      ignore_status: ost$status,                                                                              
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_application_attributes_p: ^string ( * ),                                                          
      local_application_status_p: ^ost$status,                                                                
      local_attribute_changes_p: ^jmt$qfile_attribute_changes,                                                
      local_parameters_p: ^t$mainframe_chaqa_parameters,                                                      
      local_purge_delay_p: ^jmt$time_increment,                                                               
      local_remote_host_directive_p: ^jmt$remote_host_directive,                                              
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      number_of_data_packets: ost$non_negative_integers,                                                      
      number_of_qfiles_found: jmt$qfile_status_count,                                                         
      privileged_job: boolean,                                                                                
      qfile_status_options_p: ^jmt$qfile_status_options,                                                      
      qfile_status_results_keys_p: ^jmt$results_keys,                                                         
      qfile_status_results_p: ^jmt$qfile_status_results,                                                      
      rerun_disposition: jmt$rerun_disposition,                                                               
      scl_name: ost$name,                                                                                     
      scratch_segment: amt$segment_pointer,                                                                   
      size_of_sequence: ost$segment_length,                                                                   
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * ),                                                                           
      target_options_size: ost$non_negative_integers,                                                         
      valid_name: boolean,                                                                                    
      work_area_p: ^jmt$work_area;                                                                            
                                                                                                              
?? NEWTITLE := 'condition_handler', EJECT ??                                                                  
                                                                                                              
    PROCEDURE block_exit_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 =                                                                           
        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 block_exit_handler;                                                                               
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
    ignore_status.normal := TRUE;                                                                             
    status.normal := TRUE;                                                                                    
                                                                                                              
    privileged_job := avp$system_operator ();                                                                 
                                                                                                              
    PUSH qfile_status_options_p: [1 .. 3];                                                                    
    qfile_status_options_p^ [1].key := jmc$system_supplied_name_list;                                         
    PUSH qfile_status_options_p^ [1].system_supplied_name_list: [1 .. 1];                                     
    qfile_status_options_p^ [1].system_supplied_name_list^ [1] := system_file_name;                           
    qfile_status_options_p^ [2].key := jmc$privilege;                                                         
    IF privileged_job THEN                                                                                    
      qfile_status_options_p^ [2].privilege := jmc$privileged;                                                
    ELSE                                                                                                      
      qfile_status_options_p^ [2].privilege := jmc$not_privileged;                                            
    IFEND;                                                                                                    
    qfile_status_options_p^ [3].key := jmc$continue_request_to_servers;                                       
    qfile_status_options_p^ [3].continue_request_to_servers := TRUE;                                          
                                                                                                              
    PUSH qfile_status_results_keys_p: [c$system_file_name .. c$client_mainframe_id];                          
    qfile_status_results_keys_p^ [c$system_file_name] := jmc$system_file_name;                                
    qfile_status_results_keys_p^ [c$qfile_state] := jmc$qfile_state;                                          
    qfile_status_results_keys_p^ [c$application_name] := jmc$application_name;                                
    qfile_status_results_keys_p^ [c$client_mainframe_id] := jmc$client_mainframe_id;                          
                                                                                                              
    jmp$get_result_size ({number of files} 1, #SEQ (qfile_status_results_keys_p^), size_of_sequence);         
    PUSH work_area_p: [[REP size_of_sequence OF cell]];                                                       
                                                                                                              
    jmp$get_qfile_status (qfile_status_options_p, qfile_status_results_keys_p, work_area_p,                   
          qfile_status_results_p, number_of_qfiles_found, status);                                            
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$no_qfiles_were_found THEN                                                     
        osp$set_status_abnormal (jmc$job_management_id, jme$name_not_found, system_file_name, status);        
      IFEND;                                                                                                  
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    IF number_of_qfiles_found > 1 THEN                                                                        
      osp$set_status_abnormal (jmc$job_management_id, jme$duplicate_name, system_file_name, status);          
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    IF qfile_status_results_p^ [1]^ [c$qfile_state].qfile_state IN $jmt$qfile_state_set                       
          [jmc$initiated_qfile, jmc$terminated_qfile] THEN                                                    
                                                                                                              
{ In order for the queue file state to be terminated, the file is either being processed or the application   
{ responsible for the file will momentarily return the file to queue file management.  In any case,           
{ the same error (jme$qfile_is_initiated) is reported since the later is not likely to occur.                 
                                                                                                              
      osp$set_status_abnormal (jmc$job_management_id, jme$qfile_is_initiated, system_file_name, status);      
      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 (^block_exit_handler);                                                     
                                                                                                              
    NEXT local_parameters_p IN scratch_segment.sequence_pointer;                                              
                                                                                                              
    local_parameters_p^.privileged_job := privileged_job;                                                     
    local_parameters_p^.system_file_name := qfile_status_results_p^ [1]^ [c$system_file_name].                
          system_file_name;                                                                                   
    local_parameters_p^.application_name := qfile_status_results_p^ [1]^ [c$application_name].                
          application_name;                                                                                   
                                                                                                              
    IF attribute_changes_p = NIL THEN                                                                         
      local_parameters_p^.attribute_change_count := 0;                                                        
    ELSE                                                                                                      
      local_parameters_p^.attribute_change_count := UPPERBOUND (attribute_changes_p^);                        
      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 (attribute_changes_p^) DO                                         
          local_attribute_changes_p^ [change_index].key := attribute_changes_p^ [change_index].key;           
                                                                                                              
          CASE attribute_changes_p^ [change_index].key OF                                                     
          = jmc$application_attributes_1, jmc$application_attributes_2, jmc$application_attributes_3,         
                jmc$application_attributes_4, jmc$application_attributes_5, jmc$application_attributes_6,     
                jmc$application_attributes_7, jmc$application_attributes_8, jmc$application_attributes_9,     
                jmc$application_attributes_10 =                                                               
                                                                                                              
            local_attribute_changes_p^ [change_index].application_attributes.size :=                          
                  attribute_changes_p^ [change_index].application_attributes.size;                            
            NEXT local_application_attributes_p: [attribute_changes_p^ [change_index].application_attributes. 
                  size] IN scratch_segment.sequence_pointer;                                                  
            IF local_application_attributes_p = NIL THEN                                                      
              osp$set_status_condition (jme$internal_work_area_overflow, status);                             
              EXIT /validate_changes/; {----->                                                                
            IFEND;                                                                                            
                                                                                                              
            i#move (attribute_changes_p^ [change_index].application_attributes.attributes_p,                  
                  local_application_attributes_p, attribute_changes_p^ [change_index].application_attributes. 
                  size);                                                                                      
                                                                                                              
          = jmc$application_status =                                                                          
            NEXT local_application_status_p IN scratch_segment.sequence_pointer;                              
            IF local_application_status_p = NIL THEN                                                          
              osp$set_status_condition (jme$internal_work_area_overflow, status);                             
              EXIT /validate_changes/; {----->                                                                
            IFEND;                                                                                            
            IF attribute_changes_p^ [change_index].application_status = NIL THEN                              
              local_application_status_p^.normal := TRUE;                                                     
            ELSE                                                                                              
              local_application_status_p^ := attribute_changes_p^ [change_index].application_status^;         
            IFEND;                                                                                            
                                                                                                              
          = jmc$deferred_by_operator =                                                                        
            IF NOT privileged_job THEN                                                                        
              osp$set_status_abnormal (jmc$job_management_id, jme$requires_operator_privilege,                
                    'DEFERRED_BY_OPERATOR', status);                                                          
              EXIT /validate_changes/; {----->                                                                
            IFEND;                                                                                            
            local_attribute_changes_p^ [change_index].deferred_by_operator :=                                 
                  attribute_changes_p^ [change_index].deferred_by_operator;                                   
                                                                                                              
          = jmc$deferred_by_application =                                                                     
            local_attribute_changes_p^ [change_index].deferred_by_application :=                              
                  attribute_changes_p^ [change_index].deferred_by_application;                                
                                                                                                              
          = jmc$deferred_by_user =                                                                            
            local_attribute_changes_p^ [change_index].deferred_by_user :=                                     
                  attribute_changes_p^ [change_index].deferred_by_user;                                       
                                                                                                              
          = jmc$destination =                                                                                 
            clp$validate_name (attribute_changes_p^ [change_index].destination, scl_name, valid_name);        
            IF valid_name THEN                                                                                
              local_attribute_changes_p^ [change_index].destination := scl_name;                              
            ELSE                                                                                              
              #TRANSLATE (osv$lower_to_upper, attribute_changes_p^ [change_index].destination,                
                    local_attribute_changes_p^ [change_index].destination);                                   
            IFEND;                                                                                            
                                                                                                              
          = jmc$earliest_run_time =                                                                           
            local_attribute_changes_p^ [change_index].earliest_run_time :=                                    
                  attribute_changes_p^ [change_index].earliest_run_time;                                      
                                                                                                              
          = jmc$latest_run_time =                                                                             
            local_attribute_changes_p^ [change_index].latest_run_time :=                                      
                  attribute_changes_p^ [change_index].latest_run_time;                                        
                                                                                                              
          = jmc$null_attribute =                                                                              
            ;                                                                                                 
                                                                                                              
          = jmc$purge_delay =                                                                                 
                                                                                                              
{ If the purge delay has changed, the disposition time has changed.                                           
            NEXT local_purge_delay_p IN scratch_segment.sequence_pointer;                                     
            IF local_purge_delay_p = NIL THEN                                                                 
              osp$set_status_condition (jme$internal_work_area_overflow, status);                             
              EXIT /validate_changes/; {----->                                                                
            IFEND;                                                                                            
            local_purge_delay_p^ := attribute_changes_p^ [change_index].purge_delay^;                         
                                                                                                              
          = jmc$remote_host_directive =                                                                       
            NEXT local_remote_host_directive_p IN scratch_segment.sequence_pointer;                           
            IF local_remote_host_directive_p = NIL THEN                                                       
              osp$set_status_condition (jme$internal_work_area_overflow, status);                             
              EXIT /validate_changes/; {----->                                                                
            IFEND;                                                                                            
            local_remote_host_directive_p^ := attribute_changes_p^ [change_index].remote_host_directive^;     
                                                                                                              
          = jmc$rerun_disposition =                                                                           
            local_attribute_changes_p^ [change_index].rerun_disposition :=                                    
                  attribute_changes_p^ [change_index].rerun_disposition;                                      
                                                                                                              
          ELSE                                                                                                
            jmp$get_attribute_name (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, 'QFILE_ATTRIBUTE_CHANGES', status);  
            osp$append_status_parameter (osc$status_parameter_delimiter, jmc$change_qfile_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 qfile 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 (qfile_status_results_p^ [1]^ [c$client_mainframe_id].client_mainframe_id,
          jmc$gpro_change_qfile_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_qfile_attributes;                                                                        
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$close_qfile', EJECT ??                                                      
*copy jmh$close_qfile                                                                                         
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$close_qfile                                                                     
    (    file_identifier: amt$file_identifier;                                                                
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    fsp$close_file (file_identifier, status);                                                                 
                                                                                                              
  PROCEND jmp$close_qfile;                                                                                    
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$get_qfile_attributes', EJECT ??                                             
*copy jmh$get_qfile_attributes                                                                                
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$get_qfile_attributes                                                            
    (    attribute_options_p: ^jmt$qfile_attribute_options;                                                   
         attribute_results_keys_p: ^jmt$results_keys;                                                         
     VAR attribute_work_area_p: ^jmt$work_area;                                                               
     VAR attribute_results_p: ^jmt$qfile_attribute_results;                                                   
     VAR number_of_qfiles_found: jmt$qfile_status_count;                                                      
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      continue_request_to_servers: boolean,                                                                   
      ignore_status: ost$status,                                                                              
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_parameters_p: ^t$mainframe_getqa_parameters,                                                      
      local_results_keys_p: ^jmt$results_keys,                                                                
      local_status_keys_p: ^jmt$results_keys,                                                                 
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      number_of_data_packets: ost$non_negative_integers,                                                      
      option_index: integer,                                                                                  
      privileged_job: boolean,                                                                                
      qfile_status_options_p: ^jmt$qfile_status_options,                                                      
      result_element_size: ost$segment_length,                                                                
      result_index: integer,                                                                                  
      save_work_area_p: ^jmt$work_area,                                                                       
      scl_name: ost$name,                                                                                     
      scratch_segment: amt$segment_pointer,                                                                   
      status_option_count: ost$non_negative_integers,                                                         
      target_mainframe_id: pmt$mainframe_id,                                                                  
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * ),                                                                           
      target_options_size: ost$non_negative_integers;                                                         
                                                                                                              
?? 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);                                            
      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;                                                                             
    number_of_qfiles_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);                                                      
                                                                                                              
  /get_attributes/                                                                                            
    BEGIN                                                                                                     
      NEXT local_parameters_p IN scratch_segment.sequence_pointer;                                            
      local_parameters_p^.attach_file := FALSE;                                                               
      local_parameters_p^.get_application_attributes := FALSE;                                                
                                                                                                              
      IF attribute_options_p = NIL THEN                                                                       
        local_parameters_p^.status_option_count := 2;                                                         
        NEXT qfile_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_qfile_attributes, 'QFILE_ATTRIBUTE_OPTIONS',                  
              #SEQ (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                                                                             
          EXIT /get_attributes/; {----->                                                                      
        IFEND;                                                                                                
                                                                                                              
        NEXT qfile_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;                                                                                                  
                                                                                                              
      qfile_status_options_p^ [option_index].key := jmc$privilege;                                            
      IF privileged_job THEN                                                                                  
        qfile_status_options_p^ [option_index].privilege := jmc$privileged;                                   
      ELSE                                                                                                    
        qfile_status_options_p^ [option_index].privilege := jmc$not_privileged;                               
      IFEND;                                                                                                  
      qfile_status_options_p^ [option_index + 1].key := jmc$user_identification;                              
      NEXT qfile_status_options_p^ [option_index + 1].user_identification IN scratch_segment.sequence_pointer;
      pmp$get_user_identification (qfile_status_options_p^ [option_index + 1].user_identification^,           
            ignore_status);                                                                                   
                                                                                                              
{ Verify that result is only asking for valid fields                                                          
      IF 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 (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^ := attribute_results_keys_p^;                                                   
        local_status_keys_p^ := 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$application_attributes_1, jmc$application_attributes_2, jmc$application_attributes_3,         
                jmc$application_attributes_4, jmc$application_attributes_5, jmc$application_attributes_6,     
                jmc$application_attributes_7, jmc$application_attributes_8, jmc$application_attributes_9,     
                jmc$application_attributes_10 =                                                               
            local_parameters_p^.get_application_attributes := TRUE;                                           
            local_parameters_p^.attach_file := TRUE;                                                          
            local_status_keys_p^ [result_index] := jmc$null_attribute;                                        
                                                                                                              
          = jmc$application_status, jmc$data_mode, jmc$destination, jmc$earliest_run_time,                    
                jmc$latest_run_time, jmc$purge_delay, jmc$remote_host_directive =                             
            local_parameters_p^.attach_file := TRUE;                                                          
            local_status_keys_p^ [result_index] := jmc$null_attribute;                                        
                                                                                                              
          = jmc$application_name, jmc$control_family, jmc$control_user, jmc$deferred_by_application,          
                jmc$deferred_by_operator, jmc$deferred_by_user, jmc$login_family, jmc$login_user,             
                jmc$qfile_state, jmc$system_file_name =                                                       
                                                                                                              
{ These attributes can be obtained from jmp$get_qfile_status.                                                 
            ;                                                                                                 
                                                                                                              
          = jmc$null_attribute =                                                                              
            ;                                                                                                 
          ELSE                                                                                                
            jmp$get_attribute_name (attribute_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, 'ATTRIBUTE_RESULTS_KEYS_P', status); 
            osp$append_status_parameter (osc$status_parameter_delimiter, jmc$get_qfile_attributes, status);   
            EXIT /get_attributes/; {----->                                                                    
          CASEND;                                                                                             
        FOREND; { result index                                                                                
      IFEND;                                                                                                  
                                                                                                              
      jmp$get_data_packet_size (local_results_keys_p, result_element_size, status);                           
      IF NOT status.normal THEN                                                                               
        EXIT /get_attributes/; {----->                                                                        
      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_qfile_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_qfiles_found := number_of_data_packets;                                                   
        IFEND;                                                                                                
        EXIT /get_attributes/; {----->                                                                        
      IFEND;                                                                                                  
                                                                                                              
      number_of_qfiles_found := number_of_data_packets;                                                       
      IF number_of_qfiles_found = 0 THEN                                                                      
        osp$set_status_condition (jme$no_qfiles_were_found, status);                                          
      ELSEIF attribute_results_keys_p <> NIL THEN                                                             
        RESET jm_work_area_p;                                                                                 
        save_work_area_p := attribute_work_area_p;                                                            
        jmp$copy_seq_to_result_array (UPPERBOUND (attribute_results_keys_p^), number_of_qfiles_found,         
              attribute_results_keys_p, jm_work_area_p, attribute_work_area_p, status);                       
        NEXT attribute_results_p: [1 .. number_of_qfiles_found] IN save_work_area_p;                          
      IFEND;                                                                                                  
    END /get_attributes/;                                                                                     
                                                                                                              
    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_qfile_attributes;                                                                           
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$get_qfile_counts', EJECT ??                                                 
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$get_qfile_counts                                                                
    (VAR qfile_counts: jmt$qfile_counts;                                                                      
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
    qfp$get_qfile_counts (qfile_counts, status);                                                              
                                                                                                              
  PROCEND jmp$get_qfile_counts;                                                                               
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$get_qfile_status', EJECT ??                                                 
*copy jmh$get_qfile_status                                                                                    
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$get_qfile_status                                                                
    (    status_options_p: ^jmt$qfile_status_options;                                                         
         status_results_keys_p: ^jmt$results_keys;                                                            
     VAR status_work_area_p: ^jmt$work_area;                                                                  
     VAR status_results_p: ^jmt$qfile_status_results;                                                         
     VAR number_of_qfiles_found: jmt$qfile_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,                                                                   
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_parameters_p: ^t$mainframe_getqs_parameters,                                                      
      local_status_results_keys_p: ^jmt$results_keys,                                                         
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      number_of_data_packets: ost$non_negative_integers,                                                      
      options_p: ^SEQ ( * ),                                                                                  
      options_size: ost$non_negative_integers,                                                                
      result_index: integer,                                                                                  
      save_work_area_p: ^jmt$work_area,                                                                       
      scl_name: ost$name,                                                                                     
      seq_qfile_status_results_size: ost$segment_length,                                                      
      target_mainframe_id: pmt$mainframe_id,                                                                  
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * );                                                                           
                                                                                                              
    #CALLER_ID (caller_id);                                                                                   
    status.normal := TRUE;                                                                                    
    number_of_qfiles_found := 0;                                                                              
    continue_request_to_servers := FALSE;                                                                     
    jm_work_area_p := NIL;                                                                                    
                                                                                                              
    IF status_work_area_p <> NIL THEN                                                                         
      IF (jmv$job_management_work_area_p = NIL) AND (#SIZE (status_work_area_p^) <=                           
            bytes_that_can_be_pushed) THEN                                                                    
        PUSH jm_work_area_p: [[REP #SIZE (status_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;                                                              
    local_parameters_p^.privileged_job := avp$system_operator () OR avp$system_displays ();                   
                                                                                                              
    pmp$get_user_identification (local_parameters_p^.user_identification, status);                            
    IF NOT status.normal THEN                                                                                 
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    IF 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_qfile_status, 'STATUS_OPTIONS_P', #SEQ (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;                                                                                                    
                                                                                                              
    IF status_results_keys_p = NIL THEN                                                                       
      local_parameters_p^.status_results_count := 0;                                                          
      seq_qfile_status_results_size := 0;                                                                     
    ELSE                                                                                                      
      local_parameters_p^.status_results_count := UPPERBOUND (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^ := 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$application_name, jmc$client_mainframe_id, jmc$control_family, jmc$control_user,                
              jmc$deferred_by_application, jmc$deferred_by_operator, jmc$deferred_by_user, jmc$login_family,  
              jmc$login_user, jmc$null_attribute, jmc$qfile_state, jmc$system_file_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, 'STATUS_RESULTS_KEYS_P', status);      
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$get_qfile_status, status);         
          RETURN; {----->                                                                                     
        CASEND;                                                                                               
      FOREND;                                                                                                 
                                                                                                              
      jmp$get_data_packet_size (local_status_results_keys_p, seq_qfile_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, status);                                                     
      status.normal := TRUE; {ignore_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_qfile_status,                          
          {data_packet_size} seq_qfile_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_qfiles_found := number_of_data_packets;                                                     
      IFEND;                                                                                                  
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    number_of_qfiles_found := number_of_data_packets;                                                         
    IF number_of_qfiles_found = 0 THEN                                                                        
      osp$set_status_condition (jme$no_qfiles_were_found, status);                                            
    ELSEIF (status_results_keys_p <> NIL) THEN                                                                
      RESET jm_work_area_p;                                                                                   
      save_work_area_p := status_work_area_p;                                                                 
      jmp$copy_seq_to_result_array (UPPERBOUND (status_results_keys_p^), number_of_qfiles_found,              
            status_results_keys_p, jm_work_area_p, status_work_area_p, status);                               
      NEXT status_results_p: [1 .. number_of_qfiles_found] IN save_work_area_p;                               
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$get_qfile_status;                                                                               
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[xdcl, #gate] JMP$MAINFRAME_CHANGE_QFILE_ATTR', EJECT ??                                      
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$mainframe_change_qfile_attr                                                     
    (    target_options_p: ^SEQ ( * );                                                                        
     VAR data_area_p: {input, output} ^SEQ ( * );                                                             
     VAR number_of_data_packets: ost$non_negative_integers;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    TYPE                                                                                                      
      t$attachment_phase = (c$not_attached, c$in_attach, c$attached, c$in_purge);                             
                                                                                                              
    VAR                                                                                                       
      attachment_phase: t$attachment_phase,                                                                   
      attribute_work_area_p: ^jmt$work_area,                                                                  
      attribute_change_p: ^jmt$qfile_attribute_change,                                                        
      attributes_size: jmt$qsl_appl_attr_contents_size,                                                       
      change_index: integer,                                                                                  
      current_date_time: ost$date_time,                                                                       
      current_microsecond_clock: jmt$clock_time,                                                              
      cycle_selector: pft$cycle_selector,                                                                     
      date_time: ost$date_time,                                                                               
      delete_qfile: boolean,                                                                                  
      earliest_clock_time_to_process: jmt$clock_time,                                                         
      ignore_status: ost$status,                                                                              
      latest_clock_time_to_process: jmt$clock_time,                                                           
      local_application_attributes_p: ^string ( * ),                                                          
      local_application_status_p: ^ost$status,                                                                
      local_attribute_changes_p: ^jmt$qfile_attribute_changes,                                                
      local_file_name: amt$local_file_name,                                                                   
      local_parameters_p: ^t$mainframe_chaqa_parameters,                                                      
      local_purge_delay_p: ^jmt$time_increment,                                                               
      local_remote_host_directive_p: ^jmt$remote_host_directive,                                              
      old_appl_attributes_p: ^t$qfile_appl_attribute_choices,                                                 
      options_p: ^SEQ ( * ),                                                                                  
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      purge_delay_clock_time: jmt$clock_time,                                                                 
      rerun_disposition: jmt$rerun_disposition,                                                               
      scl_name: ost$name,                                                                                     
      share_selections: pft$share_selections,                                                                 
      system_label: jmt$qfile_system_label,                                                                   
      usage_selections: pft$usage_selections;                                                                 
                                                                                                              
?? 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);                                                                       
                                                                                                              
      TYPE                                                                                                    
        t$attachment_phases = set of t$attachment_phase;                                                      
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      #SPOIL (attachment_phase);                                                                              
      CASE condition.selector OF                                                                              
      = pmc$block_exit_processing =                                                                           
        IF attachment_phase IN $t$attachment_phases [c$in_attach, c$in_purge] THEN                            
          pfp$end_system_authority;                                                                           
        IFEND;                                                                                                
                                                                                                              
        IF attachment_phase IN $t$attachment_phases [c$attached, c$in_purge] THEN                             
          amp$return (local_file_name, ignore_status);                                                        
        IFEND;                                                                                                
                                                                                                              
        IF status.normal THEN                                                                                 
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
        IFEND;                                                                                                
                                                                                                              
      = ifc$interactive_condition =                                                                           
        IF attachment_phase = c$in_attach THEN                                                                
          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_qfile_attr; {----->                                                     
          IFEND;                                                                                              
        ELSE                                                                                                  
          pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                             
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                               
      CASEND;                                                                                                 
                                                                                                              
    PROCEND condition_handler;                                                                                
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
    ignore_status.normal := TRUE;                                                                             
    status.normal := TRUE;                                                                                    
    number_of_data_packets := 0;                                                                              
    attachment_phase := c$not_attached;                                                                       
    #SPOIL (attachment_phase);                                                                                
                                                                                                              
    pmp$get_compact_date_time (current_date_time, ignore_status);                                             
                                                                                                              
    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^.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);                                  
                                                                                                              
  /change_qfile_attributes/                                                                                   
    BEGIN                                                                                                     
      attachment_phase := c$in_attach;                                                                        
      #SPOIL (attachment_phase);                                                                              
      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;                                                                               
      IF NOT status.normal THEN                                                                               
        osp$disestablish_cond_handler;                                                                        
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
      attachment_phase := c$attached;                                                                         
      #SPOIL (attachment_phase);                                                                              
                                                                                                              
{ Read the queue file's system label                                                                          
      qfp$read_qfile_system_label (local_file_name, system_label, status);                                    
      IF NOT status.normal THEN                                                                               
        EXIT /change_qfile_attributes/ {----->                                                                
      IFEND;                                                                                                  
                                                                                                              
      rerun_disposition := jmc$rr_no_change;                                                                  
                                                                                                              
{ Check attribute changes and change the local copy of the system label                                       
      IF local_parameters_p^.attribute_change_count > 0 THEN                                                  
        PUSH old_appl_attributes_p;                                                                           
        PUSH attribute_work_area_p: [[REP jmc$max_qfile_appl_attr_size OF cell]];                             
        unpack_application_attributes (^system_label, old_appl_attributes_p, attribute_work_area_p, status);  
        IF NOT status.normal THEN                                                                             
          EXIT /change_qfile_attributes/ {----->                                                              
        IFEND;                                                                                                
                                                                                                              
        NEXT local_attribute_changes_p: [1 .. local_parameters_p^.attribute_change_count] IN options_p;       
                                                                                                              
      /process_changes/                                                                                       
        FOR change_index := 1 TO UPPERBOUND (local_attribute_changes_p^) DO                                   
          attribute_change_p := ^local_attribute_changes_p^ [change_index];                                   
          CASE attribute_change_p^.key OF                                                                     
          = jmc$application_attributes_1, jmc$application_attributes_2, jmc$application_attributes_3,         
                jmc$application_attributes_4, jmc$application_attributes_5, jmc$application_attributes_6,     
                jmc$application_attributes_7, jmc$application_attributes_8, jmc$application_attributes_9,     
                jmc$application_attributes_10 =                                                               
                                                                                                              
            NEXT local_application_attributes_p: [attribute_change_p^.application_attributes.size] IN         
                  options_p;                                                                                  
            old_appl_attributes_p^ [attribute_change_p^.key].application_attributes.size :=                   
                  attribute_change_p^.application_attributes.size;                                            
            old_appl_attributes_p^ [attribute_change_p^.key].application_attributes.attributes_p :=           
                  local_application_attributes_p;                                                             
                                                                                                              
          = jmc$application_status =                                                                          
            NEXT local_application_status_p IN options_p;                                                     
            system_label.application_status := local_application_status_p^;                                   
                                                                                                              
          = jmc$deferred_by_operator =                                                                        
            system_label.deferred_by_operator := attribute_change_p^.deferred_by_operator;                    
                                                                                                              
          = jmc$deferred_by_application =                                                                     
            system_label.deferred_by_application := attribute_change_p^.deferred_by_application;              
                                                                                                              
          = jmc$deferred_by_user =                                                                            
            system_label.deferred_by_user := attribute_change_p^.deferred_by_user;                            
                                                                                                              
          = jmc$destination =                                                                                 
            system_label.destination := attribute_change_p^.destination;                                      
                                                                                                              
          = jmc$earliest_run_time =                                                                           
            system_label.earliest_run_time := attribute_change_p^.earliest_run_time;                          
                                                                                                              
          = jmc$latest_run_time =                                                                             
            system_label.latest_run_time := attribute_change_p^.latest_run_time;                              
                                                                                                              
          = jmc$null_attribute =                                                                              
            ;                                                                                                 
                                                                                                              
          = jmc$purge_delay =                                                                                 
                                                                                                              
{ If the purge delay has changed, the disposition time has changed.                                           
            NEXT local_purge_delay_p IN options_p;                                                            
            system_label.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$rerun_disposition =                                                                           
            rerun_disposition := attribute_change_p^.rerun_disposition;                                       
                                                                                                              
          ELSE                                                                                                
            jmp$get_attribute_name (attribute_change_p^.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, 'QFILE_ATTRIBUTE_CHANGES', status);  
            osp$append_status_parameter (osc$status_parameter_delimiter, jmc$change_qfile_attributes, status);
            EXIT /process_changes/; {----->                                                                   
          CASEND;                                                                                             
        FOREND /process_changes/;                                                                             
        IF NOT status.normal THEN                                                                             
          EXIT /change_qfile_attributes/ {----->                                                              
        IFEND;                                                                                                
                                                                                                              
{ Update the application attributes.                                                                          
        pack_application_attributes (old_appl_attributes_p, ^system_label, attributes_size, status);          
        IF NOT status.normal THEN                                                                             
          EXIT /change_qfile_attributes/ {----->                                                              
        IFEND;                                                                                                
                                                                                                              
{ Calculate the earliest_run_time, latest_run_time and purge_delay if necessary.                              
        pmp$get_microsecond_clock (current_microsecond_clock, ignore_status);                                 
                                                                                                              
        IF system_label.earliest_run_time.specified THEN                                                      
          jmp$convert_date_time_dif_to_us (current_date_time, system_label.earliest_run_time.date_time,       
                current_microsecond_clock, earliest_clock_time_to_process);                                   
        ELSE                                                                                                  
          earliest_clock_time_to_process := jmc$earliest_clock_time;                                          
        IFEND;                                                                                                
                                                                                                              
        IF system_label.latest_run_time.specified THEN                                                        
          jmp$convert_date_time_dif_to_us (current_date_time, system_label.latest_run_time.date_time,         
                current_microsecond_clock, latest_clock_time_to_process);                                     
        ELSE                                                                                                  
          latest_clock_time_to_process := jmc$latest_clock_time;                                              
        IFEND;                                                                                                
                                                                                                              
{ If the file has been processed (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 disposition time is the current time .. so the net result                                 
{ is that no matter what time the file was processed, it will be purged according to the purge delay          
{ supplied.  If the purge_delay has not changed, the disposition time will be the previous                    
{ disposition time.  This value is typically the time at which the file was processed.                        
                                                                                                              
        IF system_label.purge_delay.specified AND system_label.disposition_time.specified THEN                
          pmp$compute_date_time (system_label.disposition_time.date_time,                                     
                system_label.purge_delay.time_increment, date_time, status);                                  
          IF NOT status.normal THEN                                                                           
            EXIT /change_qfile_attributes/ {----->                                                            
          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.disposition_time.specified AND (rerun_disposition = jmc$rr_rerun_file) THEN           
          IF latest_clock_time_to_process <= current_microsecond_clock THEN                                   
            osp$set_status_condition (jme$latest_run_time_expired, status);                                   
            EXIT /change_qfile_attributes/ {----->                                                            
          ELSE                                                                                                
            system_label.disposition_time.specified := FALSE;                                                 
          IFEND;                                                                                              
        IFEND;                                                                                                
                                                                                                              
{ Update the Known Qfile List                                                                                 
        qfp$change_qfile_attributes (system_label, earliest_clock_time_to_process,                            
              latest_clock_time_to_process, purge_delay_clock_time, current_microsecond_clock,                
              rerun_disposition, delete_qfile, status);                                                       
        IF NOT status.normal THEN                                                                             
          EXIT /change_qfile_attributes/ {----->                                                              
        IFEND;                                                                                                
                                                                                                              
        IF delete_qfile THEN                                                                                  
          attachment_phase := c$in_purge;                                                                     
          #SPOIL (attachment_phase);                                                                          
          amp$return (local_file_name, ignore_status);                                                        
          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 queue file                                                             
        qfp$write_qfile_system_label (local_file_name, { write_label } TRUE, system_label, attributes_size,   
              status);                                                                                        
        IF NOT status.normal THEN                                                                             
          EXIT /change_qfile_attributes/ {----->                                                              
        IFEND;                                                                                                
      IFEND;                                                                                                  
    END /change_qfile_attributes/;                                                                            
                                                                                                              
{ Release the file in case somebody needs it                                                                  
    IF status.normal THEN                                                                                     
      amp$return (local_file_name, status);                                                                   
    ELSE                                                                                                      
      amp$return (local_file_name, ignore_status);                                                            
    IFEND;                                                                                                    
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
  PROCEND jmp$mainframe_change_qfile_attr;                                                                    
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[xdcl] JMP$MAINFRAME_GET_QFILE_ATTRIB', EJECT ??                                              
                                                                                                              
  PROCEDURE [XDCL] jmp$mainframe_get_qfile_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);                                                                                 
                                                                                                              
    TYPE                                                                                                      
      t$attachment_phase = (c$not_attached, c$in_attach, c$attached);                                         
                                                                                                              
    VAR                                                                                                       
      attachment_phase: t$attachment_phase,                                                                   
      appl_attribute_temp_p: ^SEQ ( * ),                                                                      
      appl_attribute_work_area_p: ^jmt$work_area,                                                             
      application_attribute_size_p: ^jmt$qfile_appl_attr_size,                                                
      attribute_choices: t$qfile_appl_attribute_choices,                                                      
      boolean_p: ^boolean,                                                                                    
      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,                                                                            
      ignore_status: ost$status,                                                                              
      local_file_name: amt$local_file_name,                                                                   
      local_parameters_p: ^t$mainframe_getqa_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$qfile_status_options,                                                      
      name_value_p: ^ost$name,                                                                                
      number_of_qfiles_statused: jmt$qfile_count_range,                                                       
      options_seq_p: ^SEQ ( * ),                                                                              
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      qfile_index: integer,                                                                                   
      qfile_state_p: ^jmt$qfile_state,                                                                        
      qfile_status_results_p: ^jmt$qfile_status_results,                                                      
      remote_host_directive_p: ^jmt$remote_host_directive,                                                    
      result_index: ost$positive_integers,                                                                    
      scratch_segment: amt$segment_pointer,                                                                   
      share_selections: pft$share_selections,                                                                 
      status_option_index: ost$non_negative_integers,                                                         
      status_results_keys_p: ^jmt$results_keys,                                                               
      status_value_p: ^ost$status,                                                                            
      system_file_name_p: ^jmt$system_supplied_name,                                                          
      system_label: jmt$qfile_system_label,                                                                   
      time_increment_p: ^jmt$time_increment,                                                                  
      usage_selections: pft$usage_selections;                                                                 
                                                                                                              
?? NEWTITLE := 'CONDITION_HANDLER', EJECT ??                                                                  
                                                                                                              
    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;                                                                            
                                                                                                              
      #SPOIL (attachment_phase);                                                                              
      CASE condition.selector OF                                                                              
      = pmc$block_exit_processing =                                                                           
        IF attachment_phase = c$in_attach THEN                                                                
          pfp$end_system_authority;                                                                           
        IFEND;                                                                                                
                                                                                                              
        IF attachment_phase = c$attached THEN                                                                 
          amp$return (local_file_name, ignore_status);                                                        
        IFEND;                                                                                                
                                                                                                              
        IF status.normal THEN                                                                                 
          osp$set_status_from_condition (jmc$job_management_id, condition, sfsa_p, status, ignore_status);    
        IFEND;                                                                                                
                                                                                                              
      = ifc$interactive_condition =                                                                           
        IF attachment_phase = c$in_attach THEN                                                                
          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_get_qfile_attrib; {----->                                                      
          IFEND;                                                                                              
        ELSE                                                                                                  
          pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                             
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                               
      CASEND;                                                                                                 
                                                                                                              
    PROCEND condition_handler;                                                                                
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
    status.normal := TRUE;                                                                                    
    attachment_phase := c$not_attached;                                                                       
    #SPOIL (attachment_phase);                                                                                
    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$system_supplied_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].system_supplied_name_list := NIL;                     
        ELSE                                                                                                  
          NEXT local_status_options_p^ [status_option_index].system_supplied_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 + 1];                          
      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;            
    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;                                                                                                    
                                                                                                              
    osp$establish_condition_handler (^condition_handler, {block_exit} TRUE);                                  
                                                                                                              
  /get_attributes/                                                                                            
    BEGIN                                                                                                     
      RESET scratch_segment.sequence_pointer;                                                                 
      jmp$get_qfile_status (local_status_options_p, status_results_keys_p, scratch_segment.sequence_pointer,  
            qfile_status_results_p, number_of_qfiles_statused, status);                                       
      IF NOT status.normal THEN                                                                               
        IF status.condition = jme$no_qfiles_were_found THEN                                                   
          number_of_qfiles_statused := 0;                                                                     
          status.normal := TRUE;                                                                              
        ELSE                                                                                                  
          EXIT /get_attributes/ {----->                                                                       
        IFEND;                                                                                                
      IFEND;                                                                                                  
                                                                                                              
      number_of_data_packets := 0;                                                                            
                                                                                                              
      IF local_results_keys_p <> NIL THEN                                                                     
        PUSH appl_attribute_work_area_p: [[REP jmc$max_qfile_appl_attr_size OF cell]];                        
                                                                                                              
        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];                                     
                                                                                                              
      /attach_all_queue_files/                                                                                
        FOR qfile_index := 1 TO number_of_qfiles_statused DO                                                  
                                                                                                              
{ Attach the file so we can read the system label and get the attributes                                      
          IF local_parameters_p^.attach_file THEN                                                             
            pmp$get_unique_name (local_file_name, { ignore } status);                                         
            determine_file_path (qfile_status_results_p^ [qfile_index]^                                       
                  [local_parameters_p^.results_keys_count + 1].system_file_name, path_p);                     
                                                                                                              
            attachment_phase := c$in_attach;                                                                  
            #SPOIL (attachment_phase);                                                                        
            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;                                                                         
            IF NOT status.normal THEN                                                                         
              attachment_phase := c$not_attached;                                                             
              #SPOIL (attachment_phase);                                                                      
              status.normal := TRUE;                                                                          
              CYCLE /attach_all_queue_files/; {----->                                                         
            IFEND;                                                                                            
                                                                                                              
{ Read the queue file's system label                                                                          
            attachment_phase := c$attached;                                                                   
            #SPOIL (attachment_phase);                                                                        
            qfp$read_qfile_system_label (local_file_name, system_label, status);                              
            IF NOT status.normal THEN                                                                         
              attachment_phase := c$not_attached;                                                             
              #SPOIL (attachment_phase);                                                                      
              amp$return (local_file_name, ignore_status);                                                    
              EXIT /get_attributes/; {----->                                                                  
            IFEND;                                                                                            
                                                                                                              
{ Release the file in case somebody needs it for write access                                                 
            amp$return (local_file_name, status);                                                             
            attachment_phase := c$not_attached;                                                               
            #SPOIL (attachment_phase);                                                                        
                                                                                                              
{ Get the application attributes from the system label, if necessary.                                         
            IF local_parameters_p^.get_application_attributes THEN                                            
              unpack_application_attributes (^system_label, ^attribute_choices, appl_attribute_work_area_p,   
                    status);                                                                                  
              IF NOT status.normal THEN                                                                       
                EXIT /get_attributes/; {----->                                                                
              IFEND;                                                                                          
            IFEND;                                                                                            
          IFEND;                                                                                              
                                                                                                              
          number_of_data_packets := number_of_data_packets + 1;                                               
                                                                                                              
        /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$application_attributes_1, jmc$application_attributes_2, jmc$application_attributes_3,       
                  jmc$application_attributes_4, jmc$application_attributes_5, jmc$application_attributes_6,   
                  jmc$application_attributes_7, jmc$application_attributes_8, jmc$application_attributes_9,   
                  jmc$application_attributes_10 =                                                             
                                                                                                              
              NEXT application_attribute_size_p IN data_area_p;                                               
              IF (application_attribute_size_p = NIL) THEN                                                    
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /get_attributes/; {----->                                                                
              IFEND;                                                                                          
                                                                                                              
              application_attribute_size_p^ := attribute_choices [local_results_keys_p^ [result_index]].      
                    application_attributes.size;                                                              
                                                                                                              
              IF (attribute_choices [local_results_keys_p^ [result_index]].application_attributes.size >      
                    0) THEN                                                                                   
                NEXT appl_attribute_temp_p: [[REP attribute_choices [local_results_keys_p^ [result_index]].   
                      application_attributes.size OF cell]] IN data_area_p;                                   
                IF (appl_attribute_temp_p = NIL) THEN                                                         
                  osp$set_status_condition (jme$work_area_too_small, status);                                 
                  EXIT /fill_in_each_result_field/ {----->                                                    
                IFEND;                                                                                        
                i#move (attribute_choices [local_results_keys_p^ [result_index]].application_attributes.      
                      attributes_p, appl_attribute_temp_p, attribute_choices                                  
                      [local_results_keys_p^ [result_index]].application_attributes.size);                    
              IFEND;                                                                                          
                                                                                                              
            = jmc$application_name =                                                                          
              NEXT name_value_p IN data_area_p;                                                               
              IF (name_value_p = NIL) THEN                                                                    
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              name_value_p^ := qfile_status_results_p^ [qfile_index]^ [result_index].application_name;        
                                                                                                              
            = jmc$application_status =                                                                        
              NEXT status_value_p IN data_area_p;                                                             
              IF (status_value_p = NIL) THEN                                                                  
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              status_value_p^ := system_label.application_status;                                             
                                                                                                              
            = jmc$control_family =                                                                            
              NEXT name_value_p IN data_area_p;                                                               
              IF (name_value_p = NIL) THEN                                                                    
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              name_value_p^ := qfile_status_results_p^ [qfile_index]^ [result_index].control_family;          
                                                                                                              
            = jmc$control_user =                                                                              
              NEXT name_value_p IN data_area_p;                                                               
              IF (name_value_p = NIL) THEN                                                                    
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              name_value_p^ := qfile_status_results_p^ [qfile_index]^ [result_index].control_user;            
                                                                                                              
            = jmc$data_mode =                                                                                 
              NEXT data_mode_p IN data_area_p;                                                                
              IF (data_mode_p = NIL) THEN                                                                     
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              data_mode_p^ := system_label.data_mode;                                                         
                                                                                                              
            = jmc$deferred_by_application =                                                                   
              NEXT boolean_p IN data_area_p;                                                                  
              IF (boolean_p = NIL) THEN                                                                       
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              boolean_p^ := system_label.deferred_by_application;                                             
                                                                                                              
            = jmc$deferred_by_operator =                                                                      
              NEXT boolean_p IN data_area_p;                                                                  
              IF (boolean_p = NIL) THEN                                                                       
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              boolean_p^ := system_label.deferred_by_operator;                                                
                                                                                                              
            = jmc$deferred_by_user =                                                                          
              NEXT boolean_p IN data_area_p;                                                                  
              IF (boolean_p = NIL) THEN                                                                       
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              boolean_p^ := system_label.deferred_by_user;                                                    
                                                                                                              
            = jmc$destination =                                                                               
              NEXT name_value_p IN data_area_p;                                                               
              IF (name_value_p = NIL) THEN                                                                    
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              name_value_p^ := system_label.destination;                                                      
                                                                                                              
            = jmc$earliest_run_time =                                                                         
              NEXT date_time_p IN data_area_p;                                                                
              IF (date_time_p = NIL) THEN                                                                     
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              date_time_p^ := system_label.earliest_run_time;                                                 
                                                                                                              
            = jmc$latest_run_time =                                                                           
              NEXT date_time_p IN data_area_p;                                                                
              IF (date_time_p = NIL) THEN                                                                     
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              date_time_p^ := system_label.latest_run_time;                                                   
                                                                                                              
            = jmc$login_family =                                                                              
              NEXT name_value_p IN data_area_p;                                                               
              IF (name_value_p = NIL) THEN                                                                    
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              name_value_p^ := qfile_status_results_p^ [qfile_index]^ [result_index].login_family;            
                                                                                                              
            = jmc$login_user =                                                                                
              NEXT name_value_p IN data_area_p;                                                               
              IF (name_value_p = NIL) THEN                                                                    
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              name_value_p^ := qfile_status_results_p^ [qfile_index]^ [result_index].login_user;              
                                                                                                              
            = jmc$null_attribute =                                                                            
              ;                                                                                               
                                                                                                              
            = jmc$purge_delay =                                                                               
              NEXT time_increment_p IN data_area_p;                                                           
              IF time_increment_p = NIL THEN                                                                  
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              IF system_label.disposition_time.specified THEN                                                 
                pmp$compute_date_time (system_label.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$qfile_state =                                                                               
              NEXT qfile_state_p IN data_area_p;                                                              
              IF qfile_state_p = NIL THEN                                                                     
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              qfile_state_p^ := qfile_status_results_p^ [qfile_index]^ [result_index].qfile_state;            
                                                                                                              
            = jmc$remote_host_directive =                                                                     
              NEXT remote_host_directive_p IN data_area_p;                                                    
              IF remote_host_directive_p = NIL THEN                                                           
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              remote_host_directive_p^ := system_label.remote_host_directive;                                 
                                                                                                              
            = jmc$system_file_name =                                                                          
              NEXT system_file_name_p IN data_area_p;                                                         
              IF (system_file_name_p = NIL) THEN                                                              
                osp$set_status_condition (jme$work_area_too_small, status);                                   
                EXIT /fill_in_each_result_field/ {----->                                                      
              IFEND;                                                                                          
              system_file_name_p^ := qfile_status_results_p^ [qfile_index]^ [result_index].system_file_name;  
                                                                                                              
            ELSE                                                                                              
              ;                                                                                               
            CASEND;                                                                                           
          FOREND /fill_in_each_result_field/;                                                                 
        FOREND /attach_all_queue_files/;                                                                      
      IFEND;                                                                                                  
    END /get_attributes/;                                                                                     
                                                                                                              
    mmp$delete_scratch_segment (scratch_segment, ignore_status);                                              
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
  PROCEND jmp$mainframe_get_qfile_attrib;                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[xdcl] JMP$MAINFRAME_GET_QFILE_STATUS', EJECT ??                                              
                                                                                                              
  PROCEDURE [XDCL] jmp$mainframe_get_qfile_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 {shit, this var is passed, but not used. Need to verify....                                           
      status_results_p: ^jmt$qfile_status_results;                                                            
                                                                                                              
    VAR                                                                                                       
      local_parameters_p: ^t$mainframe_getqs_parameters,                                                      
      local_status_name_count_p: ^ost$non_negative_integers,                                                  
      local_status_options_p: ^jmt$qfile_status_options,                                                      
      local_status_results_keys_p: ^jmt$results_keys,                                                         
      number_of_qfiles_found: jmt$qfile_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$system_supplied_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].system_supplied_name_list := NIL;                   
          ELSE                                                                                                
            NEXT local_status_options_p^ [status_option_index].system_supplied_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_qfile_status (local_parameters_p^.user_identification, local_parameters_p^.privileged_job,        
          local_status_options_p, local_status_results_keys_p, data_area_p, status_results_p,                 
          number_of_qfiles_found);                                                                            
    number_of_data_packets := number_of_qfiles_found;                                                         
                                                                                                              
  PROCEND jmp$mainframe_get_qfile_status;                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL] jmp$mainframe_terminate_qfile', EJECT ??                                               
                                                                                                              
  PROCEDURE [XDCL] jmp$mainframe_terminate_qfile                                                              
    (    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_qfile: boolean,                                                                                  
      local_parameters_p: ^t$mainframe_terq_parameters,                                                       
      options_seq_p: ^SEQ ( * ),                                                                              
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      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_qfile (local_parameters_p^.system_file_name, local_parameters_p^.qfile_state_set,           
          delete_qfile, status);                                                                              
    IF NOT status.normal THEN                                                                                 
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    IF delete_qfile THEN                                                                                      
      determine_file_path (local_parameters_p^.system_file_name, path_p);                                     
      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_qfile;                                                                      
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$modified_qfile_exists', EJECT ??                                            
*copy jmh$modified_qfile_exists                                                                               
                                                                                                              
  FUNCTION [XDCL, #GATE] jmp$modified_qfile_exists                                                            
    (    application_name: ost$name): boolean;                                                                
                                                                                                              
    VAR                                                                                                       
      application_index: jmt$qfile_application_index,                                                         
      qfile_exists: boolean;                                                                                  
                                                                                                              
    application_index := jmv$last_used_application_index;                                                     
    WHILE (jmv$known_qfile_list.application_table [application_index].application_name <>                     
          application_name) AND (application_index <> jmc$unassigned_qfile_index) DO                          
      application_index := application_index - 1;                                                             
    WHILEND;                                                                                                  
    qfile_exists := (application_index <> jmc$unassigned_qfile_index) AND                                     
          (jmv$known_qfile_list.application_table [application_index].                                        
          state_data [jmc$kql_application_modified].number_of_entries > 0);                                   
    jmp$modified_qfile_exists := qfile_exists AND (NOT syp$system_is_idling ());                              
                                                                                                              
  FUNCEND jmp$modified_qfile_exists;                                                                          
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$new_qfile_exists', EJECT ??                                                 
*copy jmh$new_qfile_exists                                                                                    
                                                                                                              
  FUNCTION [XDCL, #GATE] jmp$new_qfile_exists                                                                 
    (    application_name: ost$name): boolean;                                                                
                                                                                                              
    VAR                                                                                                       
      application_index: jmt$qfile_application_index,                                                         
      qfile_exists: boolean;                                                                                  
                                                                                                              
    application_index := jmv$last_used_application_index;                                                     
    WHILE (jmv$known_qfile_list.application_table [application_index].application_name <>                     
          application_name) AND (application_index <> jmc$unassigned_qfile_index) DO                          
      application_index := application_index - 1;                                                             
    WHILEND;                                                                                                  
    qfile_exists := (application_index <> jmc$unassigned_qfile_index) AND                                     
          (jmv$known_qfile_list.application_table [application_index].state_data [jmc$kql_application_new].   
          number_of_entries > 0);                                                                             
    jmp$new_qfile_exists := qfile_exists AND (NOT syp$system_is_idling ());                                   
                                                                                                              
  FUNCEND jmp$new_qfile_exists;                                                                               
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$open_files_for_copqf', EJECT ??                                             
                                                                                                              
{ PURPOSE:                                                                                                    
{   The purpose of this procedure is to open queue files at the correct ring for jmp$copy_qfile.              
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$open_files_for_copqf                                                            
    (    system_file_name: jmt$system_supplied_name;                                                          
         target_file: fst$file_reference;                                                                     
         target_ring: ost$valid_ring;                                                                         
     VAR control_info: fst$copy_control_information;                                                          
     VAR qfile_fid: amt$file_identifier;                                                                      
     VAR qfile_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,                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      number_of_qfiles_found: jmt$qfile_status_count,                                                         
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      qfile_attachment_options_p: ^fst$attachment_options,                                                    
      selected_ring: ost$valid_ring,                                                                          
      share_selections: pft$share_selections,                                                                 
      status_options_p: ^jmt$qfile_status_options,                                                            
      status_results_p: ^jmt$qfile_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;                                                                 
                                                                                                              
?? 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 generic 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_copqf; {----->                                                              
        IFEND;                                                                                                
                                                                                                              
      ELSE                                                                                                    
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);                               
      CASEND;                                                                                                 
    PROCEND condition_handler;                                                                                
                                                                                                              
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    qfile_fid := amv$nil_file_identifier;                                                                     
    target_fid := amv$nil_file_identifier;                                                                    
                                                                                                              
    pmp$get_unique_name (qfile_lfn, ignore_status);                                                           
                                                                                                              
    #CALLER_ID (caller_id);                                                                                   
                                                                                                              
{ IF the specified queue file does not exist  (verify through jmp$get_qfile_status) THEN                      
{   RETURN with abnormal status jme$name_not_found                                                            
{ IFEND                                                                                                       
                                                                                                              
    PUSH status_options_p: [1 .. 1];                                                                          
    status_options_p^ [1].key := jmc$system_supplied_name_list;                                               
    PUSH status_options_p^ [1].system_supplied_name_list: [1 .. 1];                                           
    status_options_p^ [1].system_supplied_name_list^ [1] := system_file_name;                                 
                                                                                                              
    PUSH status_work_area_p: [[REP #SIZE (jmt$qfile_status_results: [1 .. 1]) OF cell]];                      
    RESET status_work_area_p;                                                                                 
    jmp$get_qfile_status (status_options_p, { status_results_keys_p } NIL, status_work_area_p,                
          status_results_p, number_of_qfiles_found, status);                                                  
                                                                                                              
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$no_qfiles_were_found THEN                                                     
        osp$set_status_abnormal ('JM', jme$name_not_found, system_file_name, status);                         
      IFEND;                                                                                                  
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
{ Build the file path for the open request                                                                    
    determine_file_path (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];                                         
                                                                                                              
{ Establish block exit and interactive condition handler                                                      
{ Attach the file                                                                                             
{ Disestablish condition handler                                                                              
                                                                                                              
    osp$establish_condition_handler (^condition_handler, { block_exit } TRUE);                                
    pfp$begin_system_authority;                                                                               
    pfp$attach (qfile_lfn, 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 (qfile_lfn, ignore_status);                                                                  
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
{ Set up options to open the queue file for read access.                                                      
    PUSH qfile_attachment_options_p: [1 .. 2];                                                                
    qfile_attachment_options_p^ [1].selector := fsc$access_and_share_modes;                                   
    qfile_attachment_options_p^ [1].access_modes.selector := fsc$specific_access_modes;                       
    qfile_attachment_options_p^ [1].access_modes.value := $fst$file_access_options [fsc$read];                
    qfile_attachment_options_p^ [1].share_modes.selector := fsc$specific_share_modes;                         
    qfile_attachment_options_p^ [1].share_modes.value := $fst$file_access_options [fsc$read, fsc$modify];     
    qfile_attachment_options_p^ [2].selector := fsc$open_share_modes;                                         
    qfile_attachment_options_p^ [2].open_share_modes := $fst$file_access_options [fsc$read, fsc$modify];      
                                                                                                              
{ Set up options to open the target file for write access and to create it (if it doesn't                     
{       exist) at max(caller ring, target ring)                                                               
                                                                                                              
    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;                                         
    IF caller_id.ring > target_ring THEN                                                                      
      selected_ring := caller_id.ring;                                                                        
    ELSE                                                                                                      
      selected_ring := target_ring;                                                                           
    IFEND;                                                                                                    
    target_attachment_options_p^ [3].validation_ring := selected_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 := selected_ring;                                    
    target_creation_attributes_p^ [1].ring_attributes.r2 := selected_ring;                                    
    target_creation_attributes_p^ [1].ring_attributes.r3 := selected_ring;                                    
                                                                                                              
{ Open the files and obtain the copy control information                                                      
    fsp$open_and_get_type_of_copy (qfile_lfn, target_file, qfile_attachment_options_p,                        
          target_attachment_options_p, { input_attribute_validation } NIL,                                    
          { output_attribute_validation } NIL, target_creation_attributes_p, qfile_fid, target_fid,           
          control_info, status);                                                                              
    IF NOT status.normal THEN                                                                                 
      IF (qfile_fid <> amv$nil_file_identifier) THEN                                                          
        fsp$close_file (qfile_fid, ignore_status);                                                            
        qfile_fid := amv$nil_file_identifier;                                                                 
        #SPOIL (qfile_fid);                                                                                   
      IFEND;                                                                                                  
                                                                                                              
      amp$return (qfile_lfn, 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 (qfile_fid, ignore_status);                                                                
    qfile_fid := amv$nil_file_identifier;                                                                     
    #SPOIL (qfile_fid);                                                                                       
                                                                                                              
{ Reopen the 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 := selected_ring;                                            
    attribute_override_p^ [1].ring_attributes.r3 := selected_ring;                                            
                                                                                                              
    fsp$open_file (qfile_lfn, amc$record, qfile_attachment_options_p, { default_creation_attributes } NIL,    
          { mandated_creation_attributes } NIL, { attribute_validation } NIL, attribute_override_p, qfile_fid,
          status);                                                                                            
                                                                                                              
    IF NOT status.normal THEN                                                                                 
      amp$return (qfile_lfn, 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_copqf;                                                                           
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$close_files_for_copqf', EJECT ??                                            
*copy jmh$close_files_for_copqf                                                                               
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$close_files_for_copqf                                                           
    (    qfile_fid: amt$file_identifier;                                                                      
         qfile_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;                                                                                    
                                                                                                              
{ Close the files and detach the output queue file.                                                           
    IF qfile_fid <> amv$nil_file_identifier THEN                                                              
      bap$validate_file_identifier (qfile_fid, file_instance, file_id_is_valid);                              
      IF file_id_is_valid THEN                                                                                
        fsp$close_file (qfile_fid, status);                                                                   
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
    amp$return (qfile_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_copqf;                                                                          
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL #GATE] jmp$open_qfile', EJECT ??                                                        
*copy jmh$open_qfile                                                                                          
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$open_qfile                                                                      
    (    system_file_name: jmt$system_supplied_name;                                                          
         access_level: amt$access_level;                                                                      
         application_name: ost$name;                                                                          
         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;                                                                              
                                                                                                              
?? 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_qfile_access (system_file_name, application_name, 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 ('.');                                                                                   
    add_to_file_path (jmc$generic_queue_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_qfile;                                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$purge_expired_queue_file', EJECT ??                                         
*copy jmh$purge_expired_queue_file                                                                            
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$purge_expired_queue_file;                                                       
                                                                                                              
    VAR                                                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      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_queue_file (system_file_name);                                                          
    IF system_file_name <> jmc$blank_system_supplied_name THEN                                                
      determine_file_path (system_file_name, path_p);                                                         
                                                                                                              
      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_queue_file;                                                                       
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$purge_processed_queue_file', EJECT ??                                       
*copy jmh$purge_processed_queue_file                                                                          
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$purge_processed_queue_file;                                                     
                                                                                                              
    VAR                                                                                                       
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      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_processed_queue_file (system_file_name);                                                        
    IF system_file_name <> jmc$blank_system_supplied_name THEN                                                
      determine_file_path (system_file_name, path_p);                                                         
                                                                                                              
      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_processed_queue_file;                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$rebuild_generic_queue', EJECT ??                                            
*copy jmh$rebuild_generic_queue                                                                               
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$rebuild_generic_queue                                                           
    (    system_file_name: jmt$system_supplied_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_process: jmt$clock_time,                                                         
      ignore_status: ost$status,                                                                              
      latest_clock_time_to_process: 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$qfile_system_label,                                                                   
      system_supplied_name: jmt$system_supplied_name,                                                         
      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 the queue file is attached.                                                                   
                                                                                                              
    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;                                                                            
                                                                                                              
      amp$return (local_file_name, ignore_status);                                                            
    PROCEND handle_block_exit;                                                                                
?? OLDTITLE ??                                                                                                
?? EJECT ??                                                                                                   
    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;                                                                                                    
                                                                                                              
    determine_file_path (system_supplied_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);                                                      
                                                                                                              
  /process_file/                                                                                              
    BEGIN                                                                                                     
      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);                                         
        EXIT /process_file/; {----->                                                                          
      IFEND;                                                                                                  
                                                                                                              
{ If we can't read the system label - don't recover it                                                        
{ In fact, delete the queue file                                                                              
                                                                                                              
      qfp$read_qfile_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);                                         
        EXIT /process_file/; {----->                                                                          
      IFEND;                                                                                                  
                                                                                                              
{ Calculate the earliest_process_time, latest_process_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 processed (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 processed is:                                                
{                                                                                                             
{   disposition_time = disposition_time + down_time;                                                          
{   purge_delay_clock_time = 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.disposition_time.specified THEN                                                         
        earliest_clock_time_to_process := jmc$earliest_clock_time;                                            
        latest_clock_time_to_process := jmc$latest_clock_time;                                                
        IF system_label.purge_delay.specified THEN                                                            
          pmp$compute_date_time (system_label.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);                                                      
            EXIT /process_file/; {----->                                                                      
          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_run_time.specified THEN                                                      
          jmp$convert_date_time_dif_to_us (current_date_time, system_label.earliest_run_time.date_time,       
                current_microsecond_clock, earliest_clock_time_to_process);                                   
        ELSE                                                                                                  
          earliest_clock_time_to_process := jmc$earliest_clock_time;                                          
        IFEND;                                                                                                
                                                                                                              
        IF system_label.latest_run_time.specified THEN                                                        
          jmp$convert_date_time_dif_to_us (current_date_time, system_label.latest_run_time.date_time,         
                current_microsecond_clock, latest_clock_time_to_process);                                     
        ELSE                                                                                                  
          latest_clock_time_to_process := jmc$latest_clock_time;                                              
        IFEND;                                                                                                
        purge_delay_clock_time := jmc$earliest_clock_time;                                                    
      IFEND;                                                                                                  
                                                                                                              
      qfp$rebuild_generic_queue (system_label, earliest_clock_time_to_process, latest_clock_time_to_process,  
            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;                                                                                                  
    END /process_file/;                                                                                       
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
  PROCEND jmp$rebuild_generic_queue;                                                                          
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$register_qfile_application', EJECT ??                                       
*copy jmh$register_qfile_application                                                                          
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$register_qfile_application                                                      
    (    application_name: ost$name;                                                                          
         registration_options_p: ^jmt$qfile_registration_options;                                             
     VAR queue_file_password: jmt$queue_file_password;                                                        
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      valid_name: boolean,                                                                                    
      valid_application_name: ost$name;                                                                       
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
    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;                                                                                                    
                                                                                                              
    pmp$get_unique_name (queue_file_password, status);                                                        
    IF status.normal THEN                                                                                     
      qfp$register_qfile_application (valid_application_name, registration_options_p, queue_file_password,    
            status);                                                                                          
      IF status.normal THEN                                                                                   
        task_has_registered_application := TRUE;                                                              
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
  PROCEND jmp$register_qfile_application;                                                                     
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$release_generic_queue_files', EJECT ??                                      
*copy jmh$release_generic_queue_files                                                                         
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$release_generic_queue_files;                                                    
                                                                                                              
    VAR                                                                                                       
      release_file_list: ^jmt$system_supplied_name_list,                                                      
      release_file_count: jmt$qfile_count_range,                                                              
      release_file_index: jmt$qfile_count_range,                                                              
      ignore_status: ost$status,                                                                              
      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                                                                                                     
        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;                                                                             
                                                                                                              
    PUSH release_file_list: [1 .. jmc$maximum_qfile_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_generic_queue_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;                                                                           
    path_p^ [3] := jmc$generic_queue_catalog;                                                                 
                                                                                                              
    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                                                      
      path_p^ [4] := release_file_list^ [release_file_index];                                                 
      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_generic_queue_files;                                                                    
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$set_qfile_completed', EJECT ??                                              
*copy jmh$set_qfile_completed                                                                                 
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$set_qfile_completed                                                             
    (    application_name: ost$name;                                                                          
         system_file_name: jmt$system_supplied_name;                                                          
         completed_successfully: boolean;                                                                     
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      application_attributes_p: ^t$qfile_appl_attribute_choices,                                              
      attributes_size: jmt$qsl_appl_attr_contents_size,                                                       
      attribute_work_area_p: ^jmt$work_area,                                                                  
      cycle_selector: pft$cycle_selector,                                                                     
      current_clock_time: jmt$clock_time,                                                                     
      date_time: ost$date_time,                                                                               
      delete_qfile: 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,                                                                 
      system_label: jmt$qfile_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;                                                                               
      amp$return (local_file_name, 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 ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    determine_file_path (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_qfile_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.disposition_time.date_time, ignore_status);                     
      system_label.disposition_time.specified := TRUE;                                                        
      IF system_label.purge_delay.specified THEN                                                              
        pmp$compute_date_time (system_label.disposition_time.date_time,                                       
              system_label.purge_delay.time_increment, date_time, ignore_status);                             
        jmp$convert_date_time_dif_to_us (system_label.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_qfile_completed (application_name, system_file_name, completed_successfully,                      
          purge_delay_clock_time, current_clock_time, delete_qfile, status);                                  
    IF status.normal THEN                                                                                     
      IF delete_qfile THEN                                                                                    
        amp$return (local_file_name, ignore_status);                                                          
        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                                                                      
                                                                                                              
{ The application attributes must be unpacked and then packed again in order to find their size.              
        PUSH application_attributes_p;                                                                        
        PUSH attribute_work_area_p: [[REP jmc$max_qfile_appl_attr_size OF cell]];                             
        unpack_application_attributes (^system_label, application_attributes_p, attribute_work_area_p,        
              status);                                                                                        
        IF NOT status.normal THEN                                                                             
          amp$return (local_file_name, ignore_status);                                                        
          RETURN; {----->                                                                                     
        IFEND;                                                                                                
                                                                                                              
        pack_application_attributes (application_attributes_p, ^system_label, attributes_size, status);       
        IF NOT status.normal THEN                                                                             
          amp$return (local_file_name, ignore_status);                                                        
          RETURN; {----->                                                                                     
        IFEND;                                                                                                
                                                                                                              
{ Write the updated queue file's system label                                                                 
        qfp$write_qfile_system_label (local_file_name, { write_label } TRUE, system_label, attributes_size,   
              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_qfile_completed;                                                                            
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$set_qfile_initiated', EJECT ??                                              
*copy jmh$set_qfile_initiated                                                                                 
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$set_qfile_initiated                                                             
    (    application_name: ost$name;                                                                          
         system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
    qfp$set_qfile_initiated (application_name, system_file_name, status);                                     
                                                                                                              
  PROCEND jmp$set_qfile_initiated;                                                                            
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$submit_qfile', EJECT ??                                                     
*copy jmh$submit_qfile                                                                                        
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$submit_qfile                                                                    
    (    file_reference: fst$file_reference;                                                                  
         application_name: ost$name;                                                                          
         submission_options_p: ^jmt$qfile_submission_options;                                                 
     VAR system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    CONST                                                                                                     
      unit_separator = $CHAR (1f(16));                                                                        
                                                                                                              
    VAR                                                                                                       
      attributes_size: jmt$qsl_appl_attr_contents_size,                                                       
      attribute_work_area_p: ^jmt$work_area,                                                                  
      caller_identifier: ost$caller_identifier,                                                               
      catalog_path_p: ^pft$path,                                                                              
      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_process: jmt$clock_time,                                                         
      file_attributes: ^amt$get_attributes,                                                                   
      good_application_name: ost$name,                                                                        
      ignore_status: ost$status,                                                                              
      input_attachment_options_p: ^fst$attachment_options,                                                    
      input_validation_attributes_p: ^fst$file_cycle_attributes,                                              
      latest_clock_time_to_process: jmt$clock_time,                                                           
      local_file: boolean,                                                                                    
      null_file_access_procedure: pmt$entry_point_reference,                                                  
      old_file: boolean,                                                                                      
      qfile_attachment_options_p: ^fst$attachment_options,                                                    
      qfile_attribute_choices: t$qfile_appl_attribute_choices,                                                
      qfile_creation_attributes_p: ^fst$file_cycle_attributes,                                                
      password: pft$password,                                                                                 
      path_p: ^pft$path,                                                                                      
      permanent_file_name: amt$local_file_name,                                                               
      system_file_name_assigned: boolean,                                                                     
      system_label: jmt$qfile_system_label,                                                                   
      system_label_already_existed: boolean,                                                                  
      valid_name: boolean,                                                                                    
      validation_ring: ost$valid_ring;                                                                        
                                                                                                              
?? 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 := 'build_standard_label', EJECT ??                                                               
                                                                                                              
{ PURPOSE:                                                                                                    
{   Build the label for the queued file.                                                                      
                                                                                                              
    PROCEDURE build_standard_label                                                                            
      (    application_name: ost$name;                                                                        
       VAR appl_attribute_choices: t$qfile_appl_attribute_choices;                                            
       VAR system_label: jmt$qfile_system_label);                                                             
                                                                                                              
      VAR                                                                                                     
        attribute_index: integer,                                                                             
        job_mode: jmt$job_mode,                                                                               
        ignore_status: ost$status;                                                                            
                                                                                                              
      pmp$get_job_mode (job_mode, ignore_status);                                                             
      IF job_mode <> jmc$batch THEN                                                                           
        job_mode := jmc$interactive_connected;                                                                
      IFEND;                                                                                                  
                                                                                                              
{ Initialize the application attributes. These will be put in the system label later.                         
      FOR attribute_index := jmc$application_attributes_1 TO jmc$application_attributes_10 DO                 
        appl_attribute_choices [attribute_index].key := attribute_index;                                      
        appl_attribute_choices [attribute_index].application_attributes.size := 0;                            
        appl_attribute_choices [attribute_index].application_attributes.attributes_p := NIL;                  
      FOREND;                                                                                                 
                                                                                                              
      system_label.data_mode := jmc$coded_data;                                                               
      system_label.deferred_by_application := FALSE;                                                          
      system_label.deferred_by_operator := jmv$default_job_attributes [job_mode].qfile_deferred_by_operator;  
      system_label.deferred_by_user := FALSE;                                                                 
      system_label.destination := '';                                                                         
      system_label.disposition_time.specified := FALSE;                                                       
      system_label.earliest_run_time.specified := FALSE;                                                      
      system_label.latest_run_time.specified := FALSE;                                                        
      pmp$get_user_identification (system_label.login_user_identification, ignore_status);                    
      system_label.qfile_controller := jmv$job_attributes.job_controller;                                     
      system_label.application_name := application_name;                                                      
      system_label.purge_delay.specified := FALSE;                                                            
      system_label.remote_host_directive.size := 0;                                                           
      system_label.remote_host_directive.parameters := '';                                                    
      system_label.application_status.normal := TRUE;                                                         
      system_label.application_status.condition := 0;                                                         
      system_label.application_status.text.size := 0;                                                         
      system_label.application_status.text.value := '';                                                       
      system_label.system_file_name := '';                                                                    
                                                                                                              
    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                                                                  
      (    submission_options_p: ^jmt$qfile_submission_options;                                               
       VAR appl_attribute_choices: t$qfile_appl_attribute_choices;                                            
       VAR system_label: jmt$qfile_system_label;                                                              
       VAR validation_ring: ost$valid_ring;                                                                   
       VAR status: ost$status);                                                                               
                                                                                                              
      VAR                                                                                                     
        candidate_system_file_name: jmt$name,                                                                 
        option_index: integer,                                                                                
        scl_name: ost$name,                                                                                   
        valid_name: boolean,                                                                                  
        valid_system_file_name: jmt$name;                                                                     
                                                                                                              
      status.normal := TRUE;                                                                                  
      IF submission_options_p = NIL THEN                                                                      
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
                                                                                                              
      FOR option_index := 1 TO UPPERBOUND (submission_options_p^) DO                                          
        CASE submission_options_p^ [option_index].key OF                                                      
        = jmc$application_attributes_1, jmc$application_attributes_2, jmc$application_attributes_3,           
              jmc$application_attributes_4, jmc$application_attributes_5, jmc$application_attributes_6,       
              jmc$application_attributes_7, jmc$application_attributes_8, jmc$application_attributes_9,       
              jmc$application_attributes_10 =                                                                 
          appl_attribute_choices [submission_options_p^ [option_index].key].application_attributes :=         
                submission_options_p^ [option_index].application_attributes;                                  
                                                                                                              
        = jmc$data_mode =                                                                                     
          system_label.data_mode := submission_options_p^ [option_index].data_mode;                           
                                                                                                              
        = jmc$deferred_by_application =                                                                       
          system_label.deferred_by_application := submission_options_p^ [option_index].                       
                deferred_by_application;                                                                      
                                                                                                              
        = jmc$destination =                                                                                   
          clp$validate_name (submission_options_p^ [option_index].destination, scl_name, valid_name);         
          IF valid_name THEN                                                                                  
            system_label.destination := scl_name;                                                             
          ELSE                                                                                                
            #TRANSLATE (osv$lower_to_upper, submission_options_p^ [option_index].destination,                 
                  system_label.destination);                                                                  
          IFEND;                                                                                              
                                                                                                              
        = jmc$earliest_run_time =                                                                             
          system_label.earliest_run_time := submission_options_p^ [option_index].earliest_run_time;           
                                                                                                              
        = jmc$latest_run_time =                                                                               
          system_label.latest_run_time := submission_options_p^ [option_index].latest_run_time;               
                                                                                                              
        = jmc$null_attribute =                                                                                
          ;                                                                                                   
                                                                                                              
        = jmc$purge_delay =                                                                                   
          system_label.purge_delay := submission_options_p^ [option_index].purge_delay^;                      
                                                                                                              
        = jmc$remote_host_directive =                                                                         
          system_label.remote_host_directive := submission_options_p^ [option_index].remote_host_directive^;  
                                                                                                              
        = jmc$system_file_name =                                                                              
                                                                                                              
{ A blank system supplied name indicates that a "new" system file name should be assigned.                    
          IF submission_options_p^ [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 :=                                                
                  submission_options_p^ [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$validation_ring =                                                                               
                                                                                                              
{ Validation_ring doesn't go in the system label.  It is used to validate attaching the file.                 
          validation_ring := submission_options_p^ [option_index].validation_ring;                            
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (submission_options_p^ [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, 'SUBMISSION_OPTIONS_P', status);       
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$submit_qfile, status);             
          RETURN; {----->                                                                                     
        CASEND;                                                                                               
      FOREND;                                                                                                 
      IF system_label.application_name = jmc$qtf_usage THEN                                                   
        IF system_label.destination = '' THEN                                                                 
          osp$set_status_condition (jme$invalid_destination, status);                                         
        ELSEIF system_label.remote_host_directive.size = 0 THEN                                               
          osp$set_status_condition (jme$invalid_rhd, status);                                                 
        IFEND;                                                                                                
      IFEND;                                                                                                  
    PROCEND update_label_with_user_options;                                                                   
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
    ignore_status.normal := TRUE;                                                                             
                                                                                                              
{ Set up static and default values                                                                            
    #CALLER_ID (caller_identifier);                                                                           
    validation_ring := caller_identifier.ring;                                                                
    pmp$get_compact_date_time (current_date_time, { ignore } status);                                         
                                                                                                              
{ Validate the application name.                                                                              
    clp$validate_name (application_name, good_application_name, valid_name);                                  
    IF NOT valid_name THEN                                                                                    
      osp$set_status_abnormal ('CL', cle$improper_name, application_name, status);                            
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
{ Test to see if the queue file already has a system label.  If it does then the                              
{ defaulting does not take place.                                                                             
                                                                                                              
    qfp$read_qfile_system_label (file_reference, system_label, status);                                       
    IF status.normal THEN                                                                                     
      system_label_already_existed := TRUE;                                                                   
      PUSH attribute_work_area_p: [[REP jmc$max_qfile_appl_attr_size OF cell]];                               
      unpack_application_attributes (^system_label, ^qfile_attribute_choices, attribute_work_area_p, status); 
      IF NOT status.normal THEN                                                                               
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
                                                                                                              
      system_label.application_name := good_application_name;                                                 
    ELSE {NOT status.normal ==> The file did not have a system label                                          
                                                                                                              
      status.normal := TRUE;                                                                                  
                                                                                                              
      system_label_already_existed := FALSE;                                                                  
      build_standard_label (good_application_name, qfile_attribute_choices, system_label);                    
    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 (submission_options_p, qfile_attribute_choices, system_label,              
          validation_ring, status);                                                                           
    IF NOT status.normal THEN                                                                                 
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    pack_application_attributes (^qfile_attribute_choices, ^system_label, attributes_size, status);           
    IF NOT status.normal THEN                                                                                 
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
{ Calculate the earliest_run_time, latest_run_time and purge_delay if necessary.                              
    pmp$get_microsecond_clock (current_microsecond_clock, ignore_status);                                     
                                                                                                              
    IF system_label.earliest_run_time.specified THEN                                                          
      jmp$convert_date_time_dif_to_us (current_date_time, system_label.earliest_run_time.date_time,           
            current_microsecond_clock, earliest_clock_time_to_process);                                       
    ELSE                                                                                                      
      earliest_clock_time_to_process := jmc$earliest_clock_time;                                              
    IFEND;                                                                                                    
                                                                                                              
    IF system_label.latest_run_time.specified THEN                                                            
      jmp$convert_date_time_dif_to_us (current_date_time, system_label.latest_run_time.date_time,             
            current_microsecond_clock, latest_clock_time_to_process);                                         
    ELSE                                                                                                      
      latest_clock_time_to_process := jmc$latest_clock_time;                                                  
    IFEND;                                                                                                    
                                                                                                              
{ The 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 .. 2];                                                             
    input_validation_attributes_p^ [1].selector := fsc$file_access_procedure_name;                            
    input_validation_attributes_p^ [1].file_access_procedure_name := ^null_file_access_procedure;             
    input_validation_attributes_p^ [2].selector := fsc$ring_attributes;                                       
    input_validation_attributes_p^ [2].ring_attributes.r1 := validation_ring;                                 
    input_validation_attributes_p^ [2].ring_attributes.r2 := validation_ring;                                 
    input_validation_attributes_p^ [2].ring_attributes.r3 := validation_ring;                                 
                                                                                                              
    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 qfile_attachment_options_p: [1 .. 2];                                                                
    qfile_attachment_options_p^ [1].selector := fsc$free_behind;                                              
    qfile_attachment_options_p^ [1].free_behind := TRUE;                                                      
    qfile_attachment_options_p^ [2].selector := fsc$sequential_access;                                        
    qfile_attachment_options_p^ [2].sequential_access := TRUE;                                                
                                                                                                              
    IF system_label.data_mode = jmc$coded_data THEN                                                           
      PUSH qfile_creation_attributes_p: [1 .. 6];                                                             
      qfile_creation_attributes_p^ [1].selector := fsc$ring_attributes;                                       
                                                                                                              
{ Ring attributes are set below.                                                                              
      qfile_creation_attributes_p^ [2].selector := fsc$file_contents_and_processor;                           
      qfile_creation_attributes_p^ [2].file_contents := fsc$list;                                             
      qfile_creation_attributes_p^ [2].file_processor := fsc$unknown_processor;                               
      qfile_creation_attributes_p^ [3].selector := fsc$block_type;                                            
      qfile_creation_attributes_p^ [3].block_type := amc$system_specified;                                    
      qfile_creation_attributes_p^ [4].selector := fsc$record_delimiting_character;                           
      qfile_creation_attributes_p^ [4].record_delimiting_character := unit_separator;                         
      qfile_creation_attributes_p^ [5].selector := fsc$record_type;                                           
      qfile_creation_attributes_p^ [5].record_type := amc$trailing_char_delimited;                            
      qfile_creation_attributes_p^ [6].selector := fsc$file_organization;                                     
      qfile_creation_attributes_p^ [6].file_organization := amc$sequential;                                   
                                                                                                              
    ELSE { transparent data }                                                                                 
      PUSH qfile_creation_attributes_p: [1 .. 1];                                                             
      qfile_creation_attributes_p^ [1].selector := fsc$ring_attributes;                                       
                                                                                                              
{ Ring attributes are set below.                                                                              
    IFEND;                                                                                                    
                                                                                                              
    system_file_name_assigned := system_label.system_file_name <> '';                                         
                                                                                                              
  /submit_qfile/                                                                                              
    WHILE TRUE DO                                                                                             
      IF NOT system_file_name_assigned THEN                                                                   
        qfp$assign_system_supplied_name (system_label.system_file_name);                                      
      IFEND;                                                                                                  
                                                                                                              
      permanent_file_name := system_label.system_file_name;                                                   
      system_file_name := system_label.system_file_name;                                                      
                                                                                                              
      determine_file_path (system_file_name, path_p);                                                         
      cycle_selector.cycle_option := pfc$specific_cycle;                                                      
      cycle_selector.cycle_number := 1;                                                                       
      osp$establish_block_exit_hndlr (^handle_block_exit);                                                    
      pfp$begin_system_authority;                                                                             
      pfp$define (permanent_file_name, path_p^, cycle_selector, password, pfc$maximum_retention, pfc$log,     
            status);                                                                                          
      IF NOT status.normal THEN                                                                               
        IF (status.condition = pfe$unknown_last_subcatalog) OR                                                
              (status.condition = pfe$unknown_nth_subcatalog) THEN                                            
          PUSH catalog_path_p: [1 .. 3];                                                                      
          catalog_path_p^ [1] := path_p^ [1];                                                                 
          catalog_path_p^ [2] := path_p^ [2];                                                                 
          catalog_path_p^ [3] := path_p^ [3];                                                                 
          pfp$define_catalog (catalog_path_p^, status);                                                       
          IF status.normal THEN                                                                               
            osp$set_status_condition (pfe$duplicate_cycle, status);                                           
          IFEND;                                                                                              
        ELSEIF (status.condition = pfe$duplicate_cycle) THEN                                                  
          system_file_name_assigned := FALSE;                                                                 
        IFEND;                                                                                                
      IFEND;                                                                                                  
      pfp$end_system_authority;                                                                               
      osp$disestablish_cond_handler;                                                                          
      IF NOT status.normal THEN                                                                               
        IF (status.condition = pfe$duplicate_cycle) THEN                                                      
          status.normal := TRUE;                                                                              
          CYCLE /submit_qfile/; {----->                                                                       
        IFEND;                                                                                                
        EXIT /submit_qfile/; {----->                                                                          
      IFEND;                                                                                                  
                                                                                                              
      qfile_creation_attributes_p^ [1].ring_attributes.r1 := osc$tsrv_ring;                                   
      qfile_creation_attributes_p^ [1].ring_attributes.r2 := osc$tsrv_ring;                                   
      qfile_creation_attributes_p^ [1].ring_attributes.r3 := osc$tsrv_ring;                                   
                                                                                                              
      fsp$subsystem_copy_file (file_reference, permanent_file_name, input_attachment_options_p,               
            qfile_attachment_options_p, input_validation_attributes_p, {qfile_attribute_validation} NIL,      
            qfile_creation_attributes_p, 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 /submit_qfile/; {----->                                                                          
      IFEND;                                                                                                  
                                                                                                              
      qfp$write_qfile_system_label (permanent_file_name, { write_label } TRUE, system_label, attributes_size, 
            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 /submit_qfile/; {----->                                                                          
      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 /submit_qfile/; {----->                                                                          
      IFEND;                                                                                                  
                                                                                                              
{ Enter the file in the Known Qfile List.                                                                     
      qfp$submit_qfile (system_label, earliest_clock_time_to_process, latest_clock_time_to_process,           
            current_microsecond_clock, 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;                                                                        
        IF status.condition = jme$duplicate_name THEN                                                         
          status.normal := TRUE;                                                                              
          system_file_name_assigned := FALSE;                                                                 
          CYCLE /submit_qfile/; {----->                                                                       
        IFEND;                                                                                                
                                                                                                              
      IFEND;                                                                                                  
      EXIT /submit_qfile/; {----->                                                                            
    WHILEND /submit_qfile/;                                                                                   
                                                                                                              
  PROCEND jmp$submit_qfile;                                                                                   
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$terminate_acquired_qfile', EJECT ??                                         
*copy jmh$terminate_acquired_qfile                                                                            
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$terminate_acquired_qfile                                                        
    (    application_name: ost$name;                                                                          
     VAR system_file_name: jmt$system_supplied_name;                                                          
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      delete_qfile: boolean,                                                                                  
      cycle_selector: pft$cycle_selector,                                                                     
      ignore_status: ost$status,                                                                              
      path_p: ^pft$path,                                                                                      
      password: pft$password,                                                                                 
      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_qfile (application_name, system_file_name, delete_qfile, status);                  
    IF NOT status.normal THEN                                                                                 
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    IF delete_qfile THEN                                                                                      
      determine_file_path (system_file_name, path_p);                                                         
                                                                                                              
      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_qfile;                                                                       
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$terminate_qfile', EJECT ??                                                  
*copy jmh$terminate_qfile                                                                                     
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$terminate_qfile                                                                 
    (    system_file_name: jmt$system_supplied_name;                                                          
         termination_options_p: ^jmt$qfile_termination_options;                                               
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      caller_id: ost$caller_identifier,                                                                       
      jm_work_area_p: ^jmt$work_area,                                                                         
      local_parameters_p: ^t$mainframe_terq_parameters,                                                       
      mainframes_processed: jmt$rpc_mainframes_processed,                                                     
      number_of_data_packets: ost$non_negative_integers,                                                      
      number_of_qfiles_found: jmt$qfile_status_count,                                                         
      option_index: integer,                                                                                  
      potential_name: jmt$name,                                                                               
      qfile_state_set: jmt$qfile_state_set,                                                                   
      qfile_to_terminate: jmt$name,                                                                           
      scl_name: ost$name,                                                                                     
      status_options_p: ^jmt$qfile_status_options,                                                            
      status_result_size: ost$segment_length,                                                                 
      status_results_keys_p: ^jmt$results_keys,                                                               
      status_results_p: ^jmt$qfile_status_results,                                                            
      status_work_area_p: ^jmt$work_area,                                                                     
      target_mainframe_reached: boolean,                                                                      
      target_options_p: ^SEQ ( * );                                                                           
                                                                                                              
?? 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 ??                                                                                         
    #CALLER_ID (caller_id);                                                                                   
    status.normal := TRUE;                                                                                    
                                                                                                              
{ Set defaults                                                                                                
    qfile_state_set := -$jmt$qfile_state_set [];                                                              
                                                                                                              
{ Override defaults if necessary                                                                              
    IF termination_options_p <> NIL THEN                                                                      
      FOR option_index := 1 TO UPPERBOUND (termination_options_p^) DO                                         
        CASE termination_options_p^ [option_index].key OF                                                     
        = jmc$null_attribute =                                                                                
          ;                                                                                                   
                                                                                                              
        = jmc$qfile_state_set =                                                                               
          IF termination_options_p^ [option_index].qfile_state_set = $jmt$qfile_state_set [] THEN             
            osp$set_status_condition (jme$qfile_state_is_null, status);                                       
            RETURN; {----->                                                                                   
          IFEND;                                                                                              
          qfile_state_set := termination_options_p^ [option_index].qfile_state_set;                           
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (termination_options_p^ [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, 'QFILE_TERMINATION_OPTIONS', status);  
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$terminate_qfile, status);          
          RETURN; {----->                                                                                     
        CASEND;                                                                                               
      FOREND;                                                                                                 
    IFEND;                                                                                                    
                                                                                                              
    potential_name.kind := jmc$system_supplied_name;                                                          
    potential_name.system_supplied_name := system_file_name;                                                  
    jmp$validate_name (potential_name, qfile_to_terminate, status);                                           
    IF NOT status.normal THEN                                                                                 
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    PUSH status_options_p: [1 .. 4];                                                                          
    status_options_p^ [1].key := jmc$system_supplied_name_list;                                               
    PUSH status_options_p^ [1].system_supplied_name_list: [1 .. 1];                                           
    status_options_p^ [1].system_supplied_name_list^ [1] := qfile_to_terminate.system_supplied_name;          
    status_options_p^ [2].key := jmc$qfile_state_set;                                                         
    status_options_p^ [2].qfile_state_set := qfile_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_qfile_status (status_options_p, status_results_keys_p, status_work_area_p, status_results_p,      
          number_of_qfiles_found, status);                                                                    
    IF NOT status.normal THEN                                                                                 
      IF status.condition = jme$no_qfiles_were_found THEN                                                     
        osp$set_status_abnormal (jmc$job_management_id, jme$name_not_found, system_file_name, status);        
      IFEND;                                                                                                  
      RETURN; {----->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    PUSH target_options_p: [[REP (#SIZE (jmt$system_supplied_name) + #SIZE (jmt$qfile_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^.qfile_state_set := qfile_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_qfile,
          {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_qfile;                                                                                
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$terminated_qfile_exists', EJECT ??                                          
*copy jmh$terminated_qfile_exists                                                                             
                                                                                                              
  FUNCTION [XDCL, #GATE] jmp$terminated_qfile_exists                                                          
    (    application_name: ost$name): boolean;                                                                
                                                                                                              
    VAR                                                                                                       
      application_index: jmt$qfile_application_index,                                                         
      qfile_exists: boolean;                                                                                  
                                                                                                              
    application_index := jmv$last_used_application_index;                                                     
    WHILE (jmv$known_qfile_list.application_table [application_index].application_name <>                     
          application_name) AND (application_index <> jmc$unassigned_qfile_index) DO                          
      application_index := application_index - 1;                                                             
    WHILEND;                                                                                                  
                                                                                                              
    qfile_exists := (application_index <> jmc$unassigned_qfile_index) AND                                     
          (jmv$known_qfile_list.application_table [application_index].                                        
          state_data [jmc$kql_application_terminated].number_of_entries > 0);                                 
    jmp$terminated_qfile_exists := qfile_exists AND (NOT syp$system_is_idling ());                            
                                                                                                              
  FUNCEND jmp$terminated_qfile_exists;                                                                        
?? OLDTITLE ??                                                                                                
?? NEWTITLE := '[XDCL, #GATE] jmp$update_qfile_status', EJECT ??                                              
*copy jmh$update_qfile_status                                                                                 
                                                                                                              
  PROCEDURE [XDCL, #GATE] jmp$update_qfile_status                                                             
    (    system_file_name: jmt$system_supplied_name;                                                          
         application_name: ost$name;                                                                          
         qfile_password: jmt$queue_file_password;                                                             
         qfile_status_updates_p: ^jmt$qfile_status_updates;                                                   
     VAR status: ost$status);                                                                                 
                                                                                                              
    VAR                                                                                                       
      attribute_choices_p: ^t$qfile_appl_attribute_choices,                                                   
      attribute_work_area_p: ^jmt$work_area,                                                                  
      attributes_size: jmt$qsl_appl_attr_contents_size,                                                       
      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$qfile_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_qfile_access (system_file_name, application_name, qfile_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 (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 queue file's system label                                                                          
    qfp$read_qfile_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 qfile_status_updates_p <> NIL THEN                                                                     
                                                                                                              
{ Get the application attributes from the label.                                                              
      PUSH attribute_choices_p;                                                                               
      PUSH attribute_work_area_p: [[REP jmc$max_qfile_appl_attr_size OF cell]];                               
      unpack_application_attributes (^system_label, attribute_choices_p, attribute_work_area_p, status);      
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
                                                                                                              
    /process_changes/                                                                                         
      FOR update_index := 1 TO UPPERBOUND (qfile_status_updates_p^) DO                                        
        CASE qfile_status_updates_p^ [update_index].key OF                                                    
        = jmc$application_attributes_1, jmc$application_attributes_2, jmc$application_attributes_3,           
              jmc$application_attributes_4, jmc$application_attributes_5, jmc$application_attributes_6,       
              jmc$application_attributes_7, jmc$application_attributes_8, jmc$application_attributes_9,       
              jmc$application_attributes_10 =                                                                 
          attribute_choices_p^ [qfile_status_updates_p^ [update_index].key].application_attributes :=         
                qfile_status_updates_p^ [update_index].application_attributes;                                
        = jmc$application_status =                                                                            
          IF qfile_status_updates_p^ [update_index].application_status = NIL THEN                             
            system_label.application_status.normal := TRUE;                                                   
          ELSE                                                                                                
            system_label.application_status := qfile_status_updates_p^ [update_index].application_status^;    
          IFEND;                                                                                              
                                                                                                              
        = jmc$null_attribute =                                                                                
          ;                                                                                                   
                                                                                                              
        ELSE                                                                                                  
          jmp$get_attribute_name (qfile_status_updates_p^ [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, 'QFILE_STATUS_UPDATES_P', status);     
          osp$append_status_parameter (osc$status_parameter_delimiter, jmc$update_qfile_status, status);      
          EXIT /process_changes/; {----->                                                                     
        CASEND;                                                                                               
      FOREND /process_changes/;                                                                               
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
                                                                                                              
{ Put the application attributes in the system label.                                                         
      pack_application_attributes (attribute_choices_p, ^system_label, attributes_size, status);              
      IF NOT status.normal THEN                                                                               
        amp$return (local_file_name, ignore_status);                                                          
        RETURN; {----->                                                                                       
      IFEND;                                                                                                  
                                                                                                              
{ Write the result system label to the queue file                                                             
      qfp$write_qfile_system_label (local_file_name, { write_label } TRUE, system_label, attributes_size,     
            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_qfile_status;                                                                            
?? OLDTITLE ??                                                                                                
MODEND jmm$generic_queue_file_manager;                                                                        
