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

Simple date conversion using Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
PPeplinski

New User


Joined: 06 Jan 2006
Posts: 8

PostPosted: Fri Jul 13, 2012 11:51 pm
Reply with quote

I do very little in Syncsort. I have read the manual, specifically the 1.4 OUTREC parameter. Still. I am not sure what/how to code it. The actual project has nothing to do with Syncsort and I could use other utilities or programs to do the conversion.

Simply stated I am comparing two files where date is one of my keys. One file has the date in column 65 in MM/DD/YYYY format and the other has the date in column 35 in YYYYDDD format. Both files have LRECL 133.

I can convert either but the YYYYDDD works best for sequencing the file.

Paul
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Sat Jul 14, 2012 12:17 am
Reply with quote

Paul,

Please state your problem

What are you trying to achieve?
What is your input data? Please share us some same simulated data
what is the output you are expecting?

Also please make use of code tag while pasting input and expected output
Back to top
View user's profile Send private message
PPeplinski

New User


Joined: 06 Jan 2006
Posts: 8

PostPosted: Sat Jul 14, 2012 12:26 am
Reply with quote

One of my files has date in position 65 in MM/DD/YYYY format, for example 09/30/2011. I want to use Syncsort to alter that in place to 2011273 using the date conversion formats. It seems that I might first have to strip out the separators.

Paul
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Sat Jul 14, 2012 12:56 am
Reply with quote

Check here for sample idea
Back to top
View user's profile Send private message
PPeplinski

New User


Joined: 06 Jan 2006
Posts: 8

PostPosted: Sat Jul 14, 2012 1:29 am
Reply with quote

Thank you. I had hoped the date conversion formats would make the solution less programmatic.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jul 14, 2012 3:51 am
Reply with quote

I think the topic posted is a little old. Have a look in your manual. You may find there are lots of date functions, some of which you can use. It'll still be "programatic" to some extent, but that kind of comes with the territory.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jul 14, 2012 9:06 am
Reply with quote

Hello,

If you have the 1.4 documentation, you might search it for "date conversion" or "date formats" or similar. I won't be near the system that has my 1.4 doc until Monday and so far have not been able to get a vpn connection authorized. . .
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Jul 14, 2012 12:06 pm
Reply with quote

PPeplinski,

AFAIK Syncsort 1.4 supports a few new date manipulation functions. I am away from work now, will update here if I find something useful.

Hi Dick,

Are you @ Syncsort 1.4 level? I am still @ 1.3.2 icon_sad.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jul 14, 2012 11:07 pm
Reply with quote

Hi Arun,

One Syncsort client just went from 1.1 (yup, that is NOT a typo - years behind) directly to 1.4. They also upgraded 1.1 from z/OS 7 to 9 to 11 (against the advice of Syncsort - i had hoped the old release would not run and would have to be upgraded<g>).

Seems like some department "critically" needed some of the new 1.4 features. . . I just use what is on the machine and try to make the case to keep the software reasonably current icon_cool.gif

d
Back to top
View user's profile Send private message
PPeplinski

New User


Joined: 06 Jan 2006
Posts: 8

PostPosted: Mon Jul 16, 2012 9:25 pm
Reply with quote

Yes, I saw the datye conversion "functions" although the syntax is pretty cryptic. I think the separators in the input field make it less straight forward, even though there is support for separators in the output field.

Paul
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jul 16, 2012 11:08 pm
Reply with quote

PPeplinski,

I guess you have already figured out the YD and YDNS subparameters. But I thought the syntax is pretty straightforward. For your particular requirement, I believe the Y2T or Y2W input date format along with YD or YDNS subparameter would do the trick.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jul 16, 2012 11:20 pm
Reply with quote

If input date is of the form yymmdd and starting at pos-1,
Code:
  OUTREC FIELDS=(1,6,Y2T,YD=(4D/))
to obtain the julian output in YYYY/DDD format.

If input date is of the form mmddyy and starting at pos-1,
Code:
  OUTREC FIELDS=(1,6,Y2W,YD=(4D/))
to obtain the julian output in YYYY/DDD format.

Instead of 4, Y could be used to obtain 2 digit years in output, Y 4 and D can be specified only once and in any order that you need. I am running an older version and can't test this out now icon_sad.gif
Back to top
View user's profile Send private message
PPeplinski

New User


Joined: 06 Jan 2006
Posts: 8

PostPosted: Tue Jul 17, 2012 12:44 am
Reply with quote

That was the type of solution that I was looking for, as opposed to the one that uses addition based on the year (to address leap year), the month, and then finally the day.

Unfortunately, by date is in position 65 with the format MM/DD/YYYY, which does not seem to be represented in a Syncsort format.

Paul
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 17, 2012 2:04 am
Reply with quote

Fortunately it is the work of only a moment to rearrange it, "outside" the existing data on the record (front for variable records, end for fixed) and then us that date...
Back to top
View user's profile Send private message
PPeplinski

New User


Joined: 06 Jan 2006
Posts: 8

PostPosted: Tue Jul 17, 2012 2:21 am
Reply with quote

I trust that is true, and probably second nature to someone well versed in SORT. For me it was just a means to an end, and I have encountered other unanticipated data massaging requirements so it makes more sense for to do it all in an EZT or REXX.

Thank you

Paul
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jul 17, 2012 8:32 am
Reply with quote

Hello,

Depending on the volume of data, you may find REXX performance completely unacceptable. . .

Yup, if there area business rules to be implemented, a programming language is better suited. JustMHO.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
Search our Forums:

Back to Top