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

Discuss about changing dataset name in proc.

759


Can we change the password using ALTER? anyone tried and changed?

1547


Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.

2058


What is a SSRANGE and NOSSRANGE?

820


What are the different rules of SORT operation?

698






1.give the details about WHEN OTHER. 2. how many form are available in evaluate.

1614


What is the difference between next sentence and continue in cobol programing language?

708


State the various causes of s0c1, s0c5 and s0c7.

661


What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?

677


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1844


What is the Purpose of POINTER Phrase in STRING command in COBOL?

721


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

684


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

1790


What is report-item in COBOL?

711


How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

700