here is my requirement
A1 is alphanumeric with value 'A1B2C3D4' as defined below
05 A1 PIC X(8) VALUE IS 'A1B2C3D4'
but i need to have A2,A3 as ABCD & 1234 repectively......
A2 = ABCD
A3 = 1234
Can you please explain me what are the different ways to do it?
Answer Posted / rajkanya
DATA DIVISION.
WORKING-STORAGE SECTION.
01 GROUP1.
05 A1 PIC X(08)
VALUE 'A1B2C3D4'.
05 ARRAY1 REDEFINES A1 OCCURS 8 TIMES
PIC X(01).
01 ARRAY2.
05 A2 OCCURS 4 TIMES PIC X(01).
01 ARRAY3.
05 A3 OCCURS 4 TIMES PIC X(01).
01 WS-COUNT PIC 9(02)
VALUE 01.
PROCEDURE DIVISION.
PERFORM MOVE-LETTERS-PARA VARYING ODD FROM 1 BY 2
UNTIL ODD > 8
* INITIALIZE THE COUNTER FOR SECOND LOOP
MOVE 01 TO WS-COUNT
*
PERFORM MOVE-NUMBERS-PARA VARYING EVEN FROM 2 BY 2
UNTIL EVEN > 8
.
.
.
MOVE-LETTERS-PARA.
MOVE ARRAY (ODD) TO ARRAY2 (WS-COUNT)
ADD 1 TO WS-COUNT
.
.
MOVE-NUMBERS-PARA.
MOVE ARRAY (EVEN) TO ARRAY3 (WS-COUNT)
ADD 1 TO WS-COUNT
.
.
.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?
Define static linking and dynamic linking.
How to use the same COBOL program in Batch and CICS on lines? explain with an example
What is rmode(24)
How many bytes S(8) comp field occupy and its maximum value?
how to access the file from prodution from changeman tool and to submit a file to production
What is an in line perform? When would you use it? Anything else you wish to say about it.
What is the difference between comp and comp-3?
i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com
What is report-item in COBOL?
how do you reference the printer file formats from cobol programs
For rewrite, why is it mandatory that file needs to be opened?
can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech
what is the difference between COBOL2 AND COBOL390?
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?