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


Please Help Members By Posting Answers For Below Questions

I have a File that has duplicate records. I need only those records that occur more than thrice.?

9238


What are 77 levels used for?

846


what is search and searchall?what is the diffrence between them?give an best example?

6182


What kind of error is trapped by on size error option?

960


Discuss about changing dataset name in proc.

959


What is report-item in COBOL?

894


Difference between cobol and cobol-ii?

945


how we sort two input files based on a common column and giving one o/p file please send me the coding logic?

1885


What rules are followed by the search verb.

829


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.

1165


Explain the configuration section of a cobol program with examples of syntax.

865


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.

5423


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

886


Explain how you can characterize tables in cobol?

821


what is the use of outrecord?

1970