Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how we can reverse the string in the cobol for example
satheesh can be reveresed as hseehtas

Answers were Sorted based on User's Feedback



how we can reverse the string in the cobol for example satheesh can be reveresed as hseehtas..

Answer / g venkatesh

data division.
01 ws-input pic x(8).
01 ws-output pic x(8).
01 i pic 9.
01 j pic 9.
procedure division.
move 1 to i.
perform varying j from 8 by -1 until j =0
move ws-input(i:1) to ws-output(j:1)
add 1 to i
end-perform
display ws-output.
stop run.

Is This Answer Correct ?    51 Yes 7 No

how we can reverse the string in the cobol for example satheesh can be reveresed as hseehtas..

Answer / adarsh

This can be achieved using
1. FUNCTION REVERSE - RECOMMENDED
2. REFERENCE MODIFICATION
.

1. MOVE FUNCTION REVERSE(WS-NAME-INPT) TO
WS-NAME-RVRS.

2. MOVE WS-NAME-INPT(1:1) TO WS-NAME-RVRS(8:1)
MOVE WS-NAME-INPT(2:1) TO WS-NAME-RVRS(7:1)
MOVE WS-NAME-INPT(3:1) TO WS-NAME-RVRS(6:1)
MOVE WS-NAME-INPT(4:1) TO WS-NAME-RVRS(5:1)
MOVE WS-NAME-INPT(5:1) TO WS-NAME-RVRS(4:1)
MOVE WS-NAME-INPT(6:1) TO WS-NAME-RVRS(3:1)
MOVE WS-NAME-INPT(7:1) TO WS-NAME-RVRS(2:1)
MOVE WS-NAME-INPT(8:1) TO WS-NAME-RVRS(1:1).

Is This Answer Correct ?    19 Yes 6 No

how we can reverse the string in the cobol for example satheesh can be reveresed as hseehtas..

Answer / paul

DATA DIVISION.
WORKING-STORAGE SECTION.
01 I PIC 9.
01 J PIC 9.
01 ST1 PIC X(5).
01 ST2 PIC X(5).
PROCEDURE DIVISION.
MOVE 1 TO I.
MOVE 'KOTI' TO ST1.
PARA-A.
PERFORM PARA-B VARYING J FROM 5 BY -1 UNTIL J = 0.
DISPLAY 'STRING REVERSE' ST2.
STOP RUN.
PARA-B.
MOVE ST1(I:1) TO ST2(J:1).
ADD 1 TO I.

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More COBOL Interview Questions

i Want All cobol ERROR codes?

4 Answers   HCL, IBM,


SUPPOSE I HAVE 60 CHARACTERS STING. IN THAT I WANT FIND OUT HOW MANY TIMES 'A'(ASSUME)WILL REPEATED AND I HAVE TO PASS 'E' IN PLACE OF 'A'ALONG THAT STRING.

2 Answers   Wipro,


whats the disadvantage of search all over search?

4 Answers   Patni, TCS,


I have a field with data type X(10). I want to perform arithmetic operation on this field? I tried doing it by moving the value into a numeric field. but it didn't work out. I am getting a S0C7 abend. Pls let me know if there is any way of getting this done?

1 Answers  


i have mainprogram and subgram...if i compile mainprogram without stop run..what will u get in compilation time?

5 Answers   HCL,


How do you reference the following file formats from cobol programs?

0 Answers  


which is better comp or comp-3 in terms of memory utilization?

6 Answers  


WHAT IS SOC3?HOW IT CAN BE RESOLVED?

1 Answers  


how can we get current dat and time thru cobol pgm

3 Answers   DELL,


HOW TO MOVE REDEFINES CLAUSE FROM INPUT TO OUTPUT ?

1 Answers  


What is Static,Dynamic linking ?

2 Answers  


How to Write the RESTART Logic Using COBOL?

4 Answers   GalaxE, L&T, Syntel, TCS,


Categories