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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to change date format from mm/dd/yyyy to mmddyyyy
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Oct 17, 2012 2:00 pm    Post subject: Reply to: How to change date format from mm/dd/yyyy to mmddy
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

Moderator


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

PostPosted: Wed Oct 17, 2012 2:04 pm    Post subject:
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    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Mon Oct 22, 2012 7:31 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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