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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are all the divisions of a COBOL program?

660


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

668


What is difference between static and dynamic call in cobol?

772


what happens if parmparameter passes zero bytes to the program

1659


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

752






How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

2728


What is a scope terminator give example?

652


i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com

1765


What is the default value(s) for an initialize and what keyword allows for an override of the default?

691


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

624


Can we redefine the field of x(200) to less than 200?

814


Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks

2331


Which mode is used to operate the sequential file?

658


What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?

672


) How do u handle errors in BMS macro?

1425