ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  MainFrame  >>  IBM MainFrame  >>  COBOL
 
 


 

 
 COBOL interview questions  COBOL Interview Questions
 JCL interview questions  JCL Interview Questions
 CICS interview questions  CICS Interview Questions
 DB2 interview questions  DB2 Interview Questions
 IMS interview questions  IMS Interview Questions
 IDMS interview questions  IDMS Interview Questions
 Natural interview questions  Natural Interview Questions
 ADABAS interview questions  ADABAS Interview Questions
 REXX interview questions  REXX Interview Questions
 Assembler interview questions  Assembler Interview Questions
 CLIST interview questions  CLIST Interview Questions
 QMF interview questions  QMF Interview Questions
 MVS interview questions  MVS Interview Questions
 OS390 interview questions  OS390 Interview Questions
 OS 2 interview questions  OS 2 Interview Questions
 VSAM interview questions  VSAM Interview Questions
 QSAM interview questions  QSAM Interview Questions
 Sysplex interview questions  Sysplex Interview Questions
 IBM MainFrame AllOther interview questions  IBM MainFrame AllOther Interview Questions
Question
What will happen if a variable is declared as below.. 
Explain with an example?

Working storage section:-
01 WS-VARX                    PIC X(9)   VALUE SPACES. 
01 WS-VARN  REDEFINES WS-VARX PIC 9(9).
 Question Submitted By :: Prasanna
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
Answer
# 1
Working storage section:-
01 WS-VARX                    PIC X(9)   VALUE SPACES. 
01 WS-VARN  REDEFINES WS-VARX PIC 9(9).

REDEFINES: It is used to save the memory space....

ur declearing like that ws-varn will take the same memory 
of ws-varx...

when u used display statement
  DISPLAY WS-VARN
it shows the spaces... WS-VARN will take same memory of WS-
VARX irrespective of data type....
 
Is This Answer Correct ?    2 Yes 0 No
Lalith
 
  Re: What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
Answer
# 2
Wont it show SOC or ASRA because of the data exception... 
(non numeric in a numeric field) ??
 
Is This Answer Correct ?    2 Yes 0 No
Prasanna
 
 
 
  Re: What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
Answer
# 3
if you perform any arithmetic operation than comes the 
question of any abend
 
Is This Answer Correct ?    2 Yes 0 No
Rookie
 
  Re: What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
Answer
# 4
It wont show any Abend, the main purpose of REDEFINES 
clause is to use the same storage area with one or more 
data item with different sizes and PIC 's. We will face 
Abend if we try to MOVE WS-VARN TO WS-VAR.
 
Is This Answer Correct ?    2 Yes 0 No
Ezhilenthi
 
  Re: What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
Answer
# 5
I am agreed with Rookie. It will abend if any mathematical 
operation like add, subtract will be performed with 
variable WS-VARX, but if any mathematical operation is 
performed using WS-VARN then it will not abend because it 
is numeric in nature.
 
Is This Answer Correct ?    1 Yes 0 No
Lalit
 
  Re: What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
Answer
# 6
after redefining we can also move alphabetic to numeric or
numeric to alphabetic field . mathematical operation is 
different . if we go for that it will give s0c7.
 
Is This Answer Correct ?    1 Yes 0 No
Ankur
 
  Re: What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
Answer
# 7
WORKING-STORAGE SECTION.                  
01 WS-VARX PIC X(9) VALUE SPACE.        
01 WS-VARN REDEFINES WS-VARX PIC 9(9).  
01 I PIC 9(2).                          
01 J PIC 9(2).                          
PROCEDURE DIVISION.                     
MAIN-SECTION.                           
MAIN-PARA.                              
     MOVE 123456789 TO WS-VARN.         
     DISPLAY WS-VARN.                   
     STOP RUN.                          

ON RUN TIME. 123456789
O/P : 123456789
 
Is This Answer Correct ?    1 Yes 0 No
Neelam Saini
 

 
 
 
Other COBOL Interview Questions
 
  Question Asked @ Answers
 
How may divisions are there in JCL-COBOL? IBM2
How to resolve the soc4 and soc7 errors? US-Technology1
study the following 01 A PIC 99V0 VALUE 5 01 B PIC 9V9 VALUE 6 01 C PIC 99V9 VALUE 2.5 01 D PIC 99 VALUE 3 COMPUTE A ROUNDED B C = A+B*C/D ON SIZE ERROR PERFORM PRINT-ERROR the comments of A.B.C after execution of the above statement are a.A=10 B=0 C=10 b.A=10 B=9.9 C=9.9 c.A=10 B=0 C=9.9 d.A=10 B=6 C=10 TCS1
what are the control characters used in reports  1
What is the difference between CONTINUE & NEXT SENTENCE ?  1
In a COBOL II PERFORM statement, when is the conditional tested, before or after the perform execution?  3
When search all is used in cobol program without sorted input data? Principal-Finance4
What is IMPACT analysis? IBM1
What is the difference between static call & Dynamic call?  1
How do we get current date from system with century?  2
What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).  7
I have the file which is having the extension no as records. sample file will look like below. 2310 3410 3256 4350 3781 5408 I need to replace the record which is starting with 3 to 5 (i.e) 3410 to 5410. How can we do it through cobol and cobol-db2 program? I need the possible logic? RBS2
What is normalisation? IBM1
Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example.  6
COMP field occupy ?  2
What is the difference between PIC 9.99 and 9v99?  4
how will u find out 3rd week's 2nd day using occurs ? L&T3
88 level entry is used for (a) data items in WORKING-STORAGE SECTION (b) items with RENAMES clause (c) condition-names (d) None of the above TCS2
What is a subscript ?  2
How can you pass values from COBOL program to non-COBOL programs?  2
 
For more COBOL Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com