IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How do i change a date format to dd/mm/yyyy


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinit

New User


Joined: 31 Jul 2006
Posts: 8
Location: TCS, INDIA

PostPosted: Thu Jan 11, 2007 5:09 pm
Reply with quote

how do i change a date format written in yyyymmdd (length 8) to dd/mm/yyyy(length 10) icon_sad.gif icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 11, 2007 5:16 pm
Reply with quote

Redefine and moves, reference modification, stringing, what are you looking for, examples?
Back to top
View user's profile Send private message
vinit

New User


Joined: 31 Jul 2006
Posts: 8
Location: TCS, INDIA

PostPosted: Thu Jan 11, 2007 5:56 pm
Reply with quote

i want to change the date format using the MOVE statement from one format yyyymmdd (length 8) to another format dd/mm/yyyy(length 10)
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Thu Jan 11, 2007 5:58 pm
Reply with quote

Code:
01 date.
02 yy pic 9(4).
02 mm pic 99.
02 dd pic 99.
01 date1.
02 f-dd pic 99.
02 filler pic x value "/".
02 f-mm pic 99.
02 filler pic x value "/".
02 f-yy pic 9(4).

move yy to f-yy.
move mm to f-mm.
move dd to f-dd.
display date1.


Aji Cherian
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 11, 2007 6:51 pm
Reply with quote

vinit wrote:
i want to change the date format using the MOVE statement from one format yyyymmdd (length 8) to another format dd/mm/yyyy(length 10)
OK
Code:
move cymd(7:2) to dmcy(1:2)
move '/'       to dmcy(3:1)
move cymd(5:2) to dmcy(4:2)
move '/'       to dmcy(6:1)
move cymd(1:4) to dmcy(7:4)
That should do it.... icon_smile.gif
Back to top
View user's profile Send private message
David P

Active User


Joined: 11 Apr 2005
Posts: 106
Location: Cincinnati Ohio

PostPosted: Thu Jan 11, 2007 10:07 pm
Reply with quote

One more way of doing what you want is using the MOVE CORRESPONDING clause of cobol if you are familiar with it.

David.
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Fri Jan 12, 2007 2:57 pm
Reply with quote

Hi,

Quote:
One more way of doing what you want is using the MOVE CORRESPONDING clause of cobol if you are familiar with it.
David.


To add more for what David told, for MOVE CORRESPONDING the subgroup variable names must be same.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top