Why we need to use redefine clause when we can define the
variable seperately... what is actual need....

Answer Posted / vaneesh

One more advantage of redefines is that we can use the same
value with different declarations.
For Example
lets say we receive input value as 'b123'. b is blank
and we want to display it as 01.23 in the spool. This can
be done with redefines as follows.

WORKING-STORAGE section
01 LEARNING
05 WS-RECIEVE-VAL PIC X(4).
05 WS-RECIEVE-RED REDEFINES WS-RECIEVE-VAL PIC 9(2)V
(2).

01 WS-FOR-DISPLAY PIC 9(2).9(2).

PROCEDURE DIVISION.

MOVE 'b123' TO WS-RECIEVE-VAL
MOVE WS-RECIEVE-RED TO WS-FOR-DISPLAY

DISPLAY WS-FOR-DISPLAY

STOP RUN.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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.

5229


What is the difference between PIC 9.99 and PIC9v99?

904


i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc

2202


How do you reference the following file formats from cobol programs?

797


A table has two indexes defined. Which one will be used by the SEARCH?

873






What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?

804


What is the difference between PIC 9.99 and 9v99 in COBOL?

849


What is the use of intialize verb?

860


How do you get the data to code the BMS macro?

1569


Write the code implementing the perform … varying.

722


input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?

1985


) How do u handle errors in BMS macro

1588


How arrays can be defined in COBOL?

741


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

2007


how do you reference the ksds vsam file formats from cobol programs

751