Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
COBOL query: move space to 9(2)
Goto page Previous  1, 2
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Mar 15, 2008 7:55 am    Post subject:
Reply with quote

Initialize uses the first definition of an item if the the item is redefined.
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Sun Mar 16, 2008 3:54 am    Post subject: Reply to: COBOL query: move space to 9(2)
Reply with quote

Craq,

Interesting, Will have to check whether my group variable is redefined and whether the first defnition is alphanumeric.

Anuj,

The definition in my first post is just an example and not actually how my copybook looks.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6254
Location: Mumbai, India

PostPosted: Sun Mar 16, 2008 4:46 am    Post subject:
Reply with quote

Hi,

Yes
Quote:
Initialize uses the first definition of an item if the the item is redefined.
once a memory is "masked" with some definition, we can 'resue' it with that definition only. You re-define the variables not the memory.
Back to top
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Mon Mar 17, 2008 7:03 pm    Post subject:
Reply with quote

INITIALIZE ignores FILLER's. So to be sure I code both:
Code:

MOVE SPACE TO FOO-GR                               
INITIALIZE    FOO-GR  REPLACING NUMERIC DATA BY ZERO
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 215
Location: India

PostPosted: Tue Mar 18, 2008 6:11 pm    Post subject: Re: Reply to: COBOL query: move space to 9(2)
Reply with quote

Aaru wrote:
Hi,

Quote:
Hi, can anyone tell what should be the supposed result if you move spaces into a numeric field.

I tried that and got zeroes in the numeric field.


Techies,

I have a doubt here. As per all your explanations we would have zeroes if we move SPACES to numeric field. But consider this scenario,

01 Group Variable
05 Elementary item 1 PIC 9(1)
05 Elementary item 2 PIC 9(1)
05 Elementary item 3 PIC 9(1)

As far as i know, group variables are always alphanumeric and hence if you initialize this Group variable we would have spaces in the 3 elementary items and not zeroes.

So is there any way to move zeroes to these elementary items other than moving zeroes to this gp variable?


Code:


Aaru i tried this and i think it may help u.

01 WS-VARIABLE.
   05 WS-ITEM1 PIC 9(1).
   05 WS-ITEM2 PIC 9(1).
   05 WS-ITEM3 PIC 9(1).

INITIALIZE WS-VARIABLE.
   DISPLAY 'WS-VARIABLE :' WS-VARIABLE.
   DISPLAY 'WS-ITEM1    :' WS-ITEM1.
   DISPLAY 'WS-ITEM2    :' WS-ITEM2.
   DISPLAY 'WS-ITEM3    :' WS-ITEM3.

Here is the SYSOUT i got.

WS-VARIABLE :000
WS-ITEM1    :0
WS-ITEM2    :0
WS-ITEM3    :0


Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Query on JCL abdulrafi DFSORT/ICETOOL 5 Wed Oct 16, 2019 7:02 pm
No new posts How to handle NULL in COBOL program bhaskar_kanteti COBOL Programming 8 Mon Oct 07, 2019 3:54 pm
This topic is locked: you cannot edit posts or make replies. COBOL/CICS with real time MQ Series u... BPranav CICS 2 Mon Sep 16, 2019 9:19 pm
This topic is locked: you cannot edit posts or make replies. Compare two files logic in COBOL Nishant Singhal COBOL Programming 4 Sun Aug 25, 2019 2:25 am
No new posts DB2 Query runs very long John F Dutcher DB2 21 Wed Aug 21, 2019 11:44 pm

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