View previous topic :: View next topic
|
Author |
Message |
sanil m
New User
Joined: 24 Aug 2007 Posts: 38 Location: chennai
|
|
|
|
Hi,
I would like to know is there any difference between
MOVE SPACES TO WS-VAR-A
MOVE ALL SPACES TO WS-VAR-A
When exactly is MOVE ALL SPACES used? |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
No. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
When exactly is MOVE ALL SPACES used? |
We will never need to use it. Let me explain with small example.
Suppose
Code: |
01 WS-VAR-A PIC X(10).
Move '*' to WS-VAR-A
Now the contents of WS-VAR-A will be '* ' |
That means for an alphanumeric move, if length of source operand lesser than the destination operand, spaces will be appended.
Hope it is clear now. |
|
Back to top |
|
|
sanil m
New User
Joined: 24 Aug 2007 Posts: 38 Location: chennai
|
|
|
|
thanx for clearing my doubt.... |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
The MOVE ALL statement comes in handy when you need to populate a variable (IE: WS-VAR-A) with something other than a figurative constant, for example all '9's.
Code: |
MOVE ALL '9' TO WS-VAR-A.
|
The compiler will calculate the field-length, regardless of its size and pad the entire field with '9'.
Note that MOVE SPACES, MOVE ZEROS, MOVE LOW-VALUES and MOVE HIGH-VALUES don't require the ALL clause and will fully populate a target-field with the proper figurative constant value.
HTH....
Regards,
Bill |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
MOVE ALL SPACES never be used. Even if you want to move ALL spaces, just use MOVE SPACES.
KSK |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
The compiler will calculate the field-length, regardless of its size and pad the entire field with '9'. |
Nice imagination but NO. For "move all" compiler will generate an MVC instruction with overlapping operands wherever possible. It is unnecessary to calculate length. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
agkshirsagar wrote: |
Quote: |
The compiler will calculate the field-length, regardless of its size and pad the entire field with '9'. |
Nice imagination but NO. For "move all" compiler will generate an MVC instruction with overlapping operands wherever possible. It is unnecessary to calculate length. |
Well actually, an MVI is issued against the first byte, followed by the normal MVC propagation technique of the remainder.
However, if the variable exceeds a certain length (could be the 256-max of the MVC but, I'm not too sure of the cutoff point), the compiler will generate an MVCL.
Nice try....
Bill |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Well.. agreed to all that you said I agree that I misjudged you.
My point was length will not be calculated in case of MOVE ALL.
Compiler will use implicit length of destination field as it knows the length of variable from our declaration.
Code: |
WS-VAR-A DS CL10
MVI WS-VAR-A,C'9'
MVC WS-VAR-A+1(9),WS-VAR-A |
I am a newbie in ASSEMBLER but do let me know if I wrote it right. I don't have access to mainframe these days, otherwise I would have checked my code by writing a small COBOL prog and producing assembler listing. |
|
Back to top |
|
|
|