How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
Answer / Mohamad Waseem
Reading the second-last record of a VSAM file without knowing the key can be challenging, but there are ways to achieve this using COBOL:
1. Set up a separate sequence set for the reverse read.
2. Set the initial record as the maximum record number (or one less than it if you want the second-last record).
3. Open the file in sequential access mode and read records in reverse order until you reach the desired record or the beginning of the file.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to solve SOC7. I have the cobol coded as below 01 A PIC 9(4). 01 AIN REDEFINES A. 05 AIN1 PIC S9(4) 01 B PIC 9(4)V99. 01 BIN REDEFINES B. 05 BIN1 PIC S9(4)V99. PROCEDURE DIVISION. START-PARA. INITIALIZE A AIN B BIN. ACCEPT A B. DISPLAY 'VALUE OF A=' A. DISPLAY 'VALUE OF B=' B. DISPLAY 'VALUE OF BIN1=' BIN1. DISPLAY 'VALUE OF AIN1=' AIN1. COMPUTE AIN1 = BIN1 - AIN1. DISPLAY 'VALUE OF AIN1=' AIN1. When i'm executing this code i'm getting SOC7 for A = 12 & B=34. Can someone explain SDSF OUTPUT DISPLAY TCOM058R JOB05458 DSID 102 LINE 0 COLUMNS 02- 81 COMMAND INPUT ===> SCROLL ===> CSR ********************************* TOP OF DATA ********************************** VALUE OF A=12 VALUE OF B=34 VALUE OF BIN1=34 VALUE OF AIN1=12 CEE3207S The system detected a data exception (System Completion Code=0C7). From compile unit PROG1 at entry point PROG1 at statement 29 at compile +000004CE at address 00007ECE. Please address how to solve this issue Thanks in advance.
ZEROES and SPACES are _______ constants (a) Figurative (b) Numeric (c) Non-numeric (d) Alphabete
how can u find out just by seeing wheater it is main program or sub program ? any two ways to identify reply soon ?
Describe the difference between subscripting and indexing ?
i have a sequencial file contains multiple records, i want to extract one row which contains various fields like order number,date,warehouse,.ect.. in to the another file by accepting the order number from jcl. how can i do it. pls help me..
Which Search verb is equivalent to PERFORM…VARYING?
sample code for read a 2nd record from last in flatfile how can do?
What are literals?
) how do u code after getting data?
What are different data types in cobol?
What is 77 level used for ?
) How do you access the migrate the data from production region to development region