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
If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly
example for sub strings ? and refernce modifications whit output pls
What is inspect in cobol ?
What is static and dynamic call in cobol?
how to convert the recors form vsam file to db2 table tru file aid
Can you please let me know the centre name of INS certification in Kolkata.
Explain how to differentiate call by context by comparing it to other calls?
i need a small 3d program using inline and outline.
how do you reference the fixed unblock file formats from cobol programs
explain sorting techniques in cobol program?
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)?
For rewrite, why is it mandatory that file needs to be opened?
Why occurs cannot be used in 01 level in COBOL?
I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?