AMT Help Files

READ

Files With Sequential Access Mode

COBOL JAVA
READ readSequentialFile

Syntax

readSequentialFile ( <file>, <buffer>[, <into>], [locking] )

Parameter(s)

<file>
The file id of the file that is being read.

<buffer>
The file buffer, the content that will be read.

<into> (Optional)
Data from the file buffer will be copied into this variable.

<locking> (Optional)
Locking mode (only when open for I-O)

Example(s)

COBOL Java
READ SequentialFile.
                
readSequentialFile(sequentialfile, fd_Seqdata);
                
READ SequentialFile INTO recorddata.
                
readSequentialFile(sequentialfile, fd_Seqdata, locDef.recorddata);
                
READ SequentialFile INTO recorddata
    AT END MOVE "Ended" TO filestatus
                
if (!(readSequentialFile(sequentialfile, fd_Seqdata, locDef.recorddata))) {
    locDef.filestatus.assign("Ended");
}
                

Indexed Files With Sequential Retrieval

COBOL JAVA
READ readRandomAccessFileNextRecord

Syntax

readRandomAccessFileNextRecord ( <file>, <buffer>[, <into>] )

Parameter(s)

<file>
The file id of the file that is being read.

<buffer>
The file buffer, the content that will be read.

<into> (Optional)
Data from the file buffer will be copied into this variable.

<locking> Optional
Locking mode (only for I-O).

Example(s)

COBOL Java
READ IndexedFile NEXT RECORD INTO recorddata.
                
readRandomAccessFileNextRecord(indexedfile, fd_Idxdata, locDef.recorddata);
                

Indexed Files With Random Retrieval

COBOL JAVA
READ readRandomAccessFile

Syntax

readRandomAccessFile ( <file>, <buffer>, <index>, <locateValue> [, <into>] )

Parameter(s)

<file>
The file id of the file that is being read.

<buffer>
The file buffer, the content that will be read.

<index>
The index key defined with the file.

<locateValue>
The value to look for (Key phrase).

<into> (Optional)
Data from the file buffer will be copied into this variable.

<locking> (Optional)
Locking mode (only for I-O).

Example(s)

COBOL Java
READ IndexedFile.
                
readRandomAccessFile(indexedfile, fd_Idxdata, idx_Idxkey, fd_Idxdata.idxkey);
                
READ IndexedFile INTO recorddata.
                
readRandomAccessFile(indexedfile, fd_Idxdata, idx_Idxkey, fd_Idxdata.idxkey, locDef.recorddata);
                
READ IndexedFile INTO recorddata KEY Idxkey
    INVALID KEY MOVE "Invalid key" TO filestatus
    NOT INVALID KEY MOVE "OK" TO filestatus.
                
if (!(readRandomAccessFile(indexedfile, fd_Idxdata, idx_Idxkey, fd_Idxdata.idxkey, locDef.recorddata))) {
    locDef.filestatus.assign("Invalid key");
} else {
    locDef.filestatus.assign("OK");
}
                

Relative Files

COBOL JAVA
READ readRandomAccessFilePosition

Syntax

readRandomAccessFilePosition ( <file>, <buffer>, <position>[, <into>] )

Parameter(s)

<file>
The file id of the file that is being read.

<buffer>
The file buffer, the content that will be read.

<position>
The record key field.

<into> (Optional)
Data from the file buffer will be copied into this variable.

Example(s)

COBOL Java
READ RelativeFile.
                
ReadRandomAccessFilePosition(Relativefile, m_Fd_Reldata, m_LocDef.Relkey.Value);
                
READ RelativeFile INTO recorddata.
                
ReadRandomAccessFilePosition(Relativefile, m_Fd_Reldata, m_LocDef.Relkey.Value, m_LocDef.Recorddata);