in cobol i have one file it contains records like
10,4,23,98,7,90..... total records 100. iwant 10 to 20 in
reverse order in cobol environ ment any one please give the
answer......

Answers were Sorted based on User's Feedback



in cobol i have one file it contains records like 10,4,23,98,7,90..... total records 100. iwant 10 ..

Answer / ramesh kumar

let me explain the ans for if the file is PS.
fist compute the value 100-80 into one ws-variable.
then read the file and add 1 to some ws-count variable upto 20th record then check for the conditon if it is 20th record
like if ws-variable = ws-count
if it is then write into o/p rec, now decresae 1 from ws-variable like subtract 1 from ws-variable
and read file again add 1 to ws-count then check for the conditon if it is 19 recrd then write into o/p rec.
perform until ws-variable=0.

Is This Answer Correct ?    2 Yes 1 No

in cobol i have one file it contains records like 10,4,23,98,7,90..... total records 100. iwant 10 ..

Answer / karthick

Ya its simple.......
U can select these records as primary key in ksds cluster.
In cobol program you specify access as random. then select
particular records. and then sort it out in reverse order.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More COBOL Interview Questions

What is the utilization of copybook in cobol? Could we utilize a similar copybook?

0 Answers  


How do u sort the table for Search ALL? Is it only using ASCENDING KEY IS statement in occurs clause? If the data is input in non ascending order, will the ASC KEY IS automatically sort the data? or will it throw compile time error?

1 Answers   CTS,


can we read records in a file from botom to top. if possible how can we read

12 Answers   ACS,


Define REDEFINE clause and Is it possible to have the redefine clause anywhere in the working storage section for a data name?

3 Answers  


Consider the below example call a-test1. -- -- -- a-test1. if a=b perform a-test through a-exit next sentence else if b=c perform c-test through c-exit. if a=d perform d-test through d-exit. a-test. -- -- a-exit. exit. can u tell me what will happen if a=b after looping into a-exit will the control go back to a- test1. will the condition a=d be checked???

5 Answers   IBM,






At the minimum, which division of COBOL is enough to be coded?

3 Answers   CTS,


What is the difference between SEARCH and SEARCH ALL? What is more efficient?

9 Answers   IBM, iFlex, Wipro,


01 A pic 9(100) find record length of it

6 Answers   TCS,


why we are using picture clause in the cobol programs?

2 Answers  


here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?

2 Answers   IBM,


i have the job which has written updated 100 records into the table and for 101th record it got abended and i want to start the job again and should wirte from 101th record not from 1st record..how to do it..?

6 Answers  


Write a program that uses move corresponding.

0 Answers  


Categories