next up previous contents index
Next: Access an existing Up: Description of user Previous: Open a direct

Create a new RZ file

CALL RZMAKE (LUN,CHDIR,NWKEY,CHFORM,CHTAG,NREC,CHOPT)

LUN
Logical unit number associated with the RZ file. A FORTRAN OPEN statement or call to the routine RZOPEN must precede the call to RZMAKE.
Starting address of the memory area which will contain the RZ information ('M' option)
CHDIR
Character variable specifying the name of the top directory to be associated with unit LUN (up to 16 characters).
NWKEY
Number of words associated to a key (maximum 100)
CHFORM
Character variable describing each element of the key vector
'B'
Bit string but not zero
'H'
Hollerith (4 characters)
'A'
Same as 'H' except for RZLDIR
'I'
Integer (nonzero)
CHTAG
Character array defined as CHARACTER*8 CHTAG(NWKEY).
Each element of the array allows the description of the corresponding element in the key vector with a tag of up to 8 characters.
NREC
Number of physical records for the primary allocation
CHOPT
Character variable specifying the selected options.
medium
' '
Disk (default)
'M'
Memory - The user must allocate at least NREC*LUN words of memory starting at address LUN if this option is used (see below).
mode
' '
Native mode (default)
'X'
Exchange mode (32 bit machines only)
format
' '
'Old' format (default)
'O'
As above
'N'
'New' format
'4'
Synonym for 'O'
'7'
Synonym for 'N'
other
'F'
Format NREC records, unless option 'M'.
'C'
Use C I/O

Subroutine RZMAKE creates a new RZ file on the specified logical unit. Should the file already exist, the routine RZFILE should be used. On return from RZMAKE, IQUEST(1)

will be set to 0 if the routine was successful. A non-zero value for IQUEST(1) indicates an error.

RZMAKE return codes

IQUEST(1)
Error status
0
Normal completion
1
Invalid number of words per keys (NWKEY)
2
Invalid number of records
3
Invalid combination of options specified
4
Invalid logical unit (LUN)
5
Invalid record length (LRECP)
6
Logical unit already in use

The following example opens and creates a new RZ file, whose top directory contains three words per key, the first one being an integer (the year) and the two others being Hollerith (the month and the day). A total of 5000 records of length 4096 bytes are requested.

Example of using the routine RZMAKE

      CHARACTER*16 CHDIR
      CHARACTER    CHTAG(3)*8
      DATA CHTAG/'Year','Month','Day'/
      LRECL = 1024
      CALL RZOPEN(LUN,CHDIR,'RZTEST.DAT','N',LRECL,ISTAT)
      IF(ISTAT.NE.0) GOTO 999
      CALL RZMAKE(LUN,'Top_Dir',3,'IHH',CHTAG,5000,' ')
 
  999 PRINT *,'Return code from RZOPEN = ',ISTAT

Option 'F' is particularly important for RZ files on

VM/CMS systems, when shared access is required. Further details are given in Appendix A.

N.B. when using option C, the call to RZMAKE must immediately follow a call to RZOPEN. This permits the record length of the file to be passed from RZOPEN to RZMAKE, where it is stored in an RZ control bank for future use.

Option 'M' creates an RZ file in memory. The variable LUN contains the record length. The address of this variable is used as the starting address for the memory file, as shown in the following example.

Example of creating a memory file

      COMMON/MEMRZ/IBUFF(163840)
*
*     Set record length of memory file to 1024 words
*     Starting address is LOCF(IBUF(1))
*     Number of 'records' is 160 (length of IBUFF/lrecl)
*
      IBUF(1) = 1024
      CALL RZMAKE(IBUF(1),'MEMRZ',3,'IHH',CHTAG,160,'M')



next up previous contents index
Next: Access an existing Up: Description of user Previous: Open a direct


Janne Saarela
Mon May 15 08:34:47 METDST 1995