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


Please Help Members By Posting Answers For Below Questions

Which is not true about evaluate statement

1567


what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.

8156


how do you reference the variable block file formats from cobol programs

680


Discuss about changing dataset name in proc.

757


What is the problem of ordered sequential files access?

693






What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

670


How do you differentiate between cobol and cobol-ii?

651


Which division and paragraphs are mandatory for a COBOL program?

707


I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.

2004


How do you get the data to code the BMS macro?

1472


what are decleratives in cobol?

1827


Can you please let me know the centre name of INS certification in Kolkata.

1713


How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?

1926


What is a SSRANGE and NOSSRANGE?

818


How do get the result of your program directly on your pc?

1878