i have a file which contains records like
10,30,90,50,20,40,80,60,70
i want to display these records in reverse order like
70,60,80,40,20,50,90,30,10
please give me the cobol code (do not sort the records)
Answer Posted / preethi
Declare table , and a index variable in the working storage section.
Procedure Division.
Open file1.
perform para1 thru para1-exit until end-of-file.
perform display-para thru display-para-exit.
close file1.
go back.
Para1.
read file1 into ws-file1
at end
end-of-file
set index-diff to index
not at end
move ws-file1-num to table-num(index)
set index up by 1
end-read.
para1-exit.
exit.
Display-para.
subtract 1 from index-diff.
perform until index-diff = 0
display table-num(index-diff)
set index-diff down by 1
end-perform.
display-para-exit.
exit.
| Is This Answer Correct ? | 5 Yes | 3 No |
Post New Answer View All Answers
What is the difference between structured cobol programming and object alternativelyiented cobol programming?
How many bytes S(8) comp field occupy and its maximum value?
What are the various section in data division and briefly explain them.
example for sub strings ? and refernce modifications whit output pls
What is Pic 9v99 Indicates in COBOL?
Which Search verb is equivalent to PERFORM…VARYING?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
how do you reference the printer file formats from cobol programs
I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.
What is the difference between goback, stop run and exit program in cobol?
How do you define a variable of comp-1 and comp-2?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need
What is rmode(24)
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?