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


Please Help Members By Posting Answers For Below Questions

How can you get the ksds file records into your cobol program?

862


which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad

1247


Why would you use find and get rather than to obtain?

916


What are the different rules for performing sort operation?

985


Whats the difference between search & search ALL?

5922


A table has two indexes defined. Which one will be used by the SEARCH?

1034


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

3004


How do you reference the fixed block file formats from cobol programs

931


What is a SSRANGE and NOSSRANGE?

1131


What is comp-1 and comp-2?

950


HOw can I get the negative sign while deduct high value from low value

2023


What kind of error is trapped by on size error option?

970


IF I mention stop run in CICS what happens?

2109


In which area will you utilize 88 level items in cobol?

913


Write a program that uses move corresponding.

882