IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What's the answer for the following initializing program


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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: 411
Location: Colarado, US

PostPosted: Mon Nov 21, 2005 3:00 pm
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: 677
Location: NJ

PostPosted: Mon Nov 21, 2005 4:55 pm
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
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
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: 677
Location: NJ

PostPosted: Tue Nov 22, 2005 10:27 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top