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

How to remove 2 duplicate records and copy only one using job control language?

0 Answers  


)what is retrieve?

1 Answers   IBM,


how do u link sub pgm to main pgm ?

2 Answers   TCS,


given the following: 77 A PIC 9V9 VALUE 9.5 77 B PIC 9 VALUE 9. 77 C PIC V9 VALUE 0.8 77 D PIC 9 77 E PIC 9 77 F PIC 9V999 what are the contenta of D E nad F after the following statements are executed: COMPUTE F ROUNDED=A+C/B MULTIPLY A BY C GIVING E ADD B C A GIVING D ROUNDED a.F=9.589 E=8 D=1 b.F=9.589 E=8 D=9 c.F=9.589 E=7 D=9 d.F=9.589 E=7 D=1

5 Answers   Broadridge, TCS,


What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(10) VALUE 'ABCDEFGHIJ'. 01 WS-VARN REDEFINES WS-VARX PIC 9(5) VALUE '12345'. What will happen I want Display WS-VARX and WS-VARN?

3 Answers   Xansa,






Why we need to use redefine clause when we can define the variable seperately... what is actual need....

5 Answers   Accenture,


Suppose i have a variable with s9(18)v99 comp3 . what is the size of variable . If s9(18) comp3 is 10 bytes . There should be some difference between two allocations ? Thanks krishna chaitanya

2 Answers   CSC,


How do u write test cases?

0 Answers   IBM,


How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?

0 Answers  


What is difference between COBOL and VS COBOL II?.

1 Answers   Winsol Solutions,


Scenario: I have 3 Input Files.Read the first i/p file and depending on certain business logic, I want to read wither i/p file-2 or i/p file-3.Now, depending on certain business logic applied to the record read from either file-2 or file-3, I decide to write them to either output file-2 or output file-2. Question: How many job steps are necessary to implement a solution for the above.

2 Answers   TCS,


I have a cobol program with a sub program. How ca i find that it is a dynamic call? or static call..?

3 Answers   HCL, IBM,


Categories