convert date using SORT



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

convert date using SORT

Postby ranga_subham » Wed Oct 31, 2012 9:04 am

Hi,

I have a file (LRECL=80, RECFM=FB) with some data as shown below:

----+----1----+----2----+----3
BOLTEN 20101204
TANGRA 20110217
MANTRI 20090927


Expected Output:
BOLTEN 2010-12-04
TANGRA 2011-02-17
MANTRI 2009-09-27


I would like to know how to convert the date appearing in CCYYMMDD format to CCYY-MM-DD format (with hyphens in between values). Please help.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: convert date using SORT

 

Re: convert date using SORT

Postby Pandora-Box » Wed Oct 31, 2012 11:31 am

Hi,

You can use the below code

SORT FIELDS=COPY
OUTREC FIELDS=(1:1,7,8:8,4,12:C'-',13:12,2,15:'-',16:14,2)
User avatar
Pandora-Box
 
Posts: 65
Joined: Fri Feb 10, 2012 8:30 pm
Location: Mars
Has thanked: 3 times
Been thanked: 6 times

Re: convert date using SORT

Postby ranga_subham » Wed Oct 31, 2012 3:51 pm

Thanks for the idea........

May I know how to change YYMMDD to YYYY-MM-DD format please?
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: convert date using SORT

Postby dick scherrer » Wed Oct 31, 2012 7:57 pm

Hello,

You first need to determine the rule for which dates are 19xx and which are 20xx.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: convert date using SORT

Postby ranga_subham » Thu Nov 01, 2012 6:09 pm

hi, all are 20xx only....no 19xx !

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: convert date using SORT

Postby NicC » Thu Nov 01, 2012 6:19 pm

Well then, just include '20' i the items to build from
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: convert date using SORT

Postby ranga_subham » Sun Nov 04, 2012 8:29 am

finally got it by using Y2S in OUTREC :D
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: convert date using SORT

Postby dick scherrer » Sun Nov 04, 2012 8:39 am

Hello,

That is cool - good job looking as so many do not :)

Just curious why you did not try the suggestion from Nic? Might have been running a couple of days ago.

It really is good that you persisted and found what you were looking for in the manual! We highly encurage this. ;)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post