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
What rules are to be followed while using the corresponding options?
What type of SDLC u followed? Why?
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 ?
Can we redefine the field of x(200) to less than 200?
) how do u code after getting data?
explain sorting techniques in cobol program?
What are the different rules for performing sort operation?
Name the divisions, which are available in a cobol program?
Whats the difference between search & search ALL?
Differentiate between structured cobol programming and object-oriented cobol programming.
how do you reference the esds vsam file formats from cobol programs
what is difference between cobol and cobol/400
What is Pic 9v99 Indicates in COBOL?
Explain how you can characterize tables in cobol?
What is the Purpose of Pointer in the string?