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 is difference between cobol and cobol/400
State the various causes of s0c1, s0c5 and s0c7.
) how do u code after getting data?
How do you reference the following file formats from cobol programs?
What are the rules of the move verb?
Write some characteristics of cobol as means of business language.
What are literals?
What are the different rules of SORT operation?
What are the different open modes available in cobol?
What is perform what is varying?
Write a cobol program making use of the redefine clause.
What are 77 levels used for?
what happens if parmparameter passes zero bytes to the program
What is report-item in COBOL?
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?