View previous topic :: View next topic
|
Author |
Message |
rahulvv
New User
Joined: 05 Apr 2006 Posts: 3 Location: Mumbai, India
|
|
|
|
Hi,
Could someone help me with the difference in the statements 1 and 2:
1. MOVE EDITED operand1 TO operand2 (EM=value)
2. MOVE EDITED operand1 (EM=value) TO operand2
Please avoid giving the programming guide definition as I have gone thru them.
My usual code would look like:
Code: |
DEFINE DATA
LOCAL
01 #DAT (A8)
01 #DATE (D)
END-DEFINE
*
#DAT := '10122009'
MOVE EDITED #DAT TO #DATE (EM=MMDDYYYY)
WRITE #DATE
END
|
And this would work fine.
But if I code
Code: |
MOVE EDITED #DAT (EM=MMDDYYYY) TO #DATE |
this would not even stow.
Could anybody please explain to me the reason?
How exactly does the EM work?
Thanks,
Rahul |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Sorry, I really tried to phrase my own answer, but then I looked at the manual (Statements --> MOVE) and noticed that Software-AG phrased it in a better way.
O. |
|
Back to top |
|
|
atulbagewadikar
New User
Joined: 15 Jun 2006 Posts: 26
|
|
|
|
Hi Rahul,
Why don't you try this way? See the changes and try to find how it works now?
I believe you will find out your answer after this.
Code: |
DEFINE DATA LOCAL
1 #DAT (N8)
1 REDEFINE #DAT
2 #DAT-A (A8)
1 #DAT-A-10 (A10)
1 #DATE (D)
END-DEFINE
#DAT := 20090729
*
MOVE EDITED #DAT-A TO #DATE (EM=YYYYMMDD)
*
MOVE EDITED #DATE (EM=YYYY/MM/DD) TO #DAT-A-10
*
WRITE '=' #DAT-A-10 '=' #DATE
END |
Output
Code: |
MORE
Page 1 09-10-14 18:32:33
#DAT-A-10: 2009/07/29 #DATE: 09-07-29 |
|
|
Back to top |
|
|
Steve Robinson
New User
Joined: 14 Nov 2009 Posts: 12 Location: U.S.
|
|
|
|
Could someone help me with the difference in the statements 1 and 2:
1. MOVE EDITED operand1 TO operand2 (EM=value)
2. MOVE EDITED operand1 (EM=value) TO operand2
Statement 2 takes operand1 and applies the specified edit mask to create operand2.
Statement 1 is actually a "de edit" operation. It takes operand1 and removes the editing characters specified in the edit mask to create operand2. Careful. If the editing characters do not exist in operand1 you will get an error message.
steve |
|
Back to top |
|
|
|