View previous topic :: View next topic
|
Author |
Message |
sreerocks
New User
Joined: 18 Jun 2008 Posts: 9 Location: chennai
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
sreerocks,
What offset you want to add? Please post some examples of input and output records. |
|
Back to top |
|
|
sreerocks
New User
Joined: 18 Jun 2008 Posts: 9 Location: chennai
|
|
|
|
for example: I want to add 1 day to 2008-12-05
Thanks
sree |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
sreerocks
New User
Joined: 18 Jun 2008 Posts: 9 Location: chennai
|
|
|
|
Thanks arun..
I was wondering whether we can add some offset to a date other than
current date.
Thanks
sree |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
(post removed) |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Arun,
thanks for spotting my failure to read the thread correctly
Gerry |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
srinivas_cog
New User
Joined: 05 Jun 2008 Posts: 17 Location: chennai
|
|
|
|
Arun,
It is working fine for SYNCSORT FOR Z/OS 1.3 |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Kasu,
Thanks for letting me know. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|