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 

dynamic sort card generation

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


Joined: 17 May 2006
Posts: 26
Topics: 17

PostPosted: Mon Feb 02, 2009 6:49 am    Post subject: dynamic sort card generation Reply with quote

Hi,

I want to construct the sort card to extract records in current date.
INCLUDE COND=(65,10,CH,EQ,C'02/02/2009')
Here the date needs to be changed based on current date.
Is it possible to do it in jcl itself? or do i need to write a cobol program to construct this sort card?

Thanks,
K.anitha
Back to top
View user's profile Send private message
oneofspace
Beginner


Joined: 18 Nov 2008
Posts: 33
Topics: 14

PostPosted: Mon Feb 02, 2009 8:35 am    Post subject: Reply with quote

Hi

You can use the following job

Code:

//CARD     EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//INPUT    DD *
INCLUDE COND=(65,10,CH,EQ,C'MM/DD/YYYY')
//CNTLCARD DD DSN=ABCD.CNTL.CARD,DISP=SHR
//TOOLIN   DD *
  COPY FROM(INPUT) USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION COPY
  INREC OVERLAY=(42:DATE1(/))
  OUTFIL FNAMES=CNTLCARD,
  BUILD=(2X,1,28,31:47,3,34:50,2,36:C'/',37:42,4,41:39,2,38X)
/*


Thanks
One
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 02, 2009 11:18 am    Post subject: Reply with quote

kanitha-mvs,

You really dont have to generate the control cards for the date. You can use system symbols as a system symbol string in DFSORT and generate the date.

Pickdate will have current date in mm/dd/ccyy format and we can use that to include the records we need

Code:

//STEP0100 EXEC PGM=ICEMAN           
//SYSOUT   DD SYSOUT=*               
//SYMNAMES DD *                     
PICKDATE,S'&LMON/&LDAY/&YR4'         
//SORTIN   DD DSN=your input dsn,
//            DISP=SHR               
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                     
  INCLUDE COND=(65,10,CH,EQ,PICKDATE) 
  SORT FIELDS=COPY   
/*


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
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Mon Feb 02, 2009 11:21 am    Post subject: Reply with quote

Try this,

Code:

//SORT01  EXEC PGM=SORT                                                 
//SORTIN DD *                                                           
 INCLUDE COND=(65,10,CH,EQ,C'MM/DD/YYYY')     
//*SORTOUT DD DSN=&&SRTCRD,                                             
//*           DISP=(,PASS),                                             
//*           UNIT=SYSDA                                               
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
 OPTION COPY                                                           
 OUTREC OVERLAY=(30:DATE=(MD4-),40:40,2) 
//SYSOUT DD SYSOUT=*
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Mon Feb 02, 2009 11:29 am    Post subject: Reply with quote

Oh..Is this (PICKDATE) new feature?

Do we have link to IBM website?
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Mon Feb 02, 2009 11:38 am    Post subject: Reply with quote

It's not a new feature. PICKDATE is a DFSORT Symbol created from system symbols for the parts of the date (mon, day, year) using an S-constant. The use of S-constants for DFSORT Symbols has been available since April, 2006. It's fully documented in "z/OS DFSORT Application Programming Guide" available at:

www.ibm.com/systems/support/storage/software/sort/mvs/srtmpub.html
_________________
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
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Mon Feb 02, 2009 1:37 pm    Post subject: Reply with quote

Sqlcode, what is the purpose of below in OUTREC Overlay?

Quote:

40:40,2


Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kanitha-mvs
Beginner


Joined: 17 May 2006
Posts: 26
Topics: 17

PostPosted: Tue Feb 03, 2009 4:29 am    Post subject: Reply with quote

Thanks all of you for your time & help in this..

Thanks a lot kolusu. It works.
Also, is there any S constant available for time?

My requirement is to filter records having "current time - 1 hour " in the time field of the record. In the input record, time field is in "HH:MM" format.(E.G 22.10, 07.10)

From the ibm link provided by Frank, I could see the reserved words TIME1, TIME1P etc.. but am not able to find out the usage of those keywords.. Please help me in this..
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Feb 03, 2009 11:09 am    Post subject: Reply with quote

kanitha-mvs wrote:
My requirement is to filter records having "current time - 1 hour " in the time field of the record. In the input record, time field is in "HH:MM" format.(E.G 22.10, 07.10)


What happens if the Job is running between midnight (12:00 and 01:00 AM)?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Feb 03, 2009 12:29 pm    Post subject: Reply with quote

ranga_subham

If you check input file, I have
Code:
C'MM/DD/YYYY'),
and
Code:
DATE=(MD4-),
overwrites
Code:
MM/DD/YYYY
with current date 02/03/2009.

Code:
40:40,2
is required in OUTREC OVERLAY to copy
Code:
')
from the input file.
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Feb 03, 2009 1:28 pm    Post subject: Reply with quote

ranga_subham,
Correction in the earlier post,

Even if you don't code
Code:
40:40,2
result will be same.

It was my understanding that it was required to copy comma and bracket
Code:
')'
from the input file but I was wrong.


Thanks,
Back to top
View user's profile Send private message
kanitha-mvs
Beginner


Joined: 17 May 2006
Posts: 26
Topics: 17

PostPosted: Thu Feb 05, 2009 8:02 am    Post subject: Reply with quote

Hi Kolusu,

This job would be scheduled in OPCE in one hour interval. So it would run exactly at 00.00 and 01.00. In 00.00 run, I would need to check the records with value in time column between 11.00 PM and 00.00 AM. Is this possible to do in JCL? or should I write cobol program to accomplish this task? Please give me suggestion..

Thanks a lot for your help in this
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 05, 2009 11:50 am    Post subject: Reply with quote

kanitha-mvs,

The following JCL will give you the desired results. I assumed that your input file is 80 bytes LRECL and FB format. The date in the file begins at pos 65 and the time at pos 75 for 5 bytes.

This job picks the records in range hh.00 - hh.59

Code:

If job rub = 00.00 - 00.59
   pick records with (current date -1) and time 23.00 - 23.59
else
   pick records with current date and time (hh-1).00 - (hh-1).59
end-if


Code:

//STEP0100 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=your input file 80 bytes,
//            DISP=SHR
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:DATE1,DATE1-1,TIME1)),
  IFTHEN=(WHEN=(97,2,ZD,LT,1),                               
  OVERLAY=(103:93,2,C'/',95,2,C'/',89,4,                     
           113:C'23.00',C'23.59')),                     
  IFTHEN=(WHEN=NONE,                                         
  OVERLAY=(103:85,2,C'/',87,2,C'/',81,4,                     
           113:+1,SUB,97,2,ZD,EDIT=(TT),C'.00',113,2,C'.59'))
                                                             
  OUTFIL BUILD=(1,80),                                       
  INCLUDE=(65,10,CH,EQ,103,10,CH,AND,                       
          (75,5,CH,GE,113,5,CH,AND,75,5,CH,LE,118,5,CH))     
/*                                                           

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


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri May 01, 2009 4:31 pm    Post subject: Reply with quote

Hi,

Its been quite a while since I posted a message in MVSFORUMS. I got a bit out of date on several topics.

I am using SYNCSORT for z/OS 1.2.3.1R. Can someone let me know if syncsort has any operator equivalent to the 'S'-constants in DFSORT ?

thanks
Phantom
Back to top
View user's profile Send private message
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