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

What is amode(24)?

678


How do you define a variable of comp-1 and comp-2?

694


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

1605


Which is not true about evaluate statement

1562


Write some characteristics of cobol as means of business language.

611






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

700


When is inspect verb is used in cobol?

669


Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?

701


What is the usage of comp fields in cobol?

647


Write a cobol program making use of the redefine clause.

721


Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

5049


what is the difference between COBOL2 AND COBOL390?

2442


what are decleratives in cobol?

1821


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

671


What is the difference between PIC 9.99 and 9v99 in COBOL?

727