Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Get only year from the current date using syncsort outrec

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
joseph murphy

New User


Joined: 24 Nov 2008
Posts: 17
Location: USA

PostPosted: Wed Dec 10, 2008 1:27 pm    Post subject: Get only year from the current date using syncsort outrec
Reply with quote

How to get only year from the current date using syncsort outrec?
Back to top
View user's profile Send private message

karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Dec 10, 2008 2:01 pm    Post subject: Reply to: Syncsort &date
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Dec 10, 2008 2:35 pm    Post subject:
Reply with quote

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
Code:
2008
Back to top
View user's profile Send private message
joseph murphy

New User


Joined: 24 Nov 2008
Posts: 17
Location: USA

PostPosted: Wed Dec 10, 2008 2:51 pm    Post subject: substr(char(curent_date),1,4)
Reply with quote

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
View user's profile Send private message
joseph murphy

New User


Joined: 24 Nov 2008
Posts: 17
Location: USA

PostPosted: Wed Dec 10, 2008 3:30 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Dec 11, 2008 12:50 am    Post subject:
Reply with quote

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
View user's profile Send private message
joseph murphy

New User


Joined: 24 Nov 2008
Posts: 17
Location: USA

PostPosted: Fri Dec 12, 2008 12:01 pm    Post subject: How to do Formatting in syncsort for SQL CASE statement?
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us