How to display string in the reverse order using occurs
clause?
Answer Posted / fool
both r foolish programmers...heres the working code..
identification division.
program-id pg1.
environment division.
data division.
working-storage section.
01 j pic 99.
01 i pic 99.
01 s1 pic a(15).
01 s2 redefines s1.
02 instr pic a(1) occurs 15 times.
01 s3 pic a(15).
01 s4 redefines s3.
02 outstr pic a(1) occurs 15 times.
procedure division.
p1.
display "Enter the string ".
accept s1.
perform p3 varying i from 15 by -1 until i = 0.
display "Reverse string ".
display s4.
stop run.
p3.
compute j = 15 - i + 1.
move instr(i) to outstr(j).
| Is This Answer Correct ? | 11 Yes | 0 No |
Post New Answer View All Answers
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
how we sort two input files based on a common column and giving one o/p file please send me the coding logic?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
What rules are to be followed while using the corresponding options?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
What is the difference between comp and comp-3 usage?
Write a program to explain size error.
What are the different data types in cobol?
explain sorting techniques in cobol program?
) How do u handle errors in BMS macro?
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 usage of comp fields in cobol?
how do you reference the rrds file formats from cobol programs
What are different data types in cobol?