View previous topic :: View next topic
|
Author |
Message |
Amit Suri
New User
Joined: 28 Oct 2008 Posts: 25 Location: hyderabad
|
|
|
|
Hi All
I have an input alphanumeric value field of PIC X(10). eg 9999-12-31
The receiving variable in the code is a Numeric one with PIC 9(8)
Can anyone please suggest me the appropriate code that can be written in
VS-COBOL II to achieve this , i have tried moving with "Corresponding"
Clause and that resulted in S0C-7
The movement of the fields should result in 99991231 |
|
Back to top |
|
|
mtaylor
Active User
Joined: 20 Feb 2009 Posts: 108 Location: Kansas City
|
|
|
|
Research the REDEFINES clause:
click |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
What is the exact definition of the fields involved and the exact code you wrote? Please cut and paste, don't key it. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Yes, you suggested reference modification so why can't this be used? Is your version of COBOL at a minimum of VS/COBOL II? There wasn't any reference modification as part of OS/VS COBOL.
Code: |
03 WS-EDITED-DATE PIC X(10) VALUE '9999-12-31'.
03 WS-NUMERIC-DATE PIC 9(08).
MOVE WS-EDITED-DATE (1:) TO WS-NUMERIC-DATE (1:4).
MOVE WS-EDITED-DATE (6:) TO WS-NUMERIC-DATE (5:2).
MOVE WS-EDITED-DATE (9:) TO WS-NUMERIC-DATE (7:).
|
|
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
MOVE CORRESPONDING should work just fine if you use the redefines that mtaylor suggested. |
|
Back to top |
|
|
|