



		    convert_MR10_2_audit_flags_.pl1 01/26/85  1332.8r w 01/22/85  1240.5       59562



/*  ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1984 *
   *                                                         *
   *********************************************************** */

/* format: style1,^inddcls,^indnoniterdo,insnl,linecom,indcomtxt */

convert_MR10_2_audit_flags_:
     procedure (a_flags);

/* format: off */
	/*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
	/*									*/
	/* CONVERT_MR10_2_AUDIT_FLAGS_						*/
	/*									*/
	/* Routine to convert a set of audit flags from pre-MR11 format to MR11 format.		*/
	/*									*/
	/* RESET_MR10_2_AUDIT_FLAGS_							*/
	/*									*/
	/* Routine to attempt backing-out the changes made by convert_MR10_2_audit_flags_.  (It	*/
	/* is not possible to obtain exactly the original flags).				*/
	/*									*/
	/* Last Modified:								*/
	/* 1984-12-10 EJ Sharpe - initial coding					*/
	/*									*/
	/*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
/* format: on */


dcl     a_flags		 bit (36) aligned parameter;
dcl     1 new_flags		 aligned like audit_flags;
dcl     1 old_flags		 aligned like OLD_audit_flags;

dcl     string		 builtin;
dcl     unspec		 builtin;
%page;

/* pre-MR11 flag definition */

dcl     1 OLD_audit_flags	 aligned based,		/* These flags control which auditable protection
						   events do in fact produce audit entries in
						   the syserr or other logs for this process */
	2 ring_0_flags	 unaligned,		/* Flags checked by ring 0 */
	( 3 protected_seg_init,			/* ON => audit initiations of non-directory
						   segments with non-null access class
						   (not including ring 1 multi-class segments) */
	  3 protected_dir_init,			/* ON => audit making known of directories
						   with non-null access class */
	  3 r1_multi_class_init,			/* ON => audit initiaions of ring 1 multi-class
						   segments.  (This flag is OFF when ring 1
						   is doing its own auditing) */
	  3 access_denied,				/* ON => audit instances of access denied
						   to segments or directories due to improper
						   authorization, ACL mode, or ring validation level */
	  3 illegal_proc,				/* ON => audit illegal procedure faults
						   (except legal EIS faults) */
	  3 access_viol_mode,			/* ON => audit ACL mode related
						   access violation faults */
	  3 access_viol_ring,			/* ON => audit ring related
						   access violation faults */
	  3 wakeup_denied,				/* ON => audit unsuccessful attempts to send
						   IPC messages due to improper authorization */
	  3 sys_privilege,				/* ON => audit changing of special privileges
						   (including setting of system privilege bits,
						   privileged initiations) */
	  3 SSA_ops,				/* ON => audit SSA downgrade, turning
						   security-oos off, other security related operations */
	  3 attach_denied,				/* ON => audit denied attachment of devices
						   (disk and tape drives) in ring 0 */
	  3 pad		 (7)
	  )		 bit (1),			/* Reserved for expansion of ring 0
						   audit selectivity */

	2 ring_1_flags	 unaligned,		/* Flags checked by ring 1 */
	( 3 mount_denied,				/* ON => audit instances of denied
						   mounts of media (disk and tape) */
	  3 mseg_events,				/* ON => audit protection events concerning
						   message segments (overflows) */
	  3 comm_events,				/* ON => audit use of communications AIM privilege */
	  3 pad		 (15)
	  )		 bit (1);			/* Reserved for expansion of ring 1
						   audit selectivity */
%page;
/* MR11 audit flag definition */

%include access_audit_flags;
%page;

	string (old_flags) = a_flags;
	unspec (new_flags) = ""b;

/****
      We really should check the input flags for validity, however,
      we also want badly to succeed.  Thus, we'll just ignore
      any garbage in the pad fields:
      if  string(old_flags.ring_0_flags.pad) ^= ""b
      | string(old_flags.ring_1_flags.pad) ^= ""b
      then grin_and_bear_it;
*/

	if old_flags.protected_seg_init
	     | old_flags.protected_dir_init
	     | old_flags.r1_multi_class_init
	     | old_flags.access_denied
	then new_flags.objects (FSOBJ_AUDIT_OBJECT_INDEX).deny_level = READ;

	if old_flags.access_denied
	then new_flags.objects (FSATTR_AUDIT_OBJECT_INDEX).deny_level = READ;

	if old_flags.illegal_proc
	     | old_flags.access_viol_mode
	     | old_flags.access_viol_ring
	then new_flags.faults = "1"b;

	if old_flags.wakeup_denied
	then new_flags.objects (SPECIAL_AUDIT_OBJECT_INDEX).deny_level = MODIFY;

	if old_flags.sys_privilege
	then new_flags.priv_ops = "1"b;

	if old_flags.SSA_ops
	then new_flags.admin_ops = "1"b;

	if old_flags.attach_denied
	     | old_flags.mount_denied
	then new_flags.objects (RCP_AUDIT_OBJECT_INDEX).deny_level = READ;

	if old_flags.mseg_events
	     | old_flags.comm_events
	then new_flags.objects (OTHER_AUDIT_OBJECT_INDEX).deny_level = READ;

	a_flags = unspec (new_flags);

	return;
%page;

/* RESET_MR10_2_AUDIT_FLAGS_ - entry to convert MR11 flags back to pre-MR11 format */

reset_MR10_2_audit_flags_:
     entry (a_flags);

	string (old_flags) = ""b;
	unspec (new_flags) = a_flags;

/****
      We really should check the input flags for validity, however,
      we also want badly to succeed.  Thus, we'll just ignore
      any illegal values:
      if  new_flags.pad ^= ""b
      | new_flags.objects(FSOBJ_AUDIT_OBJECT_INDEX).grant_level = MODIFY_ACCESS
      | new_flags.objects(FSOBJ_AUDIT_OBJECT_INDEX).deny_level = MODIFY_ACCESS
      then grin_and_bear_it;
*/

	if new_flags.objects (FSOBJ_AUDIT_OBJECT_INDEX).deny_level ^= NONE
	then old_flags.protected_seg_init,
		old_flags.protected_dir_init,
		old_flags.r1_multi_class_init,
		old_flags.access_denied = "1"b;

	if new_flags.objects (FSATTR_AUDIT_OBJECT_INDEX).deny_level ^= NONE
	then old_flags.access_denied = "1"b;

	if new_flags.faults
	then old_flags.illegal_proc,
		old_flags.access_viol_mode,
		old_flags.access_viol_ring = "1"b;

	if new_flags.objects (SPECIAL_AUDIT_OBJECT_INDEX).deny_level > MODIFY_ACCESS
	then old_flags.wakeup_denied = "1"b;

	if new_flags.priv_ops
	then old_flags.sys_privilege = "1"b;

	if new_flags.admin_ops
	then old_flags.SSA_ops = "1"b;

	if new_flags.objects (RCP_AUDIT_OBJECT_INDEX).deny_level ^= NONE
	then old_flags.attach_denied,
		old_flags.mount_denied = "1"b;

	if new_flags.objects (OTHER_AUDIT_OBJECT_INDEX).deny_level ^= NONE
	then old_flags.mseg_events,
		old_flags.comm_events = "1"b;

	a_flags = string (old_flags);

	return;


     end convert_MR10_2_audit_flags_;
  



		    convert_MR10_2_mail_table.pl1   12/05/84  1349.9rew 12/05/84  0854.0       22563



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1984 *
   *                                                         *
   *********************************************************** */
/* CONVERT_MR10_2_MAIL_TABLE: Program to convert a MR10.2 MAIL_TABLE to
   a MR11 MAIL_TABLE.  MR11 MAIL_TABLEs are Version 3 MSTBs rather than
   Version 2.  The format of the MAIL_TABLE entries themselves has not 
   changed. */

/* format: style2 */
/* Written 1984-08-06 by Eric Swenson */

convert_MR10_2_mail_table:
     procedure options (variable);

/* Automatic */

	dcl     argument_idx	 fixed bin (17);
	dcl     argument_lth	 fixed bin (21);
	dcl     argument_ptr	 ptr;
	dcl     code		 fixed bin (35);
	dcl     dirname		 char (168);
	dcl     entryname		 char (32);
	dcl     n_arguments		 fixed bin (17);
	dcl     pathname		 char (168);	/* Based */

	dcl     argument		 char (argument_lth) based (argument_ptr);

/* External Entries */

	dcl     com_err_		 entry () options (variable);
	dcl     cu_$arg_count	 entry (fixed bin, fixed bin (35));
	dcl     cu_$arg_ptr		 entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
	dcl     expand_pathname_	 entry (char (*), char (*), char (*), fixed bin (35));
	dcl     ioa_		 entry options (variable);
	dcl     mail_table_priv_$convert_v2_mail_table
				 entry (char (*), char (*), fixed bin (35));
	dcl     pathname_		 entry (char (*), char (*)) returns (char (168));

