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 comp-1 and comp-2?
What is inspect in cobol ?
Can a Search can be done on a table with or without Index?
how to convert the recors form vsam file to db2 table tru file aid
What is the difference between Global and External Variables?
How to remove 2 duplicate records and copy only one using job control language?
) how do u code after getting data?
Mention the guidelines to write a structured cobol program?
What is the default value(s) for an initialize and what keyword allows for an override of the default?
How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?
How are the next sentence and continue different from each other?
which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad
What type of SDLC u followed? Why?
State the various causes of s0c1, s0c5 and s0c7.
How do you reference the following file formats from cobol programs?