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 / jagan
This should convert the string in reverse order without any
built-in functions . And one more thing is COBOL PROGRAMMING
is actually 17 characters.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NAME-1 PIC X(17) 'COBOL PROGRAMMING'
01 NAME-2
05 NAME-21 PIC X(1) OCCURS 17 TIMES.
01 I PIC X(2)
01 J PIC X(2)
PROCEDURE DIVISON.
MAIN-PARA.
MOVE 0 TO J.
PERFORM READ-NAME VARYING I FROM 17 BY -1 UNTIL I > 0.
STOP RUN.
READ-NAME
ADD 1 TO J.
MOVE NAME-1(I) TO NAME-21(J).
END-READ-NAME.
Correct me in case any problem with above code.
| Is This Answer Correct ? | 7 Yes | 4 No |
Post New Answer View All Answers
What rules are followed by the search verb.
How do you reference the fixed block file formats from cobol programs
Write the code implementing the perform … varying.
What is the difference between Global and External Variables?
what is the use of outrecord?
Define cobol?
What rules are to be followed while using the corresponding options?
Difference between array and sub-script ?
example for sub strings ? and refernce modifications whit output pls
What is the Purpose of POINTER Phrase in STRING command in COBOL?
How did the release of cobol/370 version 1.3 improve the performance of release 1.1?
What kind of error is trapped by on size error option?
What is a report item?
What the difference is between continue and next sentence?
Explain how to differentiate call by context by comparing it to other calls?