can we read records in a file from botom to top. if
possible how can we read
Answers were Sorted based on User's Feedback
Answer / raj
yes,it is possible through JCL.
1. QSAM (sequential) file. You can run it thru SORT utility
adding SEQNUM and then sort then sort by SEQNUM in DESC
order
2. VSAM: In CICS you can read backward using READREV;
3. VSAM: I Batch unload the VSAM file using SORT in DESC
order by key value.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / rakesh
you can point to last rec using start, then read using 'read
prior' statement
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / guest
If you are using CICS Answer:1 is correct. Orther wise we
can not read from botom to top.
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / jayant
WORKAROUND:Sort the file in the descending manner first
based on its key,than read it normally.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / kk
data division.
working storage section.
01 opr pic a(1).
01 arrays.
02 aaa occurs n times.
03 name attribute.
------------------
------------------
01 I pic 9(2) value 1.
procedure division.
open file
read file at end move 'n' to opt
perform para1 until opt = 'n'
perform para2 until i = 0
para1.
move filed to aaa
add i to i.
read file at end move 'n' to opt.
perform-end.
para2.
diplay aaa(I).
compute i=i-1.
perform-end.
stop run.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / hari
Move low values to the key and then use READ PREV.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / krishna
If it is a tape file,
OPEN INPUT FILEXXX REVERSED,
then the pointer is posistioned at the last record and read
next will read the prior record...
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / piyush mani
hi all..
store the content of file in table(array) and then
by using index of array start reading the file from bottom
giv ur feedback....
| Is This Answer Correct ? | 0 Yes | 1 No |
which is better comp or comp-3 in terms of memory utilization?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
what is s013u000 for?
The below is the declaration for a variable ws 01 ws pic 9(3). if you want to insert space how will you do that. in which level u should do it
For rewrite, why is it mandatory that file needs to be opened?
in cobol main pgm is calling sub pgm but sub pgm does not exists , what abend i get if submit the job?
DATAONLY, MAPONLY functionality?
what is the difference between implicit and explicit scope terminator with example?
PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B>2 AFTER C FROM 2 BY -1 UNTIL C<2 How many times the paragraph ACCUMULATE-TOTALS would be exicuted?
how we can edit records in vsam data set and non vsam data sets
I am sending values a and b with pic x(10) and pic x(10) by using call statement. In linkage section, I am receiving values with pic x(10) and pic x(11). Will my program fail? will it be compile error or run time abend?
01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i need to get the miuns sign in the result?