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 is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
What are the different open modes available in cobol?
How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?
Have you used comp and comp-3 in your project? And how?
What is report-item in COBOL?
Define cobol?
What is amode(24)?
What are the pertinent COBOL commands?
Can we change the password using ALTER? anyone tried and changed?
What is length is cobol?
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
Can you please let me know the centre name of INS certification in Kolkata.
What is the difference between next sentence and continue in cobol programing language?
Describe the cobol database components?
i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this