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

how to pass 100 to s9(4) how r they inserted ?

3 Answers   TCS,


What are the various section in data division and briefly explain them.

0 Answers  


1.What is the default print format in cobol?

5 Answers   HSBC,


What is difference between comp & comp-4?

6 Answers  


what is MSGLEVEL?

1 Answers   IBM,






i have mainprogram and subgram...if i compile mainprogram without stop run..what will u get in compilation time?

5 Answers   HCL,


Explain how to differentiate call by context by comparing it to other calls?

0 Answers  


What are ISOLATION LEVELS? Where do we need to specify them in compiling JCL (Exactly which statement and what is syntax for it)?

2 Answers   T systems,


Are you comfortable in cobol or jcl?

0 Answers  


Can we use redefine clause in occurs clause?

10 Answers  


for an INITIALIZE and what keyword allows for an override of the default.

2 Answers  


I want ALL ERROR codes in VSAM

3 Answers   American Express, TCS,


Categories