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 can you get the ksds file records into your cobol program?
which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad
Why would you use find and get rather than to obtain?
What are the different rules for performing sort operation?
Whats the difference between search & search ALL?
A table has two indexes defined. Which one will be used by the SEARCH?
How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
How do you reference the fixed block file formats from cobol programs
What is a SSRANGE and NOSSRANGE?
What is comp-1 and comp-2?
HOw can I get the negative sign while deduct high value from low value
What kind of error is trapped by on size error option?
IF I mention stop run in CICS what happens?
In which area will you utilize 88 level items in cobol?
Write a program that uses move corresponding.