View previous topic :: View next topic
|
Author |
Message |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Initialize uses the first definition of an item if the the item is redefined. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
dr_te_z
New User
Joined: 08 Jun 2007 Posts: 71 Location: Zoetermeer, the Netherlands
|
|
|
|
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 |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
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 |
|
|
|