COBOL program to read the string ' BOMBAY' in reverse order as 'YABMOB'

Answer Posted / sushree

id division.
prog-id. hello.
data division.
working-storage section.
01 ws-str pic A(6) value 'BOMBAY'.
01 ws-cnt pic 9(1).
01 ws-str1 pic A(1).
01 ws-str2 pic A(6) value space.
procedure division.
inspect ws-str tallying ws-cnt for all characters
display ws-cnt
perform until ws-cnt < 1
move ws-str3(ws-cnt:1) to ws-str1
string ws-str2 delimited by space
ws-str1 delimited by size
into ws-str3
compute ws-cnt = ws-cnt - 1
end-perform.
display ws-str3.
stop run.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to print 10 to 1 if the input have only 10 digit number?

802


Discuss about changing dataset name in proc.

757


Write the code implementing the perform … varying.

635


I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.

1103


Write the code to count the sum of n natural numbers.

695






) How do u handle errors in BMS macro

1498


how do you reference the variable block file formats from cobol programs

672


What is the difference between PIC 9.99 and PIC9v99?

769


In COBOL programming, what is PERFORM? What is VARYING?

664


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

666


Difference between cobol and cobol-ii?

697


)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?

1515


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 static and dynamic call in cobol?

586


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

1221