Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Compiling program in endeavor for tra... RALAKKAL Compuware & Other Tools 4 Mon Jun 05, 2017 8:27 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us