[Info-vax] Cobol: Faster flushing of buffer to sequential file
Hein RMS van den Heuvel
heinvandenheuvel at gmail.com
Fri Feb 4 22:32:05 EST 2011
On Feb 4, 9:31 pm, "Richard Maher" <maher... at hotspamnotmail.com>
wrote:
> "George Cornelius" <cornel... at eisner.decus.org> wrote in message
> > GFC_EISNER> conv/share my_file.dat his_file.lis /stat
:
> > Total Records Processed: 0 Buffered I/O Count: 11
:
I was wrong about the CONVERT/SHARE.
I forgot that CONVERT uses UPI sharing
In an attempt to optimize (reduce locks) it overshoots its 'raison
d'etre' : get the data.
> > GFC_EISNER> type his_file.lis
>
> > --------------------------------------------------------------------------- --
:
> The consensus and all supporting evidence is that either a $flush or close
> of the file is required to force the data to be written thru to disk.
Practically YES: Consensus. And Flush needed.
Technically NO: The data IS written tot the disk.
It's just that mere mortals can not see it there.
So practically it ain't there :-).
Still, Technically the write IO _is_ done all the way through to the
disk.
And the EOF _is_ updated ... in the RMS Shared File Lock Value Block,
just not on disk.
This van be verified in many ways.
1) RMS file statistics
2) LD driver IO traces
3) ANALYZE/SYSTEM ... SHOW PROC/RMS=BDBSUM ( buffer VALID, not DIRTY
not IO in PROGRESS)
My favorite method:
4) $ dump/head/bloc=count=1/width=80/ALLOCATED my_file.dat
:
End of file block: 1
End of file byte: 0
:
Retrieval pointers
Count: 6 LBN: 15913410
:
Virtual block number 1 (00000001), 512 (0200) bytes
20202020 20202065 67617373 656D2041 A message 000000
:
> PS. I still believe RMS has some other incantation but no one here knows or
> is interested in sharing. (Or I'm just talking crap :-)
That would be to use the official method to read the file.
5) The reader opens the file with full sharing.
Below the signature a dinky example program to do just that which I
happened to have posted earlier this week in:
http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1466976
Clear as mud?
Hein
$ type MAILBOX_TO_FILE.MAR
.psect data, wrt, noexe
buf: .blkb 32*1024
infab: $FAB fnm=mailbox_input,dnm=sys$login:.dat,fac=get,shr=put
inrab: $RAB fab=infab,usz=32000,ubf=buf
outfab: $FAB fnm=log_output,dnm=sys
$login:.log,fac=put,shr=put,fop=dfw,rat=cr
outrab: $RAB fab=outfab,rbf=buf
.psect code, nowrt, exe
.entry start,0
$OPEN fab=infab
blbc r0,error
$CREATE fab=outfab
blbc r0,error
$CONNECT rab=inrab
blbc r0,error
$CONNECT rab=outrab
blbc r0,error
loop:
$GET rab=inrab
blbc r0,end
movw inrab+rab$w_rsz, outrab+rab$w_rsz
$PUT rab=outrab
blbc r0,error
brw loop
end:
cmpl r0,#RMS$_EOF
beql succes
error: ret
succes:
movl #1, r0
ret
.end start
$ mac MAILBOX_TO_FILE.MAR
$ lin MAILBOX_TO_FILE
$ run MAILBOX_TO_FILE
A message
$
More information about the Info-vax
mailing list