.title datasect manipulate data sections .psect $code pic,usr,con,lcl,rel,shr,exe,rd,nowrt ;alternative way of handling files: in bulk rather than ;record by record, using the pager to do the I/O ; to open an existing file (create if none exixts): ; CALL DSOPENON(vap, alq, filespec, pfc); ; vap = ptr, datasec will store addr of its control block ; alq = fixed bin(31), #blocks (512 by) if create ; filespec = char(*) var ; pfc = fixed bin(31), size of page fault cluster ; to checkpoint, ie force a page-out of all modified page clusters: ; CALL DSCHKPTW(vap,efn); ; vap = as above ; efn = fixed bin(31) event flag to use to test completion of I/O ; to close: ; CALL DSCLOSE(vap); ; vap = as above; DATASECT will free the memory and set ; vap null ; to access: ; DCL DATA CHAR(...) BASED(DSPTR); ; DCL DSPTR PTR BASED(vap); ; the FAB is located at vap+16 ; $jpidef $ssdef $secdef ninsix: .long 96 ;size of control block fabshel: $fab fac=put,alq=0,fop=,rfm=fix,mrs=512 jpishel: .word 4 .word jpi$_frep0va .long 0,0,0,0 .long ^X5FFFFFFF ; dsopenon:: .word ^M pushal @4(ap) pushal ninsix getvm: calls #2,lib$get_vm ; allocate heap for control block ;blbc error -- if we were defensive movl @4(ap),r6 ;vap moval 16(r6),r7 ;r7->fab movc3 #80,fabshel,(r7) movl 12(ap),r8 ;addr file name string desriptor movl 4(r8),r8 ;addr of length word for filespec $fab_store fab=r7,alq=@8(ap),fna=2(r8),fns=(r8) ashl #9,@8(ap),r1 ;max rec size = 512*alq movl r1,fab$w_mrs(r7) opn: $create fab=(r7) ;rms opens ; subl2 #24,sp ;get mem for jpi call movc3 #24,jpishel,(sp) ;set up itemlist moval 16(sp),4(sp) ;addr to hold addr of next free page movl sp,r8 jpi: $getjpi_s itmlst=(r8) ; mapsc: $crmpsc_s inadr=16(r8),- ;base addr supplied by getjpi retadr=(r6),- ;return addr, to control block pagcnt=fab$l_alq(r7),- ; if already exist,rms sets alq flags=#sec$m_wrt,- ;section is writeable chan=fab$l_stv(r7),- pfc=@16(ap) opnret: ret ; dschkptw:: .word 0 $clref_s efn=@8(ap) movl @4(ap),r1 $updsec_s inadr=(r1),efn=@8(ap) tstm: cmpl r0,#ss$_notmodified bneq 1$ ret ;ie, no modified pages since last system pageout 1$: ;cmpl r0,#ss$_normal ;if we were being defensive $waitfr_s efn=@8(ap) ; wait for completion of pageouts ret ; dsclose:: .word 0 movl @4(ap),r1 $deltva_s inadr=(r1) ;release the virtual addr space pushal @4(ap) pushal ninsix calls #2,lib$free_vm ;free the control block clrl @4(ap) ;null out the ptr ret .end