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

How to change date format from mm/dd/yyyy to mmddyyyy


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nitin Bhargava

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Wed Oct 17, 2012 1:30 pm
Reply with quote

Hi,

I am having an input file in which date is in format mm/dd/yyyy. I need to change it in mmddyyyy format using sort or icetool.

Input file looks like
Code:
1/1/1965
11/11/1965
12/1/1970
10/21/2001

The output i am expecting is
Code:
01011965
11111965
12011970
10212001

File is a FB with lenght 80
I am thinking to use change command in it, but it seems to be more lenghty. Do we have any direct approach for it in sort.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 17, 2012 2:00 pm
Reply with quote

the PARSE clause will provide the way

You have already received at least one reply with a PARSE example
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Oct 17, 2012 2:04 pm
Reply with quote

What do you have after YYYY?

Is it space or anything else?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Oct 17, 2012 9:47 pm
Reply with quote

Nitin Bhargava,

Use the following DFSORT JCL which will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
1/1/1965                                                 
11/11/1965                                               
12/1/1970                                                 
10/21/2001                                               
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  OPTION COPY                                             
  INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=2),               
               %02=(ENDBEFR=C'/',FIXLEN=2),               
               %03=(FIXLEN=4)),                           
  BUILD=(%01,UFF,EDIT=(TT),%02,UFF,EDIT=(TT),%03,2X,11,70)
//*
Back to top
View user's profile Send private message
Nitin Bhargava

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Mon Oct 22, 2012 6:32 pm
Reply with quote

Thanks Skolusu,

Just needed one more suggestion.
Orignally as per my requirement the date starts from 70th position. From 1 to 69 there are some other fields and after date field some other fields are present. Total file size is 1000.

Example

Code:
001 ROHIT SINGHAI 1/1/1962   NEWYORK
002 NITESH JHA       21/1/2003 INDIA


I modified the sort card suggested by you as follows:
Quote:
INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=2),
%02=(ENDBEFR=C'/',FIXLEN=2),
%03=(FIXLEN=4)),
BUILD=(1,69,70,%01,UFF,EDIT=(TT),%02,UFF,EDIT=(TT),
%03,79,800)


The problem here is that i am getting output date record
Quote:
001 ROHIT SINGHAI 00011962 NEWYORK
002 NITESH JHA 00012003 INDIA

How to remove this zero from output.

[/quote]
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Oct 22, 2012 7:31 pm
Reply with quote

Nitin Bhargava wrote:
Example

Code:
001 ROHIT SINGHAI 1/1/1962   NEWYORK
002 NITESH JHA       21/1/2003 INDIA

So when you said
Quote:
I am having an input file in which date is in format mm/dd/yyyy.

you were lying icon_mad.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Oct 22, 2012 11:22 pm
Reply with quote

Nitin Bhargava,

You are provided with a solution that specifically caters to what you described in your first post, and now you show a completely different input and you hope that it works? Please outline your complete requirement instead of giving me bits and pieces of information. I can't keep on working on your problems every time you change the input/rules.

And for the record with your new input it is reading the first 2 bytes of the sequence number in your input for the month. Search for ABSPOS in the DFSORT application programming guide and see how you can implement it into your control cards.
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 -> DFSORT/ICETOOL

 


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