Can we move SPACES to numeric field and ZEROES to
alphabetic field? If yes what are the way doing this?
Answer Posted / maneendra
Hi all,
I am adding one more point to all.
we can move spaces to numeric field without using redefines
also. it can be possible by Reference modification(The
compiler will then treat your WS-NUM field as alphanumeric.
The field length is not necessary).
sample prog and results are:
IDENTIFICATION DIVISION.
PROGRAM-ID. SPATONUM.
AUTHOR. MANEENDRA.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-NUM PIC 99.
01 WS-STR REDEFINES WS-NUM PIC XX.
PROCEDURE DIVISION.
MOVE ZEROS TO WS-NUM.
DISPLAY 'BEFORE:', WS-NUM.
MOVE SPACES TO WS-NUM(1:).
DISPLAY 'AFTER:', WS-NUM.
STOP RUN.
OUTPUT:
BEFORE:00
AFTER:
For moving numeric field to Alphanumeric field, we can pass
it directly.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What are all the divisions of a COBOL program?
In which area will you utilize 88 level items in cobol?
write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc
how we sort two input files based on a common column and giving one o/p file please send me the coding logic?
How can you get the ksds file records into your cobol program?
What are different data types in cobol?
how do you define single dimensional array and multidimensional array in your cobol?
how to move the records from file to array table. give with code example
What are the access modes of START statement?
In COBOL, what is the different between index and subscript?
What is the use of intialize verb?
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
What is the difference between PIC 9.99 and PIC9v99?
Which mode is used to operate the sequential file?