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

SYNCSORT Adding date in Sort step


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

New User


Joined: 18 Jun 2008
Posts: 9
Location: chennai

PostPosted: Thu Dec 04, 2008 11:42 am
Reply with quote

Hi,

I wanted to add one offset value to a date parameter in a sort step.
Is it possible to use something like (&DATE,ADD,1...) in OUTREC ?

Could someone help me out with the correct syntax

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

Moderator


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

PostPosted: Thu Dec 04, 2008 1:02 pm
Reply with quote

sreerocks,

What offset you want to add? Please post some examples of input and output records.
Back to top
View user's profile Send private message
sreerocks

New User


Joined: 18 Jun 2008
Posts: 9
Location: chennai

PostPosted: Thu Dec 04, 2008 1:27 pm
Reply with quote

for example: I want to add 1 day to 2008-12-05

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

Moderator


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

PostPosted: Thu Dec 04, 2008 5:16 pm
Reply with quote

sreerocks,

Offset to current date can be obtained using the below format. I cant test this feature now as it is available only in Syncsort for z/OS Release 1.3 or above.

&DATE [{±}nnnn] where '+' indicates a date after the current date and '–' indicates a date before the current date. 'nnnn' is the date offset. The range is 0 to 9999, which represents the number of days to be added or subtracted from the current date.
Back to top
View user's profile Send private message
sreerocks

New User


Joined: 18 Jun 2008
Posts: 9
Location: chennai

PostPosted: Thu Dec 04, 2008 6:47 pm
Reply with quote

Thanks arun..

I was wondering whether we can add some offset to a date other than
current date.

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

Moderator


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

PostPosted: Thu Dec 04, 2008 6:58 pm
Reply with quote

sreerocks,

I believe there are no built-in functions in Syncsort or DFSORT to do such arithmetic on a date field. Alissa/Frank might be able to explain further.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Dec 04, 2008 10:05 pm
Reply with quote

(post removed)
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Dec 05, 2008 3:22 am
Reply with quote

Hi,

for DFSORT check this out

ibmmainframes.com/viewtopic.php?t=35250&highlight=y2w+gt+y


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

Moderator


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

PostPosted: Fri Dec 05, 2008 7:20 am
Reply with quote

Gerry,

Thanks for the link. But the topic discusses about date comparison with an offset of current-date. Here, we talk about how to generate an offset of an input date field .
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Dec 05, 2008 8:19 am
Reply with quote

Hi Arun,

thanks for spotting my failure to read the thread correctly icon_redface.gif


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

Moderator


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

PostPosted: Fri Dec 05, 2008 9:28 am
Reply with quote

Alissa,

I tried executing the Syncsort job suggested by you; but ended up in the below syntax error. Is this a feature included in Syncsort for z/OS Release 1.3?

Code:
 SYNCSORT FOR Z/OS  1.2.1.0R    U.S. PATENTS: xxxxxxx, xxxxxxx
                                           *** xxx, xxxx *** 
 PRODUCT LICENSED FOR CPU SERIAL NUMBER xxxxx, MODEL xxxx xxx
 SYSIN :                                                     
   SORT FIELDS=COPY                                           
   OUTREC FIELDS=(1,6,Y2T,ADD,+1)                             
                          *                                   
 WER268A  OUTREC STATEMENT  : SYNTAX ERROR                   
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000               
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE               
Back to top
View user's profile Send private message
srinivas_cog

New User


Joined: 05 Jun 2008
Posts: 17
Location: chennai

PostPosted: Fri Dec 05, 2008 12:17 pm
Reply with quote

Arun,

It is working fine for SYNCSORT FOR Z/OS 1.3
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Dec 05, 2008 12:40 pm
Reply with quote

Kasu,

Thanks for letting me know. icon_smile.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Dec 05, 2008 8:51 pm
Reply with quote

Quote:
I cannot answer for DFSORT, but this CAN be done in SyncSort. Here is an example:
I am looking forward to see Frank's comments on how this can be done in DFSORT. icon_rolleyes.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 05, 2008 11:25 pm
Reply with quote

Quote:
I am looking forward to see Frank's comments on how this can be done in DFSORT


Why do you care given that you use Syncsort?

DFSORT doesn't have any built-in functions for date arithmetic on fields.

But since you brought it up, I have to wonder about Alissa's implication that you can use Y2x fields with ADD, DIV, MUL, etc in Syncsort. It doesn't seem very well defined. For 1,6,Y2T,ADD,+1, does +1 represent adding 1 day to get the correct date (e.g. 081130 + 1 = 081201)? How does that work for p,4,Y2T where Y2T represents only a 2-digit year and month (e.g. 0812 + 1 =?). And what would this mean:

1,6,Y2T,DIV,+5 (081130 / 5 = ?)

or this:

1,6,Y2T,MUL,+10 (081130 * 10 = ?)
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Sat Dec 06, 2008 12:25 am
Reply with quote

Based on Frank's statements, I ran some additional tests. My previous example will not work properly for all dates. (I will remove the incorrect code).

Arun's original statement is correct. Sreerocks, I would recommend finding an alternative solution for this requirement since SORT does not have an easy solution for your requirement at this time.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Sun Dec 07, 2008 5:35 pm
Reply with quote

Frank Yaeger wrote:
Quote:
I am looking forward to see Frank's comments on how this can be done in DFSORT
Why do you care given that you use Syncsort?
I personally believe "Information" is something that has to be shared. May be this is not of any use for me now, but may be some time later, or for somebody who uses DFSORT. Also it is as important to know which all functions are NOT feasible/difficult to do using a particular product as to know the functions which are present.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Dec 08, 2008 6:18 am
Reply with quote

Ok, I guess that's a valid reason why you care. But, in general, if you want to know something about DFSORT, I'd prefer that you ask the question in the DFSORT Forum. I tend not to participate in discussions specifically about Syncsort (although I may do so to correct or question something when appropriate, as in this case).
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top