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

Syncsort Selecting Current Year - 1 records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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
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
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: 2455
Location: Hampshire, UK

PostPosted: Wed Aug 10, 2011 10:58 pm
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
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 11, 2011 6:15 am
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

Moderator Emeritus


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

PostPosted: Thu Aug 11, 2011 9:22 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top