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 are declaratives and what are their uses in cobol?

0 Answers  


) How do u handle errors in BMS macro

0 Answers   IBM,


how can we get current dat and time thru cobol pgm

3 Answers   DELL,


consider the following FD FILE-1 01 REC-1 PIC X(80) ...... WORKING-STORAGE SECTION 01 W-REC PIC X(90) ........ PROCEDURE DIVISION FIRST-PARA ....... READ FILE-1 INTO W-REC AT END MOVE 1 TO EOF-FLAG which of the following is true with respect to the above? a.REC-1 will contain nothing and W-REC will contain the contains of the record read b.REC-1 and W-REC contain the same data c.syntex is invalid and error will occur d.REC-1 and W-REC must be of same size

1 Answers   TCS,


consider the following progrm statements MOVE 0 TO SW.NO.OF.REC PERFORM PRI-OUT UNTIL SW=1 DISPALY NO.OF.REC STOP RUN PRE-OUT READ IN-FILE AT END MOVE 1 TO SW WRITE OUO-REC FROM IN-REC ADD 1 TO NO.OF REC if the IN-FILE contains 1000 records what value will be displayedafter the PERFORM is over?assume that N0.OF.REC has PIC 9(4) a.1000 b.1001 c.1 d.none of the above since there is a syntex error

4 Answers   TCS,






tell me about examine inspect and evaluate ?

2 Answers   CTS,


What is sqlca and why is it needed in any cobol-db2 program?

1 Answers  


In A cobol program , we can use COPY Statement in FILE- SECTION / WORKING-STORAGE SECTION / ENVIRONMENT DIVIION basically what is the difference

3 Answers   IBM,


We are using the searching a table which is indexed, once the key is found, how can we get the occurance at which the key was found.

1 Answers  


How include time & date in the report generation in cobol programing?

2 Answers  


What are the functions like c or c++ in cobol?

2 Answers  


i have two file, each file having : file1 is having 2 fields field1 field2 file2 is having 3 fields field1 field2 field3 my req is to make it one file like: field1 field2 field1 field2 field3 if anyone know please send me syntax, i tried this with DFSORT but could not succeed.

9 Answers   Syntel,


Categories