From: gezelter@rlgsc.com
Newsgroups: comp.os.vms
Subject: Re: VAX c
Date: 27 Dec 92 15:08:10 GMT
Organization: Robert Gezelter Software Consultant, Flushing, NY

In article <1hjmn7INN34t@gap.caltech.edu>, carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) writes:
> In article <1992Dec26.100030.299@rlgsc.com>, gezelter@rlgsc.com writes:
>>....
>>When the time expires, close the file. Then re-open it in append 
>>mode. This will ensure that all of your buffers are flushed out 
>>to the disk.
> 
> I tried that once.  Maybe it had to do with the way the file dealt with
> records, but what I ended up with with was a file that had *ONE* record per
> block.  Not what one would want.
> 
> ...
>
>>If I remember correctly from the original post, the application 
>>in question is not a high bandwidth application. The periodic 
>>close/reopen cycle should not appreciably increase your CPU 
>>consumption.
> 
> CPU's not the problem here.  The problem is that every time you do it, you use
> up another block on the disk.
> 
>...
> Please note that I'm not trying to put Bob down;  his solution WILL work;  but
> it uses up lots of disk space.  
>...
> --------------------------------------------------------------------------------
> Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
> 
-- 
Carl,
 
I would be interested in hearing exactly what type of file that 
you had that problem of partial blocks with. I have been using 
this solution in a range of applications for about 15 years on 
both RSX and VMS and have never encountered the behavior that you 
describe.
 
As a simple (albeit crude) verification, I put together the 
following command procedure:
 
 $! Test of Disk Space Consumption when using Append Mode.
 $!
 $! Author:  Robert Gezelter	27-December-1992
 $!
 $! Test of Results of APPEND operation as done by COPY.
 $!
 $ CREATE APPEND_TEST1.TMP
 This is a first text line.
 $ APPEND SYS$INPUT APPEND_TEST1.TMP
 This is a second text line appended to the file.
 $ DUMP/ASCII/HEX APPEND_TEST1.TMP
 $ DIRECTORY/FULL APPEND_TEST1.TMP
 $!
 $! Test of Results of APPEND operation as done using direct DCL operations.
 $!
 $ OPEN/WRITE FILE1 APPEND_TEST2.TMP
 $ WRITE FILE1 "This is a first text line (DCL Test)."
 $ CLOSE FILE1
 $ OPEN/APPEND FILE2 APPEND_TEST2.TMP
 $ WRITE FILE2 "This is a second text line appended to the file."
 $ CLOSE FILE2
 $ DUMP/ASCII/HEX APPEND_TEST2.TMP
 $ DIRECTORY/FULL APPEND_TEST2.TMP
 $ DELETE APPEND_TEST%.TMP;*

The output from this batch job (with my login profile printout 
deleted) is included in this post beyond my signature). While it 
does not prove that it is not possible to force RMS to waste disk 
space, the results seem to indicate that the default treatment is 
to append the new record DIRECTLY following the previous record.
 
If I have been unclear, or if you have any questions, please feel 
free to contact me via Email or phone.
 
