22.05.2014 Views

CERN Program Library Long Writeup W5013 - CERNLIB ...

CERN Program Library Long Writeup W5013 - CERNLIB ...

CERN Program Library Long Writeup W5013 - CERNLIB ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Geant 3.16 GEANT User’s Guide IOPA400<br />

Origin : R.Brun Submitted: 20.08.87<br />

Revision : Revised: 17.12.93<br />

Documentation :<br />

ZEBRA direct access files handling<br />

I/O with direct access files is the most efficient way to use direct access devices. All the routines described<br />

in this section and in ([IOPA500]) are based on the ZEBRA-RZ package and the user is referred to the related<br />

documentation [8] for an understanding of the basic principles.<br />

CALL GRFILE<br />

(LUN,CHFILE,CHOPT)<br />

LUN<br />

CHFILE<br />

CHOPT<br />

(INTEGER) logical unit number;<br />

(CHARACTER*(*)) file name;<br />

(CHARACTER*(*)) any valid option for RZOPEN, RZMAKE and RZFILE and in particular:<br />

N create a new file;<br />

U open an existing file for update;<br />

Q the initial allocation (default 1000 records) is in IQUEST(10);<br />

I read all initialisation data structures (see description of GRIN/GROUT) from file to memory;<br />

O write all initialisation data structures from memory to file;<br />

This routine opens a file for direct access I/O of ZEBRA data structures. By default the file is opened in<br />

exchange mode and the option W is added, which creates an RZ top level directory with the name //LUNnn<br />

where nn is the logical unit number.<br />

The default allocation of an RZ directory is enough for 1000 records, which allows for a 4Mb file with the<br />

standard record length of 1024 words. If a larger file is needed, the size of the directory should be changed<br />

when creating the file. This can be done by assigning to the variable IQUEST(10) in the common /QUEST/<br />

the requested number of records, and calling GRFILE with the option Q as shown in the following example:<br />

COMMON / QUEST / IQUEST(100)<br />

.<br />

.<br />

.<br />

IQUEST(10) = 5000<br />

CALL GRFILE(1,’mygeom.geom’,’Q’)<br />

CALL GRMDIR<br />

(CHDIR,CHOPT)<br />

CHDIR<br />

CHOPT<br />

(CHARACTER*(*)) subdirectory name to create;<br />

option string:<br />

’ ’ create a subdirectory;<br />

S create a subdirectory and set the current directory to it;<br />

This routine creates an RZ subdirectory.<br />

CALL GREND<br />

(LUN)<br />

LUN (INTEGER) logical unit number (see RZEND in the ZEBRA manual [8]);<br />

Routine to close an RZ file. It is very important to call this routine for all RZ files open in write mode. Failure<br />

to do may result in the files being incompletely written or corrupted.<br />

180 IOPA400 – 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!