View previous topic :: View next topic
|
Author |
Message |
joseph murphy
New User
Joined: 24 Nov 2008 Posts: 17 Location: USA
|
|
|
|
How to get only year from the current date using syncsort outrec? |
|
Back to top |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
HI,
U can use INCLUDE COND for that.
If ur date is character string use below
&DATE1 - C'yyyymmdd'
&DATE2 - C'yyyymm'
If ur date is numeric string use below
&DATE1P - C'yyyymmdd'
&DATE2P - C'yyyymm'
Sort card:
INCLUDE COND=(5,8,ZD,EQ,&DATE1P)
Regards
R KARTHIK |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
karthikr44,
I think the TS was asking for generating the current year from the current-date functions in Syncsort and not comparing a date field witth current-date.
joseph murphy,
The below jcl might help. If this doesn't match your requirement, please explain further with examples.
Code: |
//STEP1 EXEC PGM=SORT
//SORTIN DD *
DUMMY RECORD
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(&DATE2,5:8X) |
SORTOUT
|
|
Back to top |
|
|
joseph murphy
New User
Joined: 24 Nov 2008 Posts: 17 Location: USA
|
|
|
|
Thanks for your explanation,
1.from 1-4 positions i need to display year
2.from 15-16 month
3.from 20-21 date
how to display.
In query i have like,
substr(char(curent_date),1,4)
substr(char(curent_date),5,2)
substr(char(curent_date),7,2)
using syncsort outrec? |
|
Back to top |
|
|
joseph murphy
New User
Joined: 24 Nov 2008 Posts: 17 Location: USA
|
|
|
|
arcvns you understood my qustion correctly,But i should not use overlay,i need to use outrec
I have sql query like,
substr(char(current_date),1,4)
substr(char(current_date),6,2)
substr(char(current_date),9,2)
I am converting this query using syncsort,
So,In outrec,I have to display like this,
from the current date,
1.1-4 positions year,
2.5-6 month
3.7-8 date
please help me out, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
But i should not use overlay,i need to use outrec |
Why not? Is there some business reason for this? |
|
Back to top |
|
|
joseph murphy
New User
Joined: 24 Nov 2008 Posts: 17 Location: USA
|
|
|
|
Hi all,
I am doing performance tuening for SQL quries using syncsort,i have CASE like this,
COLEASCE(
SUBSTR(
CASE(WHEN ZONE_ID IS NULL
THEN '00000000'
ELSE DIGITS(ZONE_ID)
END)1,8)
SUBSTR('00000000'))
Note:-
ZONE_ID is a Decimal(8,0),PD format
I have to do formatting in syncsort outrec,how to do it? |
|
Back to top |
|
|
|