GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Mainframe  >  COBOL
Go To First  |  Previous Question  |  Next Question 
 COBOL  |  Question 16 of 159    Print  
What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default?
INITIALIZE moves spaces to alphabetic fields and zeros to alphanumeric fields. The REPLACING option can be used to override these defaults.


  
Total Answers and Comments: 5 Last Update: March 06, 2008   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: nnieland
 
If you use the INITIALIZE verb on a field that has a VALUE clause...does that field get initialized to that value?

Above answer was rated as good by the following members:
Shrabana Ghosh
October 04, 2006 16:54:05   #1  
mohan        

RE: What is the default value(s) for an INITIALIZE and...
Initialize sets zero for numerics and spaces for alphabetic.
 
Is this answer useful? Yes | No
December 02, 2007 09:11:27   #2  
nnieland Member Since: December 2007   Contribution: 1    

RE: What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default?
If you use the INITIALIZE verb on a field that has a VALUE clause...does that field get initialized to that value?
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
February 14, 2008 02:24:31   #3  
dpg_25 Member Since: February 2008   Contribution: 2    

RE: What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default?
INITIALIZE verb will initialize 01 level variables to their definitions. For e.g
01  VAR-A      PIC X(2).
01  VAR-B      PIC 9(2).
01  VAR-C.
      05 VAR-D PIC X(2).
      05 VAR-E PIC 9(2).

If VAR-A VAR-B and VAR-C are initialized.
VAR-A will be spaces. VAR-B will be Zeroes. VAR-C will be spaces. So there will be spaces in VAR-D and VAR-E.
If you want VAR-D to be spaces and VAR-E to be Zeroes you must write
Initialize VAR-C REPLACING ALL NUMERIC BY ZEROES.

Please correct me if I am wrong.

 
Is this answer useful? Yes | No
February 20, 2008 01:30:32   #4  
santhukumar Member Since: February 2008   Contribution: 1    

RE: What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default?
Spaces for Alphanumeric and Zeroes for numeric fields.
 
Is this answer useful? Yes | No
March 05, 2008 13:19:30   #5  
vivek_166008 Member Since: March 2008   Contribution: 1    

RE: What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default?

I think even for the follwing type
 01 Var-C.
       05 Var-d   PIC 9.

       05 Var-e   PIC X.
When we initialize the Var-C it will automatically move Zero to Var-d and Space to Var-e.
The REPLACING key word is helpful in updating these variables with characters other than zero and spaces. for example if we want to move * to Var-e the command will be INITIALIZE Var-e REPLACING ALPHANUMERIC BY '*'.
 

Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape