This command is used to read the previous record in a sequence. A series Of sequential READPREV commands on a file is known as a browse function. (READNEXT command can also be used as part of the browse function) The command is used repeatedly to read the records in reverse sequential order from a file on either a local or remote system.
The browse function must be started with me STARTBR command (which identifies the starting point in the file) and terminate with the ENDBR command. The RIDFLD option must be a data area that is large enough to hold a complete identifier (full key, RBA, or RRN) of records in the file. The command is valid for VSAM and CICS maintained data tables only. This data area can be used both as an output and as an input parameter. When used as an output parameter, after each READPREV command, CICS places the complete identifier of the record just retrieved into the RIDFLD data area, and retains the value to mark the point in the file for the next command in order to continue reading the file.
When it is used as an input parameter, CICS will allow the application program to modify the RIDFLD data area prior to executing the next read command. The effect of this allows for repositioning of the browse to a new starting point where the browse will continue in the usual way. If the GENERIC option is used then the RIDFLD value must also be generic. When the browse operation is started with the GTEQ option, then the next record returned will be the record with a key greater than or equal to the RIDFLD value.
This command is also used in browsing a CICS maintained data table. Access is to the source VSAM KSDS data set. A READPREV command followed by a READNEXT command will retrieve the same record as the one retrieved by the first READNEXT command. If you include a READPREV command immediately following a STARTBR command, your STARTBR command must specify the key of a record that exists on the data set; otherwise the NOTFND condition occurs for the READPREV command.
The syntax of the READPREV command is given below:
An example of the command is given below:
The various options of the READPREV command are explained below:
This option must also be specified with the INTO option on commands involving variable length records. This option is not needed for fixed length records, but its inclusion is recommended because:
An automatic check is made on the record being retrieved to check the record length against the available data area
LENGERR condition is triggered when reading fixed length records into the data area longer than the record being accessed, for VS COBOL II, PL/I, and assembler-language applications when the LENGTH option is not used. When the specified length exceeds the file record length then CICS will use the longer length for the move. When the target data area is not large enough in the application program then storage is overlaid beyond the target area.
Retrieving a record into a target data area that is larger that the record will produce unpredictable results with any data from the end of the retrieved record to the end of the target data area. When using the INTO option, the LENGTH option must be a data area that specifies the largest record the program accepts. When the retrieved record exceeds the LENGTH option value specified, the record is truncated to the specified LENGTH option value, the LENGERR condition occurs, and the LENGTH data area is set to the length of the record prior to truncation. When using the SET option, the LENGTH option is not required, but if it is used, then the argument must be a data area.
On completion of the READPREV command, the field is updated by CICS with the complete identification of the record retrieved.
When the pointer reference address resides above the 16MB line, and the DATALOCATION (BELOW) is associated in RDO with the application program, then the data is copied below the 16MB line, and the address of this copy's new location is returned. When storage protection is active, and TASKDATAKEY (USER) is specified, the returned data is in user-key DSA.
Handle conditions are:
The default action is the abnormal termination of the task.
The default action is the abnormal termination of the task.
Browse operations are inefficient because many records have to be read from a file. Limit browse by providing the ability to reset its starting key. Files, which are browsed frequently, should have a larger file-blocking factor in order to minimize the number of required file accesses. A browse against a file with a small blocking factor will be less efficient because of the greater number of accesses required.
Special Techniques for Sequential Read
There are some special techniques for sequential read, which are very useful in the actual programming. Some of them are Skip sequential read and changing browse direction.
In Skip sequential read, records will be skipped while continuing the browse operation established by the prior STARTBR command. For the READNEXT command, the new key for skipping must be in the forward direction form the current record. That is, while doing a READNEXT, a backward skipping is not possible. Similarly while doing a READPREV a forward skipping is not possible. Here what is actually done is instead of moving the length value into the LENGTH filed for the READNEXT/READPREV commands the key of the record to read, after skipping the necessary records, is moved into the RIDFLD. So the READNEXT/READPREV command will read the record with the specified key skipping the records in between.
In direction switching, the READNEXT and READPREV commands are used. That is after a series of READNEXT commands, if you want to change the direction of browse, then issue a READPREV command. But the first READPREV command will again fetch the previously fetched record.
IBM Mainframe Related Interview Questions
|IBM Lotus Notes Interview Questions||IBM-CICS Interview Questions|
|COBOL Interview Questions||Linux Interview Questions|
|IBM-JCL Interview Questions||IBM Mainframe Interview Questions|
|IBM AIX Interview Questions||IBM WAS Administration Interview Questions|
|IBM Lotus Domino Interview Questions||IBM Integration Bus Interview Questions|
|Mainframe DB2 Interview Questions||Unix Production Support Interview Questions|
Ibm Mainframe Tutorial
Introduction To Software Development
Introduction To Ibm Mainframes
Tso And Ispf
Jes2, ]es3 And Sms
Introduction To Job Control Language (jcl)
The Job Statement
The Exec Statement
The Job And Exec Statements
The Dd Statement
Procedures And Symbolic Parameters
Generation Data Groups (gdg), Compile/link-edit And Run Jcls
Access Method Services (ams)
Additional Vsam Commands
Introduction To Rexx
Overview Of Rexx
Introduction To Cics
Exception Handling In Cics
Developing A Cics Application
Cics Programming Techniques
Basic Mapping Support (bms)
Transient Data Control
Temporary Storage Control
Interval And Task Control
Cics Application Design
Recovery And Restart
System Security And Intersystem Communication
Cics Debugging Facilities And Techniques
Bms Map Definition Macros And Copylib Members
Cics Response And Abend Codes
Data, Information And Information Processing
Introduction To Database Management Systems
Introduction To Relational Database Management Systems
Database Architecture And Data Modeling
Overview Of Db2
Structured Query Language (sql)
Data Security And Access
Db2 Application Development
Qmf And Db2i
Db2 Performance Monitoring, Utilities And Recovery/restart
Overview Of Information Management System (ims)
Introduction To Vs Cobol Ii
Overview Of Application Development In Vs Cobol Ii
Overview Of The Cobol Program
Sorting And Merging Files
Coding Cobol Programs That Run Under Cics. Ims, Db2 And Ispf
Compiling The Program
Link-editing The Program
Executing The Program
Improving Program Performance
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.