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
 

 

Syncsort Selecting Current Year - 1 records

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

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Aug 10, 2011 2:52 am    Post subject: Syncsort Selecting Current Year - 1 records
Reply with quote

Hi,

I have a FB file with a cloumn storing date as YYYYMM e.g. 201108.
Now I want to extract records from the file for the immediate previous year always. Like YYYY - 1.

Is there any way to do it using DATE parameter?
Back to top
View user's profile Send private message

Soumik Das

New User


Joined: 06 Aug 2011
Posts: 25
Location: India

PostPosted: Wed Aug 10, 2011 5:40 pm    Post subject: Reply to: Syncsort Selecting Current Year - 1 records
Reply with quote

I prefer to use SYMNAMES....I believe syncsort works with DFSORT symnames.

I have only dfsort in my shop but I believe this will work for syncsort as well.

Code:
//S010    EXEC SORT                                               
//SYMNAMES  DD *                                                   
THISYEAR,C'2011'                                                   
LASTYEAR,C'2010'                                                   
//SORTIN    DD *                                                   
AAA200901                                                         
BBB201002                                                         
CCC201003                                                         
CCC201101                                                         
DDD201004                                                         
//SORTOUT   DD SYSOUT=*                                           
//SYSIN     DD *                                                   
 SORT FIELDS=COPY                                                 
 INCLUDE COND=(4,4,CH,LT,THISYEAR,AND,4,4,CH,GE,LASTYEAR)


You can create symnames like this.

Code:
/TSOBATCH EXEC PGM=IKJEFT1A,DYNAMNBR=200
//SYSEXEC DD DSN=GEP29.QUELL.REXX,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//OUTFILE DD DSN=&&DSN1,UNIT=SYSDA,SPACE=(TRK,(1,1)),
// DISP=(,PASS),LRECL=80,RECFM=FB,DSORG=PS
//SYSTSIN DD *
%REXXDT1
//S020    EXEC SORT                                               
//SYMNAMES  DD DSN=&&DSN1,DISP=(OLD,PASS)                                                   
//SORTIN    DD *                                                   
AAA200901                                                         
BBB201002                                                         
CCC201003                                                         
CCC201101                                                         
DDD201004                                                         
//SORTOUT   DD SYSOUT=*                                           
//SYSIN     DD *                                                   
 SORT FIELDS=COPY                                                 
 INCLUDE COND=(4,4,CH,LT,THISYEAR,AND,4,4,CH,GE,LASTYEAR) 


Here REXXDT1 will have the below REXX code (this is untested but I believe you can get the idea)

Code:
/* REXX */
"EXECIO 0 DISKW OUTFILE(OPEN"
A1=DATE('S',DATE('B'),'B')
A2=SUBSTR(A1,1,4)
B1=DATE('S',DATE('B')-365,'B')
B2=SUBSTR(B1,1,4)
QUEUE "THISYEAR,C"||"'"||A2||"'"
QUEUE "LASTYEAR,C"||"'"||B2||"'"
"EXECIO * DISKW OUTFILE (FINIS"
"FREE FI(OUTFILE)"


Let me know if you get stuck.....
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Aug 10, 2011 8:20 pm    Post subject:
Reply with quote

Soumik,

If at all I had to hardcode my year, then I would have preferred a simple 4,4,CH,EQ,C'2010'!!!!!!!!!

Neways thanks for responding.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Aug 10, 2011 8:34 pm    Post subject:
Reply with quote

This is not hardcoding... Rexx is generating the year...
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Aug 10, 2011 8:44 pm    Post subject:
Reply with quote

ok..but i am not a REXX programmer so couldn't get that part.

Neways..I got my ctlcard as below after some trial and error..it solved my issue. Thanks all for replying.

INCLUDE COND=(3,4,CH,EQ,DATE1-365)
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Aug 10, 2011 8:46 pm    Post subject:
Reply with quote

What about leap years?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Wed Aug 10, 2011 10:58 pm    Post subject:
Reply with quote

It is NOT neways but ANYWAY
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Aug 10, 2011 11:09 pm    Post subject:
Reply with quote

Craq,

That scenario will not arrive as my sort would run only once in a year on Jan.

who cares for grammer in this wild wild west... icon_smile.gif
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Thu Aug 11, 2011 1:24 am    Post subject:
Reply with quote

ksouren007 wrote:
Thanks all for replying.
Neways thanks for responding.


Yeah..but I thought Mr Zuckerberg's words suits people more appropriately who questions the above attitude..
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Aug 11, 2011 6:15 am    Post subject: Reply to: Syncsort Selecting Current Year - 1 records
Reply with quote

Souren,

If the job only runs in January, why not just subtract 31 :-)

Do you ever write anything at your site for others to read? Documentation? Specifications? Memos? Anything? Assuming that you do, do you use the same slang, or do you write it the best you can so that the receiver is most likely to be able to understand it? Assuming the latter, how about extending us the same courtesy?

Looking at your mainframe skills, your life is full of syntax and correct spelling - you'd not do it there, so why with us? I know you can take the brick-bats, but do you have to? When seeking information and ideas from elsewhere, I've never found the "wind-up" to be an effective tactic.
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 Aug 11, 2011 9:22 am    Post subject:
Reply with quote

Hello,

Quote:
who cares for grammer in this wild wild west...
Anyone who wants to appear to be and be taken as a professional. . . And most of the people who might be able to help you.

Kiddie chat speak is just insulting to those you want to read it (unless it is a private text message to your BFF). . . icon_sad.gif

This attitude plus the growing lack of even basic knowledge is causing IT to get more and more disrespect.

You decide how you want to be considered for your career. . .
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Wishing everyone a very Happy Diwali ... Rohit Umarjikar General Talk & Fun Stuff 1 Sat Oct 29, 2016 1:54 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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