MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sort card that filters records with current date

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Mon May 21, 2007 11:31 am    Post subject: sort card that filters records with current date Reply with quote

Hi,

I have a input file that has a date as one of its fields. I need to sort and filter the records from the input file to the output file with records that
has the date value as the current date in the date field of input file.

Can some one help me out with this??

Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Mon May 21, 2007 11:55 am    Post subject: Reply with quote

nagarajan.dharani,

Try this

Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
2007/05/18                           
2007/05/19                           
2007/05/20                           
2007/05/21                           
2007/05/22                           
2007/05/23                           
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
 SORT FIELDS=COPY                     
 INCLUDE COND=(01,10,CH,EQ,&DATE1(/))
/*                                   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Mon May 21, 2007 12:05 pm    Post subject: Reply with quote

Hi Kolusu,

It worked fine, but my input file has the date in the format CYYMMDD
(For Example: 1060510) and the type is packed decimal. Can you pls let me know will the sort card work for this input???


Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Mon May 21, 2007 12:21 pm    Post subject: Reply with quote

nagarajan.dharani,

Assuming that your input file is 80 bytes FB recfm dataset and the date field starts at position 1 for 4 bytes the following control cards will give the desired results

Code:

//SYSIN    DD *                               
  SORT FIELDS=COPY                           
  OUTREC IFTHEN=(WHEN=INIT,                   
        OVERLAY=(81:1,4,PD,EDIT=(TTTTTTTT))),
         IFTHEN=(WHEN=(81,2,ZD,EQ,0),         
        OVERLAY=(81:C'19')),                 
         IFTHEN=(WHEN=(81,2,ZD,EQ,1),         
        OVERLAY=(81:C'20')),                 
         IFTHEN=(WHEN=(81,2,ZD,EQ,2),         
        OVERLAY=(81:C'21'))                   
  OUTFIL INCLUDE=(81,08,CH,EQ,&DATE1)         
/*                                           


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Mon May 21, 2007 12:34 pm    Post subject: Reply with quote

Hi Kolusu,

My input file is a VSAM file of length 450 and the date field starts at 24th position. I tried with the following sort card and it gave me S0C7.
Code:

SORT FIELDS=COPY                           
OUTREC IFTHEN=(WHEN=INIT,                   
      OVERLAY=(24:1,4,PD,EDIT=(TTTTTTTT))),
       IFTHEN=(WHEN=(24,2,ZD,EQ,0),         
      OVERLAY=(24:C'19')),                 
       IFTHEN=(WHEN=(24,2,ZD,EQ,1),         
      OVERLAY=(24:C'20')),                 
       IFTHEN=(WHEN=(24,2,ZD,EQ,2),         
      OVERLAY=(24:C'21'))                   
OUTFIL INCLUDE=(24,08,CH,EQ,&DATE1)         

Can you pls help me out???


Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Mon May 21, 2007 12:38 pm    Post subject: Reply with quote

nagarajan.dharani,

Try these control cards
Code:

//SYSIN    DD *                               
  SORT FIELDS=COPY                           
  OUTREC IFTHEN=(WHEN=INIT,                   
        OVERLAY=(451:24,4,PD,EDIT=(TTTTTTTT))),
         IFTHEN=(WHEN=(451,2,ZD,EQ,0),         
        OVERLAY=(451:C'19')),                 
         IFTHEN=(WHEN=(451,2,ZD,EQ,1),         
        OVERLAY=(451:C'20')),                 
         IFTHEN=(WHEN=(451,2,ZD,EQ,2),         
        OVERLAY=(451:C'21'))                   
  OUTFIL INCLUDE=(451,08,CH,EQ,&DATE1),         
  OUTREC=(01,450)
/*                           


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Tue May 22, 2007 2:34 am    Post subject: Reply with quote

Hi Kolusu,

Thanks a lot for your help...It worked fine for me.

I've another requirement that if the current date is not taken from the system but the current date of a particular application is stored in a VSAM file(May be called date file). Now I have to check whether the date in my input file is equal to the date in the date file as we checked if the date is equal to the current date. Can you pls let me know is it possible to do a sort now?


Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Tue May 22, 2007 6:06 am    Post subject: Reply with quote

nagarajan.dharani,

check this link which explains pulling a value from 1 file and using it in another. you just need a include cond instead of OUTREC in the 2nd step

http://www.mvsforums.com/helpboards/viewtopic.php?t=7784&highlight=symbols

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Thu May 24, 2007 8:02 am    Post subject: Reply with quote

Hi Kolusu,

Thanks a lot for your help!!! It worked fine for my requirement.

Is there any command to get the current century and year from the system using sort card?? I am not so much aware of sort card. So can you pls help me out??

Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu May 24, 2007 8:05 am    Post subject: Reply with quote

are you aware of the Sort manual - there is a link to it at the top of the page. It can tell you all you need to know - and more whereas we can only tell you what we know - which in my case is next to nothing Mr. Green
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu May 24, 2007 8:28 am    Post subject: Reply with quote

Quote:

Is there any command to get the current century and year from the system using sort card?? I am not so much aware of sort card. So can you pls help me out??


nagarajan.dharani,

try this

Code:

18th century  = 1701-01-01 to 1800-12-31

19th century  = 1801-01-01 to 1900-12-31

20th century  = 1901-01-01 to 2000-12-31

21st century  = 2001-01-01 to 2100-12-31

22nd century  = 2101-01-01 to 2200-12-31



Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
DUMMY RECORD                                           
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
 SORT FIELDS=COPY                                     
 INREC IFTHEN=(WHEN=INIT,                             
        BUILD=(1:&DATE1(-))),
                         
       IFTHEN=(WHEN=(01,10,CH,GE,C'1701-01-01',AND,   
                     01,10,CH,LE,C'1800-12-31'),       
        BUILD=(1:C'CENTURY : ',C'18 ',C'YEAR : ',1,4)),

       IFTHEN=(WHEN=(01,10,CH,GE,C'1801-01-01',AND,   
                     01,10,CH,LE,C'1900-12-31'),       
        BUILD=(1:C'CENTURY : ',C'19 ',C'YEAR : ',1,4)),

       IFTHEN=(WHEN=(01,10,CH,GE,C'1901-01-01',AND,   
                     01,10,CH,LE,C'2000-12-31'),       
        BUILD=(1:C'CENTURY : ',C'20 ',C'YEAR : ',1,4)),

       IFTHEN=(WHEN=(01,10,CH,GE,C'2001-01-01',AND,   
                     01,10,CH,LE,C'2100-12-31'),       
        BUILD=(1:C'CENTURY : ',C'21 ',C'YEAR : ',1,4)),

       IFTHEN=(WHEN=(01,10,CH,GE,C'2101-01-01',AND,   
                     01,10,CH,LE,C'2200-12-31'),       
        BUILD=(1:C'CENTURY : ',C'22 ',C'YEAR : ',1,4))
/*


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu May 24, 2007 1:29 pm    Post subject: Reply with quote

Kolusu,

I am getting an error when i try to run the code as below:
Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
2007/05/18                           
2007/05/19                           
2007/05/20                           
2007/05/21                           
2007/05/22                           
2007/05/23                           
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
 SORT FIELDS=COPY                     
 INCLUDE COND=(01,10,CH,EQ,&DATE1(/))
/*           

The error which i get is:
Code:

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 14:23 ON THU MAY 24, 2007 -
            SORT FIELDS=COPY                                                   
            INCLUDE COND=(01,10,CH,EQ,&DATE1(/))                                 
                                     $                                         
ICE113A E COMPARISON FIELD ERROR                                               
ICE751I 0 C5-K05352 C6-Q95214 C7-K90000 C8-K05352 E7-K90000                     
ICE052I 3 END OF DFSORT

Is it that i do not have latest version of DFSORT April 2006 PTF not installed ?
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu May 24, 2007 1:36 pm    Post subject: Reply with quote

Quote:

ICE751I 0 C5-K05352 C6-Q95214 C7-K90000 C8-K05352 E7-K90000


shekhar123,

You are missing the latest z/OS DFSORT V1R5 PTF UK90007 and DFSORT Release 14 PTF UK90006, which were first made available in April, 2006

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat May 26, 2007 1:04 pm    Post subject: Reply with quote

shekhar123,

You can do what you want without the April, 2006 PTF like this:

Code:

    SORT FIELDS=COPY                           
    INCLUDE COND=(01,10,CH,EQ,DATE1(/))       


The &DATE forms were added to DFSORT with the April, 2006 PTF, but the DATE forms without the & were available long before that.

(I've never understood the need for the & forms, but we added the ones we were missing for ease of migration.)
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group