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
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?
How arrays can be defined in COBOL?
Can a Search can be done on a table with or without Index?
How to know whether the module is dynamical or statistical?
How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?
write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc
Write some characteristics of cobol as means of business language.
how do you reference the printer file formats from cobol programs
What is the difference between next sentence and continue in cobol programing language?
What are declaratives and what are their uses in cobol?
Give some examples of command terminators?
if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.
What is the local-storage section?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there