Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What's the answer for the following initializing program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
crm

New User


Joined: 14 Nov 2005
Posts: 25

PostPosted: Mon Nov 21, 2005 1:21 pm    Post subject: What's the answer for the following initializing program
Reply with quote

HAI
LET ME KNOW ANSWER FOR THIS SMALL PROGRAM:

01 A
02 B PIC A(2)
02 C PIC X(2)
02 D PIC 9V9
02 E PIC X/X
02 F PIC $9.99
02 G PIC X(2)

01 M PIC 9V9 VALUE IS '1.2'
01 N PIC X(2) VALUE IS '12'
INITIALIZE A.
Back to top
View user's profile Send private message

iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Mon Nov 21, 2005 3:00 pm    Post subject: Re: What's the answer for the following initializing program
Reply with quote

Hi crm,

To your question I found out that using cobol-85 it doesn't recognise "INITIALIZE A". So i used "MOVE spaces to A". The output being generated is spaces.

If anyone comes with a solutuion, please add on.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Nov 21, 2005 4:55 pm    Post subject: initialize
Reply with quote

hi frnd,
INITIALIZE is functionally equal to one or more MOVE statements. in ur case
>>>SPACES will be moved to the B,C,E,G and
>>>ZERO for D,F

i think so. let me know if any other solutions..
Back to top
View user's profile Send private message
sungang77

New User


Joined: 03 Nov 2005
Posts: 46
Location: Shanghai, China

PostPosted: Tue Nov 22, 2005 7:48 am    Post subject: Re: initialize
Reply with quote

khamarutheen wrote:
hi frnd,
INITIALIZE is functionally equal to one or more MOVE statements. in ur case
>>>SPACES will be moved to the B,C,E,G and
>>>ZERO for D,F

i think so. let me know if any other solutions..


Hi khamarutheen,
I agree with you in B, C, D, E, G. But I'm wondering whether the INITIALIZE to F--a formatted numeric data, it will be spaces or zeros, I'm not sure...
Back to top
View user's profile Send private message
sungang77

New User


Joined: 03 Nov 2005
Posts: 46
Location: Shanghai, China

PostPosted: Tue Nov 22, 2005 7:53 am    Post subject:
Reply with quote

Hi khamarutheen,
You are right. The F will be ZEORS after INITIALIZE.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Tue Nov 22, 2005 10:27 am    Post subject: INITIALIZE
Reply with quote

hi frnd,
In general the INITIALIZE statement sets selected categories of data fields to predetermined values. so
For alphabetic,alphanumeric,alphanumeric-edited items it moves SPACE
For numeric and numeric-edited items it moves ZERO

Remember this words.. then u will not get any confusions.
Back to top
View user's profile Send private message
sungang77

New User


Joined: 03 Nov 2005
Posts: 46
Location: Shanghai, China

PostPosted: Tue Nov 22, 2005 11:35 am    Post subject: Re: INITIALIZE
Reply with quote

khamarutheen wrote:
hi frnd,
In general the INITIALIZE statement sets selected categories of data fields to predetermined values. so
For alphabetic,alphanumeric,alphanumeric-edited items it moves SPACE
For numeric and numeric-edited items it moves ZERO

Remember this words.. then u will not get any confusions.


Get it.
Thank you very much, khamarutheen.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us