Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Moving Alphanumeric Date to A Numeric Variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Amit Suri

New User


Joined: 28 Oct 2008
Posts: 25
Location: hyderabad

PostPosted: Tue Jun 02, 2009 12:50 am    Post subject: Moving Alphanumeric Date to A Numeric Variable
Reply with quote

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
View user's profile Send private message

mtaylor

Active User


Joined: 20 Feb 2009
Posts: 108
Location: Kansas City

PostPosted: Tue Jun 02, 2009 12:57 am    Post subject:
Reply with quote

Research the REDEFINES clause:


click
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Jun 02, 2009 12:58 am    Post subject:
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Jun 02, 2009 1:44 am    Post subject: Reply to: Moving Alphanumeric Date to A Numeric Variable
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Jun 02, 2009 1:54 am    Post subject:
Reply with quote

MOVE CORRESPONDING should work just fine if you use the redefines that mtaylor suggested.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us