Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What guidelines should be followed to write a structured cobol prgm?

1086


Why occurs cannot be used in 01 level in COBOL?

1121


Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?

1110


What is the difference between next sentence and continue in cobol programing language?

1154


Why did you choose to work with ibm mainframe cobol programming?

1032


I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue

2481


Have you used comp and comp-3 in your project? And how?

2423


I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.

1507


Name the sections present in data division.

1172


A table has two indexes defined. Which one will be used by the SEARCH?

1228


What is perform what is varying?

1110


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)?

1052


Name some of the examples of COBOl 11?

3081


What is cobol?

1187


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

1180