Hi,
In a file I have a date in the format (ccyymmdd) and I need to create another file using this which in the format YYYYMon. Where "mon" is three letter representation of Month in words.
For example: if Input file has: 20130820the output should be 2013AUG. How do I do it? Please help.
Change the date display format.
-
- Global Moderator
- Posts: 588
- Joined: Wed Nov 20, 2013 11:53 am
- Location: Mars
Re: Change the date display format.
Move the DATE to a structure like below
You could use EVALUATE to acheive the following
Code: Select all
01 WS-DATE.
05 WS-YEAR PIC X(04).
05 WS-MON PIC X(02).
05 WS-DAY PIC X(02).
01 WS-DATE2.
05 WS-YEAR2 PIC X(04).
05 WS-MON2 PIC X(03).
You could use EVALUATE to acheive the following
Code: Select all
EVALUATE WS-MON
WHEN "01"
MOVE WS-YEAR TO WS-YEAR2
MOVE 'JAN' TO WS-MON2
WHEN "02"
MOVE WS-YEAR TO WS-YEAR2
MOVE 'FEB' TO WS-MON2
..
WHEN "12"
MOVE WS-YEAR TO WS-YEAR2
MOVE 'DEC' TO WS-MON2
WHEN OTHER
PERFORM ERROR
END-EVALUATE
zprogrammer
Re: Change the date display format.
Thanks Pandora-Box, this helps and I get the code written that way. I'm testing it and let you how I progress.
Re: Change the date display format.
Hi Enrico,
Thanks for the pointer - this is a new project for the team and no one was aware of such a routine. Though now we came to know about a in house date-routine and I think I've two solution for this problem now...
This is a great help. Thanks for your time.
Thanks for the pointer - this is a new project for the team and no one was aware of such a routine. Though now we came to know about a in house date-routine and I think I've two solution for this problem now...

This is a great help. Thanks for your time.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute