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

What COBOL construct is the COBOL II EVALUATE meant to replace?

1 Answers  


if you give cylinder(1,1)how many cylinders it will be allocate?

3 Answers   Hewitt,


What are decleratives in COBOL ?

1 Answers   Xansa,


What is the purpose of Identification Division?

1 Answers  


what is the difference between start and startbr?

2 Answers  






how the control comes back from subprogram to mainprogram

3 Answers   IBM,


What guidelines should be followed to write a structured Cobol program?

1 Answers  


i am a btech cs 2009 passout. i am opting for mainframe course. is it good to do this course? pls. anyone suggest me

4 Answers  


Following questions were asked in Capegemini on 8th sep,2012 mainframe test 1.)Condition code for dul recors in VSAM- 2.) Is NULL or =NULL in Select statement 3.)max size of CI 4.)What happens after CI is full 5.)Ques on COND parameter 6.)which among following can not be rolled back a)delete table b.)droptable c)Update d.)insert 7.)groupby and orderby sql querries 8.)Max extents in VSAM file 9.)quesn on DPRTY=(1,10) 10.)range of condition codes in COBOL 11.)occurs clase can not be used at which level? 12.)delimiter in jcl 13.)sort card for file in PGM=SORT 14.)PIC(6) value 120056 possible? 15)question on BLKSIZE Is (20,20) and (20,10) possible? 16.)number of bytes in RDF 17.)Can we use index in WS-section or LK-section 18.)Verify command in IDCAMS used for? 19.)question on Alternate Index 20.)Return code of file attribute mismatch 21.)In which format COBOL variables stored? 22.)what is Alternate of HANDLE? 23.)can SUM,AVG,MIN,ROUND used in numeric and char variable data types? 24.)What is the datatype of FILE STATUS codes in WS-section?

2 Answers   Cap Gemini,


What is the difference between write & move in COBOL?

3 Answers   CSC, HHB,


What compiler option would you use for dynamic linking?

2 Answers  


Is it possible to mutliply a comp variable with an comp-3 variable. Will there be any error if i do it?

3 Answers   IBM, UST,


Categories