How To Separate The Numerics From An Alphanumric Data Item
Which Contains Both Alphabates And Numerics ?

Answers were Sorted based on User's Feedback



How To Separate The Numerics From An Alphanumric Data Item Which Contains Both Alphabates And Nume..

Answer / shriram supalwar, dharmabad

01 A pic x(10) value 'a1b2c34d5e'.
01 B pic x(5).
(You want to move only numeric data from a to b)

PERFORM PARA1 VARYING I FROM 1 BY 1 UNTIL I>10
PARA1.
IF A(I:1) IS NUMERIC
MOVE A(I:1) TO B(I:1)
END-IF
END-PERFORM.
DISPLAY "NUMERIC DATA IS:" B(I).

Is This Answer Correct ?    12 Yes 0 No

How To Separate The Numerics From An Alphanumric Data Item Which Contains Both Alphabates And Nume..

Answer / harsha

Use COBOL program and check byte by byte.

Is This Answer Correct ?    9 Yes 0 No

How To Separate The Numerics From An Alphanumric Data Item Which Contains Both Alphabates And Nume..

Answer / kingmanish

Use the COBOL keyword ISNUMERIC.

This would be evaluated to true if the value stored is
numeric and you can separate the numeric values

Is This Answer Correct ?    2 Yes 1 No

How To Separate The Numerics From An Alphanumric Data Item Which Contains Both Alphabates And Nume..

Answer / reddy

use Function NUMVAL

Is This Answer Correct ?    4 Yes 8 No

Post New Answer

More COBOL Interview Questions

Why there is no questions in this column?

6 Answers  


What is the point of the REPLACING option of a copy statement?

3 Answers  


how to fetch the record before the last record in a cobol file( its a huge file and if the key field is not known)

5 Answers   IBM,


what are the steps to sort in a cobol program?

2 Answers   Patni,


how many maximum no of variables can be declared in linkage section ?

2 Answers   HCL,






Can the OCCURS clause be at the 01 level?

8 Answers   Oracle,


I have dataset DS1 which has records say 1 2 3 4 5 ... ... etc And also I have second dataset DS2 whcih has records 1 3 4 5 6 8 .. ... Both the files are sorted and now I want to compare these files and write it into the third files if the records are matching.

4 Answers   FIS, Wipro,


what is difference between cobol and cobol/400

1 Answers   HCL,


I know my query will return more than one row but I don't want cursor what should I do?

1 Answers  


What is the significance of 'above the line' and 'below the line'?

2 Answers   Nokia,


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

0 Answers  


What is link edit in cobol?

0 Answers  


Categories