From:	CSBVAX::MRGATE!James_A._Gray.OsbuSouth@Xerox.COM@SMTP 29-MAY-1988 09:43
To:	ARISIA::EVERHART
Subj:	VMS_SHARE.3_OF_3


Received: from Xerox.COM by KL.SRI.COM with TCP; Thu 26 May 88 13:31:42-PDT
Received: from Burger.ms by ArpaGateway.ms ; 26 MAY 88 13:15:57 PDT
Sender: "James_A._Gray.OsbuSouth"@Xerox.COM
Date: 26 May 88 12:14:15 PDT (Thursday)
Subject: VMS_SHARE.3_OF_3
From: "James_A._Gray.OsbuSouth"@Xerox.COM
To: INFO-VAX@KL.SRI.COM, XeroxVAXInterest.AllAreas@Xerox.COM
Reply-to: "Gray:OSBUSouth@Xerox.COM:xerox.ns"@Xerox.COM
Message-ID: <880526-131557-2984@Xerox>

+-+-+-+ Beginning of part 3 +-+-+-+
V  __copy_text( FAO( "$!!!12* concatenate ALL parts to ONE file and execute (@) 
Xthat file." ) );
X  __copy_text( FAO( "$!!" ) );
X
X  !+
V  ! Skip the first part for now since the number of parts will have to be corre
Xcted later.
X  !-
X
X  POSITION( BEGINNING_OF( b_packed ) );
X  __find_part_end;
X  MOVE_HORIZONTAL( -(CURRENT_OFFSET + 1) );
X
X  !+
X  ! Determine if a GOTO/label pair is needed for Part 1/Part 2 boundary.
X  !-
X
X  MOVE_VERTICAL( -1 );
X  s_x := CURRENT_CHARACTER;
X  MOVE_VERTICAL( 1 );
X  IF s_x = "$"
X  THEN
X    i_label_needed := 1;
X  ELSE
X    i_label_needed := 0;
X  ENDIF;
X
X  !+
X  ! Initialize the number of parts and the starting part number.
X  !-
X
X  i_part_num := 2;
X  i_parts := 1;
X
X  !+
X  ! Loop through the rest of the parts moving the text to part buffers.
X  !-
X
X  LOOP
X
X    !+
X    ! Move the next part into the part buffer.
X    !-
X
X    POSITION( b_packed );
X    EXITIF MARK( NONE ) = END_OF( b_packed );
X
X    MOVE_HORIZONTAL( -(CURRENT_OFFSET) );
X    m_part_begin := MARK( NONE );
X    __find_part_end;
X    MOVE_HORIZONTAL( -(CURRENT_OFFSET + 1) );
X    r_part := CREATE_RANGE( m_part_begin, MARK( NONE ), NONE );
X    b_part := CREATE_BUFFER( FAO( "{Part !UL}", i_part_num ) );
X    POSITION( b_part );
X    COPY_TEXT( FAO( s_part_begin, i_part_num ) );
X    IF i_label_needed <> 0
X    THEN
X      SPLIT_LINE;
X      COPY_TEXT( FAO( s_part_label, i_part_num ) );
X    ENDIF;
X    POSITION( END_OF( b_part ) );
X    MOVE_TEXT( r_part );
X    POSITION( END_OF( b_part ) );
X
X    !+
X    ! Determine if a GOTO/label pair is needed for Part n/Part n+1 boundary.
X    !-
X
X    MOVE_VERTICAL( -1 );
X    s_x := CURRENT_CHARACTER;
X    MOVE_VERTICAL( 1 );
X    IF ( s_x = "$" ) AND ( END_OF( r_part ) <> END_OF( b_packed ) )
X    THEN
X      __copy_text( FAO( s_part_goto, i_part_num + 1 ) );
X      i_label_needed := 1;
X    ELSE
X      i_label_needed := 0;
X    ENDIF;
X    COPY_TEXT( FAO( s_part_end, i_part_num ) );
X
X    !+
X    ! Increment to the next part.
X    !-
X
X    i_part_num := i_part_num + 1;
X    i_parts := i_parts + 1;
X
X  ENDLOOP;
X
X  !+
V  ! Now that the number of parts is known, update the number of parts in part 1
X and move it to it's part buffer.
X  !-
X
X  POSITION( m_attention_text );
X  r_parts := SEARCH( "999", FORWARD );
X  ERASE( r_parts );
X  POSITION( END_OF( r_parts ) );
X  COPY_TEXT( STR( i_parts ) );
X  b_part := CREATE_BUFFER( "{Part 1}" );
X  POSITION( b_part );
X  MOVE_TEXT( b_packed );
X  POSITION( END_OF( b_part ) );
X  MOVE_VERTICAL( -1 );
X  s_x := CURRENT_CHARACTER;
X  MOVE_VERTICAL( 1 );
X  IF s_x = "$"
X  THEN
X    __copy_text( FAO( s_part_goto, 2 ) );
X  ENDIF;
X  COPY_TEXT( FAO( s_part_end, 1 ) );
X  DELETE( b_packed );
X
X  !+
X  ! Determine the maximum number of digits in part numbers.
X  !-
X
X  IF i_parts <= 9
X  THEN
X    i_digits := 1;
X  ELSE
X    IF i_parts <= 99
X    THEN
X      i_digits := 2;
X    ELSE
X      i_digits := 3;
X    ENDIF;
X  ENDIF;
X
X  !+
X  ! Initialize the starting part number.
X  !-
X
X  i_part_num := 1;
X
X  !+
V  ! Loop through all of the parts setting the file name to be associated with t
Xhat part.
X  !-
X
X  LOOP
X
X    EXITIF i_part_num > i_parts;
X    b_part := __find_buffer( FAO( "{Part !UL}", i_part_num ) );
X
X    !+
X    ! Set the name of the output file for this part.
X    !-
X
V    SET( OUTPUT_FILE, b_part, FAO( "!AS!#ZL_OF_!UL", s_output_file, i_digits, i
X_part_num, i_parts ) );
X
X    !+
X    ! Increment to the next part.
X    !-
X
X    i_part_num := i_part_num + 1;
X
X  ENDLOOP;
X
XENDIF;
X
X!+
X! Create final output message buffer and fill it.
X!-
X
Xb_message := CREATE_BUFFER( "{Message}" );
XPOSITION( b_message );
V__copy_text( FAO( "SHARE-file !AS was written in !UL part!%S as follows:", s_sh
Xare_file, i_parts ) );
XSET( NO_WRITE, b_message, OFF );
XSET( OUTPUT_FILE, b_message, "SYS$COMMAND" );
X
XEXIT;
X$ DELETE/NOLOG/NOCONFIRM VMS_SHARE_DUMMY.DUMMY;*
V$ DIRECTORY/DATE=CREATED/NOHEADER/SIZE=USED/VERSIONS=1/WIDTH=(FILENAME=47,SIZE=
X4) 'SHARE_FILE'*_OF_*
X$ VERIFY = F$VERIFY( VERIFY )
$ GOSUB UNPACK_FILE
$ EXIT
-+-+-+-+-+ End of part 3 +-+-+-+-+-
