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
I have a File that has duplicate records. I need only those records that occur more than thrice.?
What are 77 levels used for?
what is search and searchall?what is the diffrence between them?give an best example?
What kind of error is trapped by on size error option?
Discuss about changing dataset name in proc.
What is report-item in COBOL?
Difference between cobol and cobol-ii?
how we sort two input files based on a common column and giving one o/p file please send me the coding logic?
What rules are followed by the search verb.
There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.
Explain the configuration section of a cobol program with examples of syntax.
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
Explain how you can characterize tables in cobol?
what is the use of outrecord?