/* Constant */

	dcl     ME		 char (32) initial ("convert_MR10_2_mail_table") internal static
				 options (constant);
%page;
/* Program */

	call cu_$arg_count (n_arguments, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME);
		return;
	     end;

	if n_arguments = 0
	then do;
		call com_err_ (0, ME, "Usage: ^a pathname_of_mail_table_to_convert", ME);
		return;
	     end;

	call cu_$arg_ptr (1, argument_ptr, argument_lth, (0));
	call expand_pathname_ (argument, dirname, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", argument);
		return;
	     end;

	pathname = pathname_ (dirname, entryname);
	call ioa_ ("^a: Converting ^a.", ME, pathname);
	call mail_table_priv_$convert_v2_mail_table (dirname, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "Converting ^a", pathname);
		return;
	     end;
	call ioa_ ("^a: Finished conversion of ^a.", ME, pathname);
	return;

     end convert_MR10_2_mail_table;
 



		    convert_MR10_2_pdts.pl1         07/13/88  1238.1r w 07/13/88  0943.1       52524



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1982 *
   *                                                         *
   * Copyright (c) 1972 by Massachusetts Institute of        *
   * Technology and Honeywell Information Systems, Inc.      *
   *                                                         *
   *********************************************************** */


/* format: style2 */
/* convert_MR10_2_pdts - program to set MR11 PDT default values in live pdts.

   1) authorization ranges

   82-03-12  E. N. Kittlitz. stolen from cv_MR9_pdts.
   84-07-05  BIM stolen from cv_MR10_pdts
*/

convert_MR10_2_pdts:
     procedure;


/* automatic */

	dcl     arg_count		 fixed bin;
	dcl     alp		 pointer;
	dcl     ap		 pointer;
	dcl     al		 fixed bin (21);
	dcl     (pdtp, pdtep)	 ptr;
	dcl     (namex, i)		 fixed bin;
	dcl     name		 char (32);
	dcl     code		 fixed bin (35);
	dcl     bit_count		 fixed bin (24);
	dcl     pdt_directory	 char (168);
	dcl     area_ptr		 ptr;

/* based */

	dcl     argument		 char (al) based (ap);

/* builtins */

	dcl     (addr, null, sum)	 builtin;

/* entries */

	dcl     absolute_pathname_	 entry (character (*), character (*), fixed binary (35));
	dcl     cu_$arg_list_ptr	 entry (ptr);
	dcl     cu_$arg_count_rel	 entry (fixed bin, ptr, fixed bin (35));
	dcl     cu_$arg_ptr_rel	 entry (fixed bin, ptr, fixed bin (21), fixed bin (35), ptr);
	dcl     hcs_$star_		 entry (char (*), char (*), fixed bin, ptr, fixed bin, ptr, ptr, fixed bin (35));
	dcl     initiate_file_	 entry (character (*), character (*), bit (*), pointer, fixed binary (24),
				 fixed binary (35));
	dcl     terminate_file_	 entry (pointer, fixed binary (24), bit (*), fixed binary (35));
	dcl     get_system_free_area_	 entry (ptr);
	dcl     com_err_		 entry options (variable);

/* based */

	dcl     system_area		 area (65536 + 24) aligned based (area_ptr);

/* include files */

%include access_mode_values;
%include pdt;
%include star_structures;
%include user_attributes;
%include terminate_file;
%page;

/* program */

	call cu_$arg_list_ptr (alp);
	call do_work (alp, "convert_MR10_2_pdts", format_pdt);
	return;

reset_MR10_2_pdts:
     entry options (variable);

	call cu_$arg_list_ptr (alp);
	call do_work (alp, "reset_MR10_2_pdts", reset_pdt);
	return;


do_work:
     procedure (arg_list_ptr, me, worker_proc);

	declare arg_list_ptr	 pointer;
	declare me		 char (*);
	declare worker_proc		 entry variable;

	call cu_$arg_count_rel (arg_count, arg_list_ptr, code);
	if code ^= 0
	then do;
		call com_err_ (code, me);
		return;
	     end;

	if arg_count ^= 1
	then do;
		call com_err_ (0, me, "Usage: ^a PDT_DIR_PATHNAME", me);
		return;
	     end;

	call cu_$arg_ptr_rel (1, ap, al, (0), arg_list_ptr);
	call absolute_pathname_ (argument, pdt_directory, code);
	if code ^= 0
	then do;
		call com_err_ (code, me, "^a", argument);
		return;
	     end;

	call get_system_free_area_ (area_ptr);
	call map_over_pdts (pdt_directory, worker_proc);
	return;

/* Internal procedure to format all pdts in a given directory */

map_over_pdts:
     procedure (bv_pdt_dir, formatter);

/* parameters */

	dcl     bv_pdt_dir		 char (*) parameter;
	dcl     formatter		 entry (char (*), char (*), char (*)) variable;

/* program */

	call hcs_$star_ (bv_pdt_dir, "**.pdt", 3, area_ptr, star_entry_count, star_entry_ptr, star_names_ptr, code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_MR10_2_pdts", "^a", bv_pdt_dir);
		return;
	     end;

	do namex = 1 to star_entry_count;
	     name = star_names (star_entries.nindex (namex));
	     call formatter (me, bv_pdt_dir, name);
	end;

	free star_names in (system_area);
	free star_entries in (system_area);
	return;



/* This internal procedure initializes a single PDT.  All PDT entries
   which have ever been used are modified; not just those which are presently
   active.  For MR11, initialize authorization ranges. */


     end map_over_pdts;
     end do_work;


format_pdt:
     proc (me, bv_pdt_dirname, bv_pdt_name);

/* parameters */

	dcl     me		 char (*);
	dcl     (bv_pdt_dirname, bv_pdt_name)
				 char (*) parameter;



/* program */

	call initiate_file_ (bv_pdt_dirname, bv_pdt_name, RW_ACCESS, pdtp, bit_count, code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_MR10_2_pdts", "^a>^a", bv_pdt_dirname, bv_pdt_name);
		return;
	     end;

	if pdt.version = PDT_version
	then go to TERM_RETURN;			/* already done */
	pdt.version = -1;				/* broken while in transition */
	do i = 1 to pdt.current_size;
	     pdtep = addr (pdt.user (i));
	     user.user_authorization (1) = ""b;		/* system_low */
	     user.user_authorization (2) = user.pad_was_authorization;
	     user.pad_was_authorization = ""b;
	end;
	pdt.version = PDT_version;
TERM_RETURN:
	call terminate_file_ (pdtp, (0), TERM_FILE_TERM, code);

	return;

     end format_pdt;

reset_pdt:
     proc (me, bv_pdt_dirname, bv_pdt_name);

/* parameters */

	dcl     me		 char (*);
	dcl     (bv_pdt_dirname, bv_pdt_name)
				 char (*) parameter;



/* program */

	call initiate_file_ (bv_pdt_dirname, bv_pdt_name, RW_ACCESS, pdtp, bit_count, code);
	if code ^= 0
	then do;
		call com_err_ (code, me, "^a>^a", bv_pdt_dirname, bv_pdt_name);
		return;
	     end;

	if pdt.version = PDT_version - 1		/* already reset */
	then go to TERM_RETURN;
	pdt.version = -1;				/* broken while in transition */
	do i = 1 to pdt.current_size;
	     pdtep = addr (pdt.user (i));
	     user.pad_was_authorization = user.user_authorization (2);
	     user.user_authorization (*) = ""b;
	end;
	pdt.version = PDT_version - 1;
TERM_RETURN:
	call terminate_file_ (pdtp, (0), TERM_FILE_TERM, code);

	return;

     end reset_pdt;
     end convert_MR10_2_pdts;




		    convert_MR10_2_pnt.pl1          12/05/84  1350.0rew 12/05/84  0854.0       23013



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1984 *
   *                                                         *
   *********************************************************** */
/* CONVERT_MR10_2_PNT: This program converts a MR10.2 PNT to an MR11 PNT.
   MR11 PNTs use Version 3 MSTBs for better integrity and use a new format
   PNT entry which accomodates longer passwords, AIM ranges, and a version
   number (currently 2). */

/* format: style2 */

/* Written 1984-08-08 by E. Swenson */
/* Modified 1984-09-18 by E. Swenson to use pnt_admin_gate_. */

convert_MR10_2_pnt:
     procedure options (variable);

/* Automatic */

	dcl     argument_idx	 fixed bin (17);
	dcl     argument_lth	 fixed bin (21);
	dcl     argument_ptr	 ptr;
	dcl     code		 fixed bin (35);
	dcl     dirname		 char (168);
	dcl     entryname		 char (32);
	dcl     n_arguments		 fixed bin (17);
	dcl     pathname		 char (168);

/* Based */

	dcl     argument		 char (argument_lth) based (argument_ptr);

/* External Entries */

	dcl     com_err_		 entry () options (variable);
	dcl     cu_$arg_count	 entry (fixed bin, fixed bin (35));
	dcl     cu_$arg_ptr		 entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
	dcl     expand_pathname_	 entry (char (*), char (*), char (*), fixed bin (35));
	dcl     ioa_		 entry options (variable);
	dcl     pnt_admin_gate_$convert_v2_pnt
				 entry (char (*), char (*), fixed bin (35));
	dcl     pathname_		 entry (char (*), char (*)) returns (char (168));

/* Constant */

	dcl     ME		 char (32) initial ("convert_MR10_2_pnt") internal static options (constant);
%page;
/* Program */

	call cu_$arg_count (n_arguments, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME);
		return;
	     end;

	if n_arguments = 0
	then do;
		call com_err_ (0, ME, "Usage: ^a pathname_of_pnt_to_convert", ME);
		return;
	     end;

	call cu_$arg_ptr (1, argument_ptr, argument_lth, (0));
	call expand_pathname_ (argument, dirname, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", argument);
		return;
	     end;

	pathname = pathname_ (dirname, entryname);

	call ioa_ ("^a: Beginning conversion of ^a.", ME, pathname);
	call pnt_admin_gate_$convert_v2_pnt (dirname, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "Converting ^a", pathname);
		return;
	     end;
	call ioa_ ("^a: Finished conversion of ^a.", ME, pathname);
	return;

     end convert_MR10_2_pnt;
   



		    convert_MR10_2_projfile.pl1     04/09/85  1521.7r w 04/08/85  1134.5       36720



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1983 *
   *                                                         *
   *********************************************************** */
/* convert_MR10_2_projfile.pl1 -- converts to MR11 projfile-entry format */
/* To be run over >udd>sa>a>projfile  */
/* format: style2 */

/* BIM 1984-07-05 */
/* Modified 1984-09-14 to detect double-conversions */

convert_MR10_2_projfile:
     procedure options (variable);

	declare com_err_		 entry () options (variable);
	declare cu_$arg_count	 entry (fixed bin, fixed bin (35));
	declare cu_$arg_ptr		 entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
	declare expand_pathname_	 entry (character (*), character (*), character (*), fixed binary (35));
	declare get_temp_segment_	 entry (character (*), pointer, fixed binary (35));
	declare initiate_file_	 entry (character (*), character (*), bit (*), pointer, fixed binary (24),
				 fixed binary (35));
	declare pathname_		 entry (character (*), character (*)) returns (character (168));
	declare release_temp_segment_	 entry (character (*), pointer, fixed binary (35));
	declare terminate_file_	 entry (pointer, fixed binary (24), bit (*), fixed binary (35));


	declare arg_count		 fixed bin;
	declare ap		 pointer;
	declare al		 fixed bin (21);
	declare argument		 char (al) based (ap);
	declare code		 fixed bin (35);
	declare dir_name		 char (168);
	declare entryname		 char (32);
	declare (pp, old_pp)	 pointer;
	declare projfileex		 fixed bin;

	declare ME		 char (32) init ("convert_MR10_2_projfile") int static options (constant);

%include projfile;
%include access_mode_values;
%include terminate_file;

/**** MR10.2 projfile structure */

	dcl     1 old_projfile	 based (old_pp) aligned,
						/* Project history file */
		2 nproj		 fixed bin (35),	/* number of entries */
		2 projfilexx0_1	 (7) bit (36) aligned,
		2 projfiletab	 (3000),
		  3 id		 char (12),	/* project ID */
		  3 title		 char (52),	/* project title */
		  3 inv		 char (32),	/* name of principal investigator */
		  3 inv_addr	 char (32),	/* address */
		  3 sup		 char (32),	/* name of supervisor */
		  3 sup_addr	 char (32),	/* address */
		  3 sup_phone	 char (16),	/* telephone */
		  3 on		 fixed bin (71),	/* date on */
		  3 off		 fixed bin (71),	/* date off */
		  3 disk_psec	 fixed bin (71),	/* project disk page-seconds */
		  3 disk_quota	 fixed bin (35),	/* project disk quota */
		  3 disk_use	 fixed bin (35),	/* total segment pages used */
		  3 dir_disk_use	 fixed bin (35),	/* total directory pages used */
		  3 misc_charges	 float bin,	/* manuals, etc */
		  3 n_misc	 fixed bin,	/* number of entries */
		  3 processed	 fixed bin;	/* temp for usage-report */


	call cu_$arg_count (arg_count, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME);
		return;
	     end;

	if arg_count ^= 1
	then do;
		call com_err_ (0, ME, "Usage: ^a PROJFILE_PATH", ME);
		return;
	     end;

	pp, old_pp = null ();

	call cu_$arg_ptr (1, ap, al, (0));
	call expand_pathname_ (argument, dir_name, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", argument);
		return;
	     end;

	call initiate_file_ (dir_name, entryname, RW_ACCESS, old_pp, (0), code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", pathname_ (dir_name, entryname));
		return;
	     end;

	if old_pp -> projfile.version = PROJFILE_VERSION
	then do;
		call com_err_ (0, ME, "^a has already been converted to version ^d.", pathname_ (dir_name, entryname),
		     PROJFILE_VERSION);
		call terminate_file_ (old_pp, (0), TERM_FILE_TERM, (0));
		return;
	     end;
	call get_temp_segment_ (ME, pp, (0));

	projfile = old_projfile, by name;
	projfile.version = PROJFILE_VERSION;
	old_pp -> projfile = projfile;
	call terminate_file_ (old_pp, (loph + (old_pp -> projfile.nproj * lope)) * 36, TERM_FILE_TRUNC_BC_TERM, (0));
	call release_temp_segment_ (ME, pp, (0));
	return;
     end convert_MR10_2_projfile;




		    convert_MR10_2_reqfile.pl1      05/14/85  1132.6rew 05/14/85  1047.8       22932



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1984 *
   *                                                         *
   *********************************************************** */
/* convert_MR10_2_reqfile.pl1 -- converts to MR11 reqfile-entry format */
/* To be run over >udd>sa>a>reqfile  */
/* format: style2 */

/* BIM 1984-07-05 */
/* Modified 1985-04-24 by E. Swenson to terminate the reqfile properly. */

convert_MR10_2_reqfile:
     procedure options (variable);

	declare com_err_		 entry () options (variable);
	declare cu_$arg_count	 entry (fixed bin, fixed bin (35));
	declare cu_$arg_ptr		 entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
	declare expand_pathname_	 entry (character (*), character (*), character (*), fixed binary (35));
	declare get_temp_segment_	 entry (character (*), pointer, fixed binary (35));
	declare initiate_file_	 entry (character (*), character (*), bit (*), pointer, fixed binary (24),
				 fixed binary (35));
	declare pathname_		 entry (character (*), character (*)) returns (character (168));
	declare release_temp_segment_	 entry (character (*), pointer, fixed binary (35));
	declare terminate_file_	 entry (pointer, fixed binary (24), bit (*), fixed binary (35));


	declare arg_count		 fixed bin;
	declare ap		 pointer;
	declare al		 fixed bin (21);
	declare argument		 char (al) based (ap);
	declare code		 fixed bin (35);
	declare dir_name		 char (168);
	declare entryname		 char (32);
	declare qp		 pointer;
	declare reqfileex		 fixed bin;

	declare ME		 char (32) init ("convert_MR10_2_reqfile") int static options (constant);

%include reqfile;
%include access_mode_values;
%include terminate_file;


	call cu_$arg_count (arg_count, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME);
		return;
	     end;

	if arg_count ^= 1
	then do;
		call com_err_ (0, ME, "Usage: ^a REQFILE_PATH.reqfile", ME);
		return;
	     end;

	qp = null ();

	call cu_$arg_ptr (1, ap, al, (0));
	call expand_pathname_ (argument, dir_name, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", argument);
		return;
	     end;

	call initiate_file_ (dir_name, entryname, RW_ACCESS, qp, (0), code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", pathname_ (dir_name, entryname));
		return;
	     end;

	reqfile.version = REQFILE_VERSION;
	call terminate_file_ (qp, (0), TERM_FILE_TERM, (0));
	return;
     end convert_MR10_2_reqfile;




		    convert_MR10_2_sat.pl1          07/13/88  1238.1r w 07/13/88  0943.1       62874



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1983 *
   *                                                         *
   *********************************************************** */
/* convert_MR10_2_sat.pl1 -- converts to MR11 SAT-entry format */
/* To be run over >udd>sa>a>smf.cur.sat and >sc1>sat */
/* format: style2 */

/* BIM 1984-07-05 */
/* Modified 1984-09-14 BIM to unalign old "groups" */
/* Modified 1984-12-14 by EJ Sharpe to call (convert reset)_MR10_2_audit_flags_ */

convert_MR10_2_sat:
     procedure options (variable);

	declare com_err_		 entry () options (variable);
	declare convert_MR10_2_audit_flags_ entry (bit (36) aligned);
	declare cu_$arg_count_rel	 entry (fixed bin, ptr, fixed bin (35));
	declare cu_$arg_ptr_rel	 entry (fixed bin, ptr, fixed bin (21), fixed bin (35), ptr);
	declare cu_$arg_list_ptr	 entry (ptr);
	declare expand_pathname_	 entry (character (*), character (*), character (*), fixed binary (35));
	declare initiate_file_	 entry (character (*), character (*), bit (*), pointer, fixed binary (24),
				 fixed binary (35));
	declare pathname_		 entry (character (*), character (*)) returns (character (168));
	declare reset_MR10_2_audit_flags_ entry (bit (36) aligned);
	declare terminate_file_	 entry (pointer, fixed binary (24), bit (*), fixed binary (35));


	declare arg_count		 fixed bin;
	declare ap		 pointer;
	declare al		 fixed bin (21);
	declare alp		 pointer;
	declare argument		 char (al) based (ap);
	declare code		 fixed bin (35);
	declare dir_name		 char (168);
	declare entryname		 char (32);
	declare old_authorization	 bit (72) aligned;
	declare (satp, satep)	 pointer;		/* live */
	declare satex		 fixed bin;

%include sat;
%include user_attributes;
%include access_mode_values;
%include terminate_file;

	declare 1 new_project	 aligned like project;

/**** MR10.2 sat entry structure */

/**** The entry size does not change in this change, but the variables
      are rearranged. */

	dcl     1 old_project	 aligned,		/* declaration of a single SAT entry  */
		2 state		 fixed bin,	/* state 1 = normal, 0 = free, 2 = deleted */
		2 project_id	 char (12) aligned, /* project's name */
		2 project_dir	 char (64) aligned, /* project's directory */
		2 pdt_ptr		 pointer,		/* pointer to current PDT */
		2 max_users	 fixed bin,	/* maximum number of users from project */
		2 n_users		 fixed bin,	/* current number */
		2 at		 like user_attributes aligned,
						/* include user_attributes.incl.pl1 */
		2 admin		 (4) aligned,	/* list of project's administrators  */
		  3 userid	 char (30) unal,	/* administrator's user-id (personid.projectid) */
		  3 pad		 char (2) unal,
		2 cutoff		 char (1),	/* if project is cut off, why. */
		2 min_ring	 fixed bin,	/* lowest ring for project */
		2 max_ring	 fixed bin,	/* highest ring for project */
		2 alias		 char (8),	/* project alias */
		2 group		 char (8),	/* default group for this project */
		2 grace_max	 fixed bin,	/* maximum bump grace */
		2 audit		 bit (36),	/* audit flags for project */
		2 project_authorization_1
				 bit (72),	/* authorization of this project */
		2 groups		 (2) char (8) unal,	/* authorized groups for this project */
		2 days_to_cutoff	 fixed bin (17) unaligned,
						/* these figures are as of last running of daily_summary */
		2 pct_balance	 fixed bin (17) unaligned,
						/* they are used for warning message printing only */
		2 dollars_to_cutoff	 float bin,	/* and are not to be taken as up-to-date figures */
		2 pdir_quota	 fixed bin (17) unaligned,
						/* max pdir quota allowed for project */
		2 max_foreground	 fixed bin (9) unsigned unaligned,
						/* max simultaneous foreground and background */
		2 max_background	 fixed bin (9) unsigned unaligned,
						/* processes that a user on this project can have */
		2 abs_foreground_cpu_limit
				 fixed bin (17) unaligned,
						/* time limit on foreground absentee jobs */
		2 rs_number	 fixed bin (9) unsigned unaligned,
						/* rate structure number (0=default rates ) */
		2 satpad1		 fixed bin (9) unsigned unaligned,
		2 satpad_1	 (3) fixed bin,	/* pad to 80 words */
		2 chain		 fixed bin;	/* if free entry, chain */


	call cu_$arg_list_ptr (alp);
	call do_work ("convert_MR10_2_sat", alp, converter, SAT_version);
	return;

reset_MR10_2_sat:
     entry options (variable);

	call cu_$arg_list_ptr (alp);
	call do_work ("reset_MR10_2_sat", alp, reverter, SAT_version - 1);
	return;

do_work:
     procedure (ME, alp, worker, target_version);
	declare alp		 ptr;
	declare ME		 char (*);
	declare worker		 entry (ptr) variable;
	declare target_version	 fixed bin;

	call cu_$arg_count_rel (arg_count, alp, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME);
		return;
	     end;

	if arg_count ^= 1
	then do;
		call com_err_ (0, ME, "Usage: ^a SAT_PATH.sat", ME);
		return;
	     end;

	satp = null ();

	call cu_$arg_ptr_rel (1, ap, al, (0), alp);
	call expand_pathname_ (argument, dir_name, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", argument);
		return;
	     end;

	call initiate_file_ (dir_name, entryname, RW_ACCESS, satp, (0), code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", pathname_ (dir_name, entryname));
		return;
	     end;


	if sat.version = target_version
	then do;
		call com_err_ (0, ME, "SAT ^a is already version ^d.", pathname_ (dir_name, entryname),
		     target_version);
		go to TERM_RETURN;
	     end;
	if sat.version = -1
	then do;
		call com_err_ (0, ME,
		     "SAT ^a was partially converted, and is notr salvageable. Recover a saved version.",
		     pathname_ (dir_name, entryname));
		go to TERM_RETURN;
	     end;

	sat.version = -1;				/* BROKEN */
	do satex = 1 to sat.current_size;
	     satep = addr (sat.project (satex));
	     if project.state ^= 0
	     then do;				/* worth fixing */
		     call worker (satep);
		end;
	end;

	sat.version = target_version;
TERM_RETURN:
	call terminate_file_ (satp, (0), TERM_FILE_TERM, (0));
	return;
     end do_work;

converter:
     procedure (satep);
	declare satep		 pointer;

	unspec (new_project) = ""b;
	unspec (old_project) = unspec (satep -> project);
	new_project = old_project, by name;
	old_authorization = old_project.project_authorization_1;
	new_project.project_authorization (1) = ""b;
	new_project.project_authorization (2) = old_authorization;
	call convert_MR10_2_audit_flags_ (new_project.audit);
	satep -> project = new_project;
	return;
     end converter;

reverter:
     procedure (satep);
	declare satep		 pointer;

	unspec (old_project) = ""b;
	unspec (new_project) = unspec (satep -> project);
	old_project = new_project, by name;
	old_project.project_authorization_1 = new_project.project_authorization (2);
	call reset_MR10_2_audit_flags_ (old_project.audit);
	unspec (satep -> project) = unspec (old_project);
	return;
     end reverter;
     end convert_MR10_2_sat;
  



		    convert_MR10_2_urf.pl1          12/05/84  1350.0r w 12/05/84  0854.0       33291



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1984 *
   *                                                         *
   *********************************************************** */
/* CONVERT_MR10_2_URF: Program to convert a MR10.2 URF to a MR11 URF.
   MR11 URFs are Version 3 MSTBs rather than Version 1 or 2.  The 
   format of the URF entries themselves has not changed. */

/* format: style2 */
/* Written 1984-07-31 by Eric Swenson */

convert_MR10_2_urf:
     procedure options (variable);

/* Automatic */

	dcl     argument_idx	 fixed bin (17);
	dcl     argument_lth	 fixed bin (21);
	dcl     argument_ptr	 ptr;
	dcl     code		 fixed bin (35);
	dcl     dirname		 char (168);
	dcl     entryname		 char (32);
	dcl     n_arguments		 fixed bin (17);
	dcl     new_entryname	 char (32);
	dcl     old_entryname	 char (32);
	dcl     old_newname		 char (32);

/* Based */

	dcl     argument		 char (argument_lth) based (argument_ptr);

/* External Entries */

	dcl     com_err_		 entry () options (variable);
	dcl     convert_v2_mstb_	 entry (char (*), char (*), char (*), char (*), entry, fixed bin (18) unsigned,
				 fixed bin (35));
	dcl     convert_v2_mstb_$default_convert_proc
				 entry (ptr, ptr, ptr, fixed bin (35));
	dcl     cu_$arg_count	 entry (fixed bin, fixed bin (35));
	dcl     cu_$arg_ptr		 entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
	dcl     expand_pathname_	 entry (char (*), char (*), char (*), fixed bin (35));
	dcl     hcs_$chname_file	 entry (char (*), char (*), char (*), char (*), fixed bin (35));
	dcl     ms_table_mgr_$delete	 entry (char (*), char (*), fixed bin (35));
	dcl     pathname_		 entry (char (*), char (*)) returns (char (168));
	dcl     unique_chars_	 entry (bit (*)) returns (char (15));

/* Constant */

	dcl     ME		 char (32) initial ("convert_MR10_2_urf") internal static options (constant);
	dcl     SAME_SIZE		 fixed bin (18) unsigned internal static options (constant) initial (0);
%page;
/* Program */

	call cu_$arg_count (n_arguments, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME);
		return;
	     end;

	if n_arguments = 0
	then do;
		call com_err_ (0, ME, "Usage: ^a pathname_of_urf_to_convert", ME);
		return;
	     end;

	call cu_$arg_ptr (1, argument_ptr, argument_lth, (0));
	call expand_pathname_ (argument, dirname, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", argument);
		return;
	     end;

	new_entryname = rtrim (substr (entryname, 1, 16)) || "." || unique_chars_ (""b);

	call convert_v2_mstb_ (dirname, entryname, dirname, new_entryname, convert_v2_mstb_$default_convert_proc,
	     SAME_SIZE, code);
	if code ^= 0
	then do;					/* Error occured, delete new table (if created), and rename old one back. */
		call com_err_ (code, ME, "Converting v2 MSTB.");
		return;
	     end;

	old_newname = rtrim (substr (entryname, 1, 16)) || "." || unique_chars_ (""b);

/* Add shriekname to old MSTB */

	call hcs_$chname_file (dirname, entryname, "", old_newname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "Adding shriekname to old MSTB.");
		return;
	     end;

/* Delete real name from old MSTB */

	call hcs_$chname_file (dirname, entryname, entryname, "", code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "Deleting name from old MSTB.");
		return;
	     end;

/* Rename the new one to the real name */

	call hcs_$chname_file (dirname, new_entryname, new_entryname, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "Renaming new MSTB.");
		return;
	     end;

	return;

     end convert_MR10_2_urf;
 



		    convert_MR10_2_use_totals.pl1   08/29/88  0945.7rew 08/29/88  0858.7       95031



/****^  ***********************************************************
        *                                                         *
        * Copyright, (C) Honeywell Bull Inc., 1988                *
        *                                                         *
        * Copyright, (C) Honeywell Information Systems Inc., 1984 *
        *                                                         *
        *********************************************************** */


/****^  HISTORY COMMENTS:
  1) change(88-04-28,GDixon), approve(88-08-15,MCR7969),
     audit(88-08-03,Lippard), install(88-08-29,MR12.2-1093):
      A) Use correct array extents in do-group limits. (phx20016)
                                                   END HISTORY COMMENTS */


/* convert_MR10_2_use_totals.pl1 */
/* format: style2 */

convert_MR10_2_use_totals:
     procedure options (variable);

	declare cv_dec_check_	 entry (character (*), fixed binary (35)) returns (fixed binary (35));
	declare expand_pathname_$add_suffix
				 entry (character (*), character (*), character (*), character (*),
				 fixed binary (35));
	declare initiate_file_	 entry (character (*), character (*), bit (*), pointer, fixed binary (24),
				 fixed binary (35));
	declare terminate_file_	 entry (pointer, fixed binary (24), bit (*), fixed binary (35));
	declare get_temp_segment_	 entry (character (*), pointer, fixed binary (35));
	declare release_temp_segment_	 entry (character (*), pointer, fixed binary (35));
	declare com_err_		 entry () options (variable);
	declare com_err_$suppress_name entry () options (variable);
	declare cu_$arg_count	 entry (fixed bin, fixed bin (35));
	declare cu_$arg_ptr		 entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
	declare pathname_		 entry (character (*), character (*)) returns (character (168));

	declare argp		 pointer;
	declare argl		 fixed bin (21);
	declare argument		 char (argl) based (argp);
	declare arg_count		 fixed bin;
	declare code		 fixed bin (35);
	declare (dayx, qhx, sh)	 fixed bin;
	declare dir		 char (168);
	declare entryname		 char (32);
	declare np		 pointer;		/* pointer to temp seg */
	declare 1 new		 aligned like use_totals based (np);

	declare (addr, hbound, min, null, size)
				 builtin;
	declare cleanup		 condition;
	declare ME		 char (32) init ("convert_MR10_2_use_totals") int static options (constant);


	call cu_$arg_count (arg_count, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME);
		return;
	     end;

	if arg_count ^= 1
	then do;
		call com_err_$suppress_name (0, ME, "Usage:  convert_MR10_2_use_totals USE_TOTALS_PATHNAME");
		return;
	     end;

	np, use_totals_ptr = null ();
	on cleanup
	     begin;
		if use_totals_ptr ^= null ()
		then call terminate_file_ (use_totals_ptr, (0), TERM_FILE_TERM, (0));
		if np ^= null ()
		then call release_temp_segment_ (ME, np, (0));
	     end;

	call cu_$arg_ptr (1, argp, argl, (0));
	call expand_pathname_$add_suffix (argument, "use_totals", dir, entryname, code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, """^a"".", argument);
		return;
	     end;
	call initiate_file_ (dir, entryname, RW_ACCESS, use_totals_ptr, (0), code);
	if code ^= 0
	then do;
		call com_err_ (code, ME, "^a", pathname_ (dir, entryname));
		return;
	     end;

	call get_temp_segment_ (ME, np, (0));

	new.meters = v2_use_totals.meters;		/* aggregately */
	new.version = USE_TOTALS_VERSION_3;
	new.b_and_w.origin = v2_use_totals.b_and_w.origin;
	new.b_and_w.max_day_log = v2_use_totals.b_and_w.max_day_log;
	new.b_and_w.max_qhour = v2_use_totals.b_and_w.max_qhour;
	do dayx = 1 to min (v2_use_totals.max_day_log, hbound (v2_use_totals.daylog, 1));
	     do qhx = 1 to min (v2_use_totals.max_qhour, hbound (v2_use_totals.daylog.qh, 1));
		begin;
		     declare 1 old_qh	      aligned like v2_use_totals.daylog.qh based (old_qhp);
		     declare 1 new_qh	      aligned like use_totals.daylog.qh based (new_qhp);
		     declare (old_qhp, new_qhp)     pointer;
		     old_qhp = addr (v2_use_totals.daylog (dayx).qh (qhx));
		     new_qhp = addr (new.daylog (dayx).qh (qhx));
		     new_qh.time = old_qh.time;
		     new_qh.sysid = old_qh.sysid;
		     if old_qh.erfno = "shutdown"
		     then new_qh.shutdown = "1"b;
		     else new_qh.dump_number = cv_dec_check_ ((old_qh.erfno), code);
		     if code ^= 0
		     then new_qh.dump_number = 0;
		     new_qh.cpu = old_qh.cpu;
		     new_qh.kmem = old_qh.kmem;
		     new_qh.nunits = old_qh.nunits;
		     new_qh.starttime = old_qh.starttime;
		     new_qh.crashtime = old_qh.crashtime;
		end;
	     end;
	end;

	new.bins.ntypes = v2_use_totals.bins.ntypes;
	new.bins.n_select = v2_use_totals.bins.n_select;
	do sh = 1 to min (hbound (new.bin_data, 1), new.bins.n_select);
	     new.bin_data (sh).select_proj = v2_use_totals.select_proj (sh);
	     new.bin_data (sh).select_ut = v2_use_totals.select_ut (sh);
	end;
	do sh = 1 to min (hbound (new.ut, 1), new.bins.ntypes);
	     new.bins.ut (sh) = v2_use_totals.bins.ut (sh);
	end;
	use_totals = new;				/* copy back */
	call terminate_file_ (use_totals_ptr, 36 * size (use_totals), TERM_FILE_TRUNC_BC, (0));
	call release_temp_segment_ (ME, np, (0));
	return;
%page;

%include use_totals;
%include access_mode_values;
%include terminate_file;

	dcl     1 v2_use_totals	 based (use_totals_ptr) aligned,
		2 meters,
		  3 generated	 fixed bin (71),	/* Time usage data generated. */
		  3 period_begin	 fixed bin (71),	/* Earliest time covered */
		  3 period_end	 fixed bin (71),	/* Latest time */
		  3 disk_available	 fixed bin (35),	/* Total disk capacity in MULT partition. */
		  3 disk_left	 fixed bin (35),	/* Total disk unused in MULT partition. */
		  3 version	 char (8),	/* revision of this include file */
		  3 pad1		 (6) fixed bin,	/* Gross system statistics, determined from answering service meters. */
		  3 uptime	 fixed bin (71),	/* Time system has been on the air. */
		  3 sys_starts	 fixed bin,	/* Number of bootloads */
		  3 sys_crash	 fixed bin,	/* Number of crashes */
		  3 cpu_avail	 fixed bin (71),	/* CPU time available. >= uptime by two-cpu time */
		  3 idle		 fixed bin (71),	/* Total idle for all causes */
		  3 initializer	 fixed bin (71),	/* Initializer usage */
		  3 total_cpu	 fixed bin (71),	/* Total VIRTUAL cpu from bins - so get overhead */
		  3 zidle		 fixed bin (71),	/* Total zero idle. */
		  3 mpidle	 fixed bin (71),	/* Total MP idle */
		  3 pad2		 (6) fixed bin (71),/* variables used while reading answering service meters */
		  3 zidle_since_boot fixed bin (71),	/* Zero idle since boot */
		  3 mpidle_since_boot
				 fixed bin (71),	/* MP idle since boot */
		  3 time_last_boot	 fixed bin (71),	/* Time of last bootload */
		  3 time_last_sample fixed bin (71),	/* Time of last 15-minute sample */
		  3 uptime_since_boot
				 fixed bin (71),	/* Time system on air since last boot */
		  3 cpu_avail_since_boot
				 fixed bin (71),	/* CPU available since boot */
		  3 idle_since_boot	 fixed bin (71),	/* Idle time since boot */
		  3 last_sysid	 char (8),	/* Current system ID */
		  3 n_users_on	 fixed bin,	/* Users on at last sample */
		  3 n_stat_gaps	 fixed bin,	/* Number of times we missed getting all data */
						/* Statistics by day, for black and white chart. */
		2 b_and_w,
		  3 origin	 fixed bin (71),	/* Base time for slot 1 */
		  3 max_day_log	 fixed bin,	/* Highest used day. */
		  3 max_qhour	 fixed bin,	/* Highest quarter in highest day */
		  3 daylog	 (40),		/* array of days. */
		    4 qh		 (96),		/* Quarter-hour within the day. */
		      5 time	 fixed bin (71),	/* Time of sample. */
		      5 sysid	 char (8),	/* System ID */
		      5 erfno	 char (8),	/* If crash occurred, ERF no  */
		      5 cpu	 fixed bin (5) unal,/* Number of CPU */
		      5 pad1	 fixed bin (11) unal,
		      5 kmem	 fixed bin (17) unal,
						/* Number of K of core */
		      5 kbulk	 fixed bin (17) unal,
						/* Number fo K of bulk */
		      5 nunits	 fixed bin (17) unal,
						/* Number of load units */
		      5 starttime	 fixed bin (71),	/* Boot time */
		      5 crashtime	 fixed bin (71),	/* Time of crash */
		      5 pad2	 (4) fixed bin,	/* User-classification info, loaded once a month. defines usage bins. bin 1 is always "other" */
		2 bins,
		  3 ntypes	 fixed bin,	/* Number of valid bins */
		  3 n_select	 fixed bin,	/* Number of selectors */
		  3 select_proj	 (3258) char (12) aligned,
						/* Project ID - same number as in sat */
		  3 select_ut	 (3258) fixed bin,	/* Bin number for the project */
		  3 ut		 (301),		/* array usage by project type */
		    4 utype	 char (24),	/* Label for usage bin */
		    4 dollar_charge	 float bin,	/* total dollars spent this month */
		    4 logins	 fixed bin,	/* number of logins */
		    4 crashes	 fixed bin,	/* sessions abnormally terminated */
		    4 nproj	 fixed bin,	/* projects in this class */
		    4 nusers	 fixed bin,	/* users in this class */
		    4 disk_psec	 fixed bin (71),	/* Total page-seconds */
		    4 disk_quota	 fixed bin (35),	/* Total quota */
		    4 disk_usage	 fixed bin (35),	/* Disk occupancy */
		    4 misc	 float bin,	/* Miscellaneous charges */
		    4 flag	 char (4),	/* paying catagories = "$" */
		    4 flag1	 char (4),	/* used to control reporting of catagories */
		    4 pad1a	 (3) fixed bin (35),
		    4 rs_number	 fixed bin,	/* rate structure number for all projects in this bin */
		    4 pad1b	 (14) fixed bin (35),
		    4 interactive	 (0:7),		/* interactive use, shifts 0-7 */
		      5 charge	 float bin,	/* total dollar charge this shift */
		      5 pad1	 fixed bin,
		      5 cpu	 fixed bin (71),	/* cpu usage in microseconds */
		      5 core	 fixed bin (71),	/* core demand in page-microseconds */
		      5 connect	 fixed bin (71),	/* total console time in microseconds */
		      5 io_ops	 fixed bin (71),	/* total terminal i/o ops */
		    4 absentee	 (4),		/* absentee use, queues 1-4 */
		      5 charge	 float bin,	/* dollar charge this queue */
		      5 jobs	 fixed bin,	/* number of jobs submitted */
		      5 cpu	 fixed bin (71),	/* total cpu time in microseconds */
		      5 memory	 fixed bin (71),	/* total memory usage in mu */
		    4 iod		 (4),		/* io daemon use, queues 1-4 */
		      5 charge	 float bin,	/* dollar charge this queue */
		      5 pieces	 fixed bin,	/* pieces of output requested */
		      5 pad2	 fixed bin,
		      5 pages	 fixed bin,	/* number of pages output */
		      5 lines	 fixed bin (71),	/* total record count of output */
		    4 devices	 (16) float bin;	/* device charges */




     end convert_MR10_2_use_totals;
 



		    convert_old_log.pl1             04/09/85  1521.7r w 04/08/85  1134.6      115344



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1982 *
   *                                                         *
   *********************************************************** */

/* format: style5 */
convert_old_log:
        procedure options (variable);


/**** Modification history:
      Created 1984-12-18, BIM: from the old print_log command.
      Modified 1985-01-20, BIM: to be run after the first bootload.
      Modified 1985 Jan 21, Art Beattie: display old log names in error messages
      and as conversion progresses. */

        dcl     absolute_pathname_	entry (character (*), character (*),
				fixed binary (35));
        dcl     expand_pathname_	entry (character (*), character (*),
				character (*), fixed binary (35));
        dcl     initiate_file_	entry (character (*), character (*),
				bit (*), pointer, fixed binary (24),
				fixed binary (35));
        dcl     terminate_file_	entry (pointer, fixed binary (24),
				bit (*), fixed binary (35));
        declare pathname_		entry (character (*), character (*))
				returns (character (168));
        dcl     com_err_		entry options (variable);
        dcl     cu_$arg_list_ptr	entry returns (pointer);
        dcl     ioa_		entry () options (variable);
        declare sub_err_		entry () options (variable);
        declare ssu_$standalone_invocation
				entry (ptr, char (*), char (*), ptr,
				entry, fixed bin (35));
        declare ssu_$destroy_invocation entry (ptr);
        declare ssu_$arg_count	entry (ptr, fixed bin);
        declare ssu_$arg_ptr		entry (ptr, fixed bin, ptr,
				fixed bin (21));
        declare ssu_$abort_line	entry () options (variable);
        dcl     log_read_$open	entry (character (*), character (*),
				pointer, fixed binary (35));
        dcl     log_read_$close	entry (pointer, fixed binary (35));
        dcl     log_write_$open_for_migrate
				entry (character (*), character (*),
				bit (1) aligned, pointer,
				fixed binary (35));
        dcl     log_write_$close	entry (pointer, fixed binary (35));
        dcl     log_write_$general	entry (pointer, fixed binary (35),
				fixed binary, fixed binary,
				character (10) var, pointer,
				fixed binary (35));
        dcl     log_segment_$finish_message
				entry (pointer, pointer,
				fixed binary (35));
        dcl     copy_		entry (pointer);


        dcl     code		fixed bin (35);
        dcl     argument		char (al) based (ap) unaligned;
        dcl     ap			ptr;
        dcl     al			fixed bin (21);
        dcl     old_log_x		fixed bin;
        dcl     an			fixed bin;
        dcl     n_args		fixed bin;
        dcl     total_messages	fixed bin;
        dcl     sci_ptr		pointer;

        dcl     COMMAND_NAME		char (32) int static
				options (constant)
				init ("convert_old_log");
        dcl     error_table_$badopt	ext fixed bin (35);
        dcl     error_table_$too_many_args
				fixed bin (35) ext static;
        dcl     error_table_$noarg	fixed bin (35) ext static;

        dcl     cleanup		condition;
        dcl     no_write_permission	condition;

        declare 1 opt		aligned,
	        2 log_write_ptr	pointer,
	        2 log_read_ptr	pointer,
	        2 pathnames		unaligned,
		3 old_log		unaligned,
		  4 dir_name	char (168),
		  4 entryname	char (32),
		  4 history_dir	char (168),
		3 new_log		unaligned,
		  4 dir_name	char (168),
		  4 entryname	char (32),
		  4 history_dir	char (168),
	        2 n_old_logs	fixed bin,
	        2 old_log_ptrs	(200) pointer,
	        2 old_log_names	(200) char (32);

        declare (addr, length, rtrim)	builtin;


        call ssu_$standalone_invocation (sci_ptr, COMMAND_NAME, "1.0",
	  cu_$arg_list_ptr (), SSU_ABORT, code);
        if code ^= 0 then
	      do;
	      call com_err_ (code, COMMAND_NAME,
		"Failed to create ssu_ invocation");
	      return;
	      end;

        call ssu_$arg_count (sci_ptr, n_args);

        opt.log_write_ptr = null ();
        opt.pathnames = "";
        opt.old_log_ptrs (*) = null ();
        opt.n_old_logs = 0;

        on cleanup call clean_up;

        if n_args = 0 then
	      call ssu_$abort_line (sci_ptr, 0,
		"Usage: ^a OLD_LOG_PATHNAME {-old_history_dir OLD_LOG_DIR_PATH -new_dir NEW_LOG_DIR_PATH -new_history_dir NEW_LOG_HISTORY_PATH}"
		, COMMAND_NAME);

        do an = 1 to n_args;
	      call ssu_$arg_ptr (sci_ptr, an, ap, al);
	      if index (argument, "-") ^= 1 then
		    do;
		    if opt.old_log.dir_name ^= "" then
			  call ssu_$abort_line (sci_ptr,
			      error_table_$too_many_args,
			      "Only one log pathname may be given. ^a is the second."
			      , argument);
		    call expand_pathname_ (argument, opt.old_log.dir_name,
		        opt.old_log.entryname, code);
		    if code ^= 0 then
			  call ssu_$abort_line (sci_ptr, code, "^a",
			      argument);
		    end;
	      else if (argument = "-old_history_dir") | (argument = "-ohd")
		then
		    do;
		    call get_next_arg (
		        "pathname of a dir full of old logs following -history."
		        );
		    call absolute_pathname_ (argument,
		        opt.old_log.history_dir, code);
		    if code ^= 0 then
			  call ssu_$abort_line (sci_ptr, code, "^a",
			      argument);
		    end;
	      else if (argument = "-new_dir") | (argument = "-nd") then
		    do;
		    call get_next_arg (
		        "target directory for converted log.");
		    call absolute_pathname_ (argument, opt.new_log.dir_name,
		        code);
		    if code ^= 0 then
			  call ssu_$abort_line (sci_ptr, code, "^a",
			      argument);
		    end;
	      else if (argument = "-new_history_dir") | (argument = "-nhd")
		then
		    do;
		    call get_next_arg (
		        "target directory for the second and later new log segments."
		        );
		    call absolute_pathname_ (argument,
		        opt.new_log.history_dir, code);
		    if code ^= 0 then
			  call ssu_$abort_line (sci_ptr, code, "^a",
			      argument);
		    end;
	      else
		    call ssu_$abort_line (sci_ptr, error_table_$badopt,
		        "^a", argument);
        end;

        if opt.old_log.dir_name = "" then
	      call ssu_$abort_line (sci_ptr, error_table_$noarg,
		"A log to be converted must be specified.");
        if opt.old_log.history_dir = "" then
	      opt.old_log.history_dir = ">udd>SysAdmin>admin>history";
        if opt.new_log.dir_name = "" then
	      opt.new_log.dir_name = ">system_control_dir>as_logs";
        opt.new_log.entryname = opt.old_log.entryname;
        if opt.new_log.history_dir = "" then
	      opt.new_log.history_dir = ">udd>SysAdmin>admin>history";

/**** Initiate the first (most recent) log. */

        call initiate_file_ (opt.old_log.dir_name, opt.old_log.entryname,
	  R_ACCESS, opt.old_log_ptrs (1), (0), code);
        if code ^= 0 then
	      call ssu_$abort_line (sci_ptr, code, "Failed to initiate ^a.",
		pathname_ (opt.old_log.dir_name, opt.old_log.entryname));
        opt.old_log_names (1) = opt.old_log.entryname;
        opt.n_old_logs = 1;

        call add_to_history (1, opt.old_log.dir_name);  /* get the co-resident segments */
        call add_to_history (opt.n_old_logs, opt.old_log.history_dir);

/**** We now have an array of pointers to old log segments to eat */
/**** We want to write all the messages into segments in the history dir. */
/**** And then move the last one and fix its header. */

        call log_write_$open_for_migrate (opt.new_log.history_dir,
	  opt.new_log.entryname, "1"b, opt.log_write_ptr, code);
        if code ^= 0 then
	      call ssu_$abort_line (sci_ptr, code,
		"Failed to open new log ^a.",
		pathname_ (opt.new_log.dir_name, opt.new_log.entryname));

        total_messages = 0;
        do old_log_x = opt.n_old_logs to 1 by -1;	      /* Work from the oldest */
	      call ioa_ ("convert_old_log: Converting old log segment ^a",
		opt.old_log_names (old_log_x));
	      call write_one_log (opt.old_log_ptrs (old_log_x),
		opt.old_log_names (old_log_x));
        end;

        call log_write_$close (opt.log_write_ptr, (0));
        if opt.new_log.dir_name ^= opt.new_log.history_dir then
	      call fix_history_dir;
        call terminate_old_logs;

        call ioa_ ("convert_old_log: Converted ^d segments, ^d messages.",
	  opt.n_old_logs, total_messages);

        return;


get_next_arg:
        procedure (P_what);

        declare P_what		char (*);

        if n_args = an then
	      call ssu_$abort_line (sci_ptr, error_table_$noarg, "^a", P_what)
		;
        an = an + 1;
        call ssu_$arg_ptr (sci_ptr, an, ap, al);
        return;
        end get_next_arg;

terminate_old_logs:
        procedure;

        declare x			fixed bin;

        do x = 1 to opt.n_old_logs;
	      call terminate_file_ (opt.old_log_ptrs (x), (0), TERM_FILE_TERM,
		(0));
        end;
        return;
        end terminate_old_logs;

add_to_history:
        procedure (P_oldest_index, P_dir_name);

        declare P_oldest_index	fixed bin;
        declare P_dir_name		char (*);

        declare entryname		char (32);
        declare current_log_ptr	pointer;
        declare older_log_ptr		pointer;

        current_log_ptr = opt.old_log_ptrs (P_oldest_index);
        code = 0;
        do while ("1"b);
	      entryname =
		rtrim (opt.old_log.entryname) || ".-."
		|| current_log_ptr -> sys_log_file.lls;
	      call initiate_file_ (P_dir_name, entryname, R_ACCESS,
		older_log_ptr, (0), code);
	      if code ^= 0 then
		    return;
	      opt.n_old_logs = opt.n_old_logs + 1;
	      opt.old_log_ptrs (opt.n_old_logs) = older_log_ptr;
	      opt.old_log_names (opt.n_old_logs) = entryname;
	      current_log_ptr = older_log_ptr;
        end;
        end add_to_history;

write_one_log:
        procedure (P_log_ptr, P_log_name);

        declare P_log_ptr		pointer;
        declare log_ptr		pointer;
        declare 1 log		aligned like sys_log_file
				based (log_ptr);
        declare x			fixed bin;
        declare log_name		char (32);
        declare P_log_name		char (*) aligned;

        log_name = P_log_name;
        log_ptr = P_log_ptr;
        do x = 1 to log.count;
RETRY:
	      total_messages = total_messages + 1;
	      call log_write_$general (opt.log_write_ptr, (0),
		length (rtrim (log.array (x).line)), (0), "",
		log_message_ptr, code);
	      if code ^= 0 then
		    do;
		    call sub_err_ (code, COMMAND_NAME, ACTION_CAN_RESTART,
		        null (), (0),
		        "Failed to add message ^d from segment ^a (^p) to log ^a."
		        , x, log_name, log_ptr, opt.new_log.entryname);
		    go to RETRY;
		    end;
	      log_message.severity = log.array (x).svty;
	      log_message.time = log.array (x).time;
	      log_message.text =
		substr (log.array (x).line, 1, log_message.text_lth);
	      call log_segment_$finish_message (
		setwordno (log_message_ptr, 0), log_message_ptr, code);
	      if code ^= 0 then
		    call sub_err_ (code, COMMAND_NAME, ACTION_CANT_RESTART,
		        null (), (0),
		        "Failed to finish message ^d in new log that was obtained from old log ^a"
		        , log_message.sequence, log_name);
        end;
        end write_one_log;

fix_history_dir:
        procedure;

        call log_read_$open (opt.new_log.dir_name, opt.new_log.entryname,
	  opt.log_read_ptr, code);
        if code ^= 0 then
	      do;
	      call com_err_ (code, "convert_old_log",
		"No log named ^a found in ^a. If you create one, you must use the set_log_history_dir command to link it to the converted log."
		, opt.new_log.entryname, opt.new_log.dir_name);
	      return;
	      end;

        log_segment_ptr =
	  opt.log_read_ptr
	  -> log_read_data
	  .segments (opt.log_read_ptr -> log_read_data.very_first_log_idx)
	  .ptr;
        on no_write_permission go to NO_WRITE;
        log_segment.previous_log_dir = opt.new_log.history_dir;
        revert no_write_permission;
        call log_read_$close (opt.log_read_ptr, (0));
        return;
NO_WRITE:
        call com_err_ (0, "convert_old_log",
	  "You lack w access to the current log ^a, so the previous log dir was not set."
	  , opt.new_log.entryname);
        return;

        end fix_history_dir;


clean_up:
        procedure;

        call terminate_old_logs;
        if opt.log_write_ptr ^= null () then
	      call log_write_$close (opt.log_write_ptr, (0));
        if sci_ptr ^= null () then
	      call ssu_$destroy_invocation (sci_ptr);
        return;
        end clean_up;

SSU_ABORT:
        procedure;

        go to ABORT;
        end SSU_ABORT;

ABORT:
        call clean_up;
        return;

%include log_message;
%include log_segment;
%include log_read_data;
%include syslog;
        declare sys_log_ptr		pointer init (null ());
%include access_mode_values;
%include sub_err_flags;
%include terminate_file;
        end convert_old_log;




		    convert_old_value_seg.pl1       04/09/85  1521.7r w 04/08/85  1134.6       48717



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1982 *
   *                                                         *
   * Copyright (c) 1972 by Massachusetts Institute of        *
   * Technology and Honeywell Information Systems, Inc.      *
   *                                                         *
   *********************************************************** */

/* format: style2 */
/**** Created 1984-12-11 BIM from the old value command. */


convert_old_value_seg:
     procedure options (variable);

	dcl     entry		 char (32),
	        dir		 char (168),
	        segptr		 ptr,
	        vs_ptr		 pointer,
	        created		 bit (1) aligned,
	        set_first		 bit (1) aligned,
	        i			 fixed bin,
	        ap		 ptr,
	        al		 fixed bin (21),
	        bchr		 char (al) unal based (ap),
	        code		 fixed bin (35);

	dcl     (null, substr, addr, min)
				 builtin;

	dcl     com_err_		 entry options (variable);
	dcl     expand_pathname_	 entry (character (*), character (*), character (*), fixed binary (35));
	dcl     expand_pathname_$add_suffix
				 entry (character (*), character (*), character (*), character (*),
				 fixed binary (35));
	dcl     cu_$arg_ptr		 entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
	dcl     cu_$arg_count	 entry (fixed bin, fixed bin (35));
	dcl     initiate_file_	 entry (character (*), character (*), bit (*), pointer, fixed binary (24),
				 fixed binary (35));
	dcl     initiate_file_$create	 entry (character (*), character (*), bit (*), pointer, bit (1) aligned,
				 fixed binary (24), fixed binary (35));
	dcl     pathname_		 entry (character (*), character (*)) returns (character (168));
	dcl     terminate_file_	 entry (pointer, fixed binary (24), bit (*), fixed binary (35));
	dcl     requote_string_	 entry (character (*)) returns (character (*));
	dcl     value_$init_seg	 entry (pointer, fixed binary, pointer, fixed binary (19), fixed binary (35));
	dcl     value_$set		 entry () options (variable);
	dcl     ioa_		 entry options (variable);

	dcl     error_table_$not_seg_type
				 fixed bin (35) ext static;

	dcl     PERMANENT		 bit (36) aligned init ("20000000000"b3) int static options (constant);


	dcl     1 valueseg		 based (segptr) aligned,
		2 laste		 fixed bin,
		2 freep		 fixed bin,
		2 pad		 (6) fixed bin,
		2 arry		 (14506),
		  3 name		 char (32),
		  3 valu		 char (32),
		  3 lth		 fixed bin,
		  3 chain		 fixed bin;


	call cu_$arg_count (i, code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_old_value_seg");
		return;
	     end;

	if i ^= 2
	then do;
		call com_err_ (0, "convert_old_value_seg", "Usage: convert_old_value_seg OLD_PATH NEW_PATH.value");
		return;
	     end;

	call cu_$arg_ptr (1, ap, al, (0));
	call expand_pathname_ (bchr, dir, entry, code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_old_value_seg", "old value seg ^a.", bchr);
		return;
	     end;

	call initiate_file_ (dir, entry, R_ACCESS, segptr, (0), code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_old_value_seg", "old value seg ^a.", bchr);
		return;
	     end;

	call cu_$arg_ptr (2, ap, al, (0));
	call expand_pathname_$add_suffix (bchr, "value", dir, entry, code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_old_value_seg", "new value seg ^a.", bchr);
		return;
	     end;

	call initiate_file_$create (dir, entry, RW_ACCESS, vs_ptr, created, (0), code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_old_value_seg", "new value seg ^a.", bchr);
		return;
	     end;

	if created
	then call ioa_ ("convert_old_value_seg: Created ^a.", pathname_ (dir, entry));

	if created
	then call initialize_value_segment;

	set_first = "0"b;

RETRY_CONVERSION:					/* Here if the first set discovered an uninitialized value segment */
	do i = 1 to valueseg.laste;			/* laste is last in use */
	     if (valueseg.chain (i) = 0) & (valueseg.name (i) ^= "")
	     then do;
		     call value_$set (vs_ptr, PERMANENT, valueseg.name (i),
			substr (valueseg.valu (i), 1, valueseg.lth (i)), (""), code);
		     if code = error_table_$not_seg_type
		     then do;
			     if set_first
			     then do;
				     call com_err_ (code, "convert_old_value_seg",
					"The new value segment became invalid after a vaue was set in it.");
				     go to CLEANUP_RETURN;
				end;
			     set_first = "1"b;
			     call initialize_value_segment;
			     go to RETRY_CONVERSION;
			end;
		     if code ^= 0
		     then do;
			     call com_err_ (code, "convert_old_value_seg",
				"Error setting new value seg variable ^a to ^a.",
				requote_string_ ((valueseg.name (i))),
				requote_string_ (substr (valueseg.valu (i), 1, valueseg.lth (i))));
			     go to CLEANUP_RETURN;
			end;
		end;
	end;

CLEANUP_RETURN:
	call terminate_file_ (segptr, (0), TERM_FILE_TERM, (0));
	call terminate_file_ (vs_ptr, (0), TERM_FILE_TERM, (0));
	return;



initialize_value_segment:
     procedure;

	call value_$init_seg (vs_ptr, 0, null (), 0, code);
	if code ^= 0
	then do;
		call com_err_ (code, "convert_old_value_seg", "Unable to initialize ^a as a value segment.",
		     pathname_ (dir, entry));
		go to CLEANUP_RETURN;
	     end;
	return;
     end initialize_value_segment;

%include access_mode_values;
%include terminate_file;
     end convert_old_value_seg;






		    bull_copyright_notice.txt       08/30/05  1008.4r   08/30/05  1007.3    00020025

                                          -----------------------------------------------------------


Historical Background

This edition of the Multics software materials and documentation is provided and donated
to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. 
as a contribution to computer science knowledge.  
This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology,
Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull
and Bull HN Information Systems Inc. to the development of this operating system. 
Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970),
renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership
of Professor Fernando Jose Corbato.Users consider that Multics provided the best software architecture for 
managing computer hardware properly and for executing programs. Many subsequent operating systems
incorporated Multics principles.
Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., 
as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. .

                                          -----------------------------------------------------------

Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without
fee is hereby granted,provided that the below copyright notice and historical background appear in all copies
and that both the copyright notice and historical background and this permission notice appear in supporting
documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining
to distribution of the programs without specific prior written permission.
    Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc.
    Copyright 2006 by Bull HN Information Systems Inc.
    Copyright 2006 by Bull SAS
    All Rights Reserved

