What will happen if a variable is declared as below..
Explain with an example? Working storage section:-

01 WS-VARX PIC X(10) VALUE 'ABCDEFGHIJ'.
01 WS-VARN REDEFINES WS-VARX PIC 9(5) VALUE '12345'.

What will happen I want Display WS-VARX and WS-VARN?

Answers were Sorted based on User's Feedback



What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

Answer / reena

The Redefined clause cannot contain a Value Clause.
i.e. it should only be WS-VARN REDEFINES WS-VARX PIC 9(5).

Is This Answer Correct ?    12 Yes 1 No

What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

Answer / jitinder

The Syntax of Redefine Clause is

Label number data-name-1 REDFINES data-name-2

Here data-name-1 should not contain VALUE clause, but data-
name-2 can contain VALUE clause.

Plz correct me if i m wrong.

Is This Answer Correct ?    1 Yes 3 No

What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

Answer / saveen

ws-varx will have 12345fghij
ws-varn will have 12345.

pls kindly post ur views. am a beginner.

Is This Answer Correct ?    4 Yes 11 No

Post New Answer

More COBOL Interview Questions

why do u need inspect verb?

3 Answers   Patni,


Difference between ps, esds

3 Answers  


What are the different forms of EVALUATE statement?

2 Answers   IBM, Micro Labs,


Which of the following paragraphs is compulsory in every COBOL program? (a) SPECIAL-NAMES (b) PROGRAM-ID (c) FILE-CONTROL (d) OBJECT-COMPUTER

4 Answers  


What is inspect in cobol ?

0 Answers   Infosys,






what is rediffine clause?in what situation it can use?give me real time example?

1 Answers   IBM,


What is the Linkage section? What is the Use and Why the parm length use alway "PARM-LENGTH PIC S9(4) or PIC S9 (4) COMP." any reason?.Please let me know any one... Cheers,Prasad

8 Answers   Syntel,


How to solve SOC7. I have the cobol coded as below 01 A PIC 9(4). 01 AIN REDEFINES A. 05 AIN1 PIC S9(4) 01 B PIC 9(4)V99. 01 BIN REDEFINES B. 05 BIN1 PIC S9(4)V99. PROCEDURE DIVISION. START-PARA. INITIALIZE A AIN B BIN. ACCEPT A B. DISPLAY 'VALUE OF A=' A. DISPLAY 'VALUE OF B=' B. DISPLAY 'VALUE OF BIN1=' BIN1. DISPLAY 'VALUE OF AIN1=' AIN1. COMPUTE AIN1 = BIN1 - AIN1. DISPLAY 'VALUE OF AIN1=' AIN1. When i'm executing this code i'm getting SOC7 for A = 12 & B=34. Can someone explain SDSF OUTPUT DISPLAY TCOM058R JOB05458 DSID 102 LINE 0 COLUMNS 02- 81 COMMAND INPUT ===> SCROLL ===> CSR ********************************* TOP OF DATA ********************************** VALUE OF A=12 VALUE OF B=34 VALUE OF BIN1=34 VALUE OF AIN1=12 CEE3207S The system detected a data exception (System Completion Code=0C7). From compile unit PROG1 at entry point PROG1 at statement 29 at compile +000004CE at address 00007ECE. Please address how to solve this issue Thanks in advance.

1 Answers  


What do you understand by psb and acb?

0 Answers  


In COBOL "BEFORE" advancing is there or not ?

3 Answers  


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

0 Answers   HCL,


COBOL Snippet: Tell where the control will when the below code execute IF (A=B) CONTINUE ELSE NEXT SENTENCE PERFORM <IMP-STMT> END-IF.

7 Answers   HCL,


Categories