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 / mainframe guy

You can also do it this way:

DATA DIVISION
01 A1 VALUE 'A1B2C3D4'
05 A1-CHAR PIC X(01) OCCURS 8.
01 A2 PIC X(04) VALUE SPACES.
01 A3 PIC X(04) VALUE SPACES.
01 I PIC 9(02) VALUE ZEROS.
01 J PIC 9(02) VALUE ZER0S.
01 K PIC 9(02) VALUE ZEROS.

PROCEDURE DIVISION.
MOVE 1 TO I J K
PERFORM VARYING I FROM 1 BY 1 UNTIL WS-I > 8
IF A-CHAR(I) IS NUMERIC
MOVE A-CHAR(I) TO A3(K:1)
ADD 1 TO K
ELSE
MOVE A-CHAR(I) TO A2(J:1)
ADD 1 TO J
END-IF
END-PERFORM

Now you will have A2 = ABCD and A3 = 1234
This method can be used only if you want to seperate numbers
from alphabets. Otherwise, the previous solution has to be used.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the code implementing the perform … varying.

1025


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

9035


what are decleratives in cobol?

2219


) what is the difference between AID and HANDLE AID?

2110


What is the difference between structured cobol programming and object alternativelyiented cobol?

1209


What is the usage of comp fields in cobol?

1147


what is difference between cobol and cobol/400

22769


What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

1341


i need a small 3d program using inline and outline.

2178


In COBOL programming, what is PERFORM? What is VARYING?

1100


What kind of error is trapped by on size error option?

1189


What are the different types of condition in cobol and write their forms.

1078


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

1390


What is the problem of ordered sequential files access?

1130


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

5327