01 NAME1 PIC X(13) VALUE "COBOL PROGRAMMING".
01 NAME2 PIC X(13).
now I want to display the value of NAME1 in reverse order
i.e value should be displayed as "GNIMMARGORP LOBOC"
HOW can I do that ??? please let me know if any one knows
it.

Answer Posted / sunil

Hi,

Please try this code it should work.

IDENTIFICATION DIVISION.
PROGRAM-ID. MID.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 STR1 PIC X(17) VALUE IS 'COBOL PROGRAMMING'.
01 STR2 PIC X(1).
01 STR3 PIC X(17) VALUE SPACE.
01 STRLEN PIC 9(2).

PROCEDURE DIVISION.
INSPECT STR1 TALLYING STRLEN FOR CHARACTERS.
DISPLAY STRLEN.
PERFORM UNTIL STRLEN < 1

MOVE STR1(STRLEN:1) TO STR2
DISPLAY STR2
STRING
STR3 DELIMITED BY SPACE
STR2 DELIMITED BY SPACE
INTO STR3
COMPUTE STRLEN STRLEN - 1
DISPLAY STR3
END-PERFORM.
DISPLAY STR3.
STOP RUN.


Thanks,
Sunil

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What rules are to be followed while using the corresponding options?

632


What type of SDLC u followed? Why?

1516


input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?

1868


Can we redefine the field of x(200) to less than 200?

814


) how do u code after getting data?

1578






explain sorting techniques in cobol program?

686


What are the different rules for performing sort operation?

757


Name the divisions, which are available in a cobol program?

681


Whats the difference between search & search ALL?

5258


Differentiate between structured cobol programming and object-oriented cobol programming.

663


how do you reference the esds vsam file formats from cobol programs

627


what is difference between cobol and cobol/400

21556


What is Pic 9v99 Indicates in COBOL?

720


Explain how you can characterize tables in cobol?

636


What is the Purpose of Pointer in the string?

640