- Bob
+--------------------------------------------------------------------------+
| Robert "Bob" Gezelter                       E-Mail:  gezelter@rlgsc.com  |
| Robert Gezelter Software Consultant         Voice:   +1 718 463 1079     |
| 35-20 167th Street, Suite 215               Fax:       (on Request)      |
| Flushing, New York  11358-1731                                           |
| United States of America                                                 |
+--------------------------------------------------------------------------+
----------------------------Begin Included File-----------------------------
 $! Test of Disk Space Consumption when using Append Mode.
 $!
 $! Author:  Robert Gezelter	27-December-1992
 $!
 $! Test of Results of APPEND operation as done by COPY.
 $!
 $ CREATE APPEND_TEST1.TMP
 This is a first text line.
 $ APPEND SYS$INPUT APPEND_TEST1.TMP
 This is a second text line appended to the file.
 $ DUMP/ASCII/HEX APPEND_TEST1.TMP
 
 
 Dump of file DISK$USERS:[GEZELTER]APPEND_TEST1.TMP;1 on 27-DEC-1992 10:05:09.97
 File ID (2740,7,0)   End of file block 1 / Allocated 3
 
 Virtual block number 1 (00000001), 512 (0200) bytes
 
  68540030 2E656E69 6C207478 65742074 73726966 20612073 69207369 6854001A ..This is a first text line.0.Th 000000
  65646E65 70706120 656E696C 20747865 7420646E 6F636573 20612073 69207369 is is a second text line appende 000020
  00000000 00000000 00000000 00000000 FFFF2E65 6C696620 65687420 6F742064 d to the file................... 000040
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000060
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000080
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0000A0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0000C0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0000E0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000100
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000120
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000140
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000160
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000180
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0001A0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0001C0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0001E0
 $ DIRECTORY/FULL APPEND_TEST1.TMP
 
 Directory DISK$USERS:[GEZELTER]
 
 APPEND_TEST1.TMP;1            File ID:  (2740,7,0)         
 Size:            1/3          Owner:    [GEZELTER]
 Created:  27-DEC-1992 10:05:07.37
 Revised:  27-DEC-1992 10:05:08.59 (2)
 Expires:   <None specified>
 Backup:    <No backup recorded>
 File organization:  Sequential
 File attributes:    Allocation: 3, Extend: 0, Global buffer count: 0, No version limit
 Record format:      Variable length, maximum 48 bytes
 Record attributes:  Carriage return carriage control
 RMS attributes:     None
 Journaling enabled: None
 File protection:    System:RWED, Owner:RWED, Group:RE, World:
 Access Cntrl List:  None
 
 Total of 1 file, 1/3 blocks.
 $!
 $! Test of Results of APPEND operation as done using direct DCL operations.
 $!
 $ OPEN/WRITE FILE1 APPEND_TEST2.TMP
 $ WRITE FILE1 "This is a first text line (DCL Test)."
 $ CLOSE FILE1
 $ OPEN/APPEND FILE2 APPEND_TEST2.TMP
 $ WRITE FILE2 "This is a second text line appended to the file."
 $ CLOSE FILE2
 $ DUMP/ASCII/HEX APPEND_TEST2.TMP
 
 
 Dump of file DISK$USERS:[GEZELTER]APPEND_TEST2.TMP;1 on 27-DEC-1992 10:05:15.89
 File ID (2756,5,0)   End of file block 1 / Allocated 3
 
 Virtual block number 1 (00000001), 512 (0200) bytes
 
  44282065 6E696C20 74786574 20747372 69662061 20736920 73696854 8D010027 '...This is a first text line (D 000000
  7420646E 6F636573 20612073 69207369 68548D01 0032002E 29747365 54204C43 CL Test)..2...This is a second t 000020
  FFFF2E65 6C696620 65687420 6F742064 65646E65 70706120 656E696C 20747865 ext line appended to the file... 000040
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000060
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000080
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0000A0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0000C0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0000E0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000100
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000120
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000140
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000160
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 000180
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0001A0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0001C0
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................ 0001E0
 $ DIRECTORY/FULL APPEND_TEST2.TMP
 
 Directory DISK$USERS:[GEZELTER]
 
 APPEND_TEST2.TMP;1            File ID:  (2756,5,0)         
 Size:            1/3          Owner:    [GEZELTER]
 Created:  27-DEC-1992 10:05:13.73
 Revised:  27-DEC-1992 10:05:14.36 (2)
 Expires:   <None specified>
 Backup:    <No backup recorded>
 File organization:  Sequential
 File attributes:    Allocation: 3, Extend: 0, Global buffer count: 0, No version limit
 Record format:      VFC, 2 byte header, maximum 48 bytes
 Record attributes:  Print file carriage control
 RMS attributes:     None
 Journaling enabled: None
 File protection:    System:RWED, Owner:RWED, Group:RE, World:
 Access Cntrl List:  None
 
 Total of 1 file, 1/3 blocks.
 $ DELETE APPEND_TEST%.TMP;*
   GEZELTER     job terminated at 27-DEC-1992 10:05:20.56
 
   Accounting information:
   Buffered I/O count:             120         Peak working set size:     367
   Direct I/O count:               101         Peak page file size:      2488
   Page faults:                   1816         Mounted volumes:             0
   Charged CPU time:           0 00:00:07.21   Elapsed time:     0 00:00:17.93
-----------------------------End of Included File-----------------------------
Newsgroups: comp.os.vms