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 

DFSORT - Select on date ??

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


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Wed Jun 23, 2004 9:16 am    Post subject: DFSORT - Select on date ?? Reply with quote

Hi Gurus

Is this possible via DFSORT? I think not...

1. Select records only when you find today's (or yesterdays or 10 days before) date on the file in the specified colums (here from col num. 8 to length 8 ). I am not supplying the date seperately to the job(via file etc.).

Code:
Input File:

003089;20040623;081728;P
003090;20040623;082035;P
003091;20040620;082339;P
003092;20040621;082944;P
003093;20040623;083249;P
003094;20040622;083554;P
003095;20040622;083859;P
003096;20040622;083906;R
003097;20040623;084212;P
003098;20040623;084517;P
003099;20040623;084822;P


2.
In the above code it should output a file containg the missing sequence numbers (cols 1. to length 6 ). The range should be picked up from the first record and the last record. It is sorted in ascending order.
I will not be supplying the range seperately.

This is not difficult to program but I am curious if DFSort can do this using some operators...

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


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

PostPosted: Wed Jun 23, 2004 9:41 am    Post subject: Reply with quote

Relaxing,

Sort products are capable of selecting records with today's date ! Selecting yesterday's or a month old records will be a little bit tricky.

The following JCL will give you the desired results for selecting records with current date

Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD  SYSOUT=*         
//SORTIN   DD  *                 
003089;20040623;081728;P         
003090;20040623;082035;P         
003091;20040620;082339;P         
003092;20040621;082944;P         
003093;20040623;083249;P         
003094;20040622;083554;P         
003095;20040622;083859;P         
003096;20040622;083906;R         
003097;20040623;084212;P         
003098;20040623;084517;P         
003099;20040623;084822;P         
//SORTOUT  DD  SYSOUT=*         
//SYSIN    DD  *                 
  SORT FIELDS=COPY               
  INCLUDE COND=(8,8,CH,EQ,DATE1) 
//*


The output from the above job is
Code:

003089;20040623;081728;P
003090;20040623;082035;P
003093;20040623;083249;P
003097;20040623;084212;P
003098;20040623;084517;P
003099;20040623;084822;P


Check this link for selecting records with date manipulations

http://www.mvsforums.com/helpboards/viewtopic.php?t=1459&highlight=date1

2. This has been covered earlier. check this topic to find the missing number

http://www.mvsforums.com/helpboards/viewtopic.php?t=1617&highlight=repeat

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
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Wed Jun 23, 2004 9:43 am    Post subject: Reply with quote

Ok Coolman..

For the 1st (select on date). I want records dated yesterday (20040622) only..

Code:
Output File:

003094;20040622;083554;P
003095;20040622;083859;P
003096;20040622;083906;R


For the second assume this is the input:

Code:
Input File:

003089;20040623;081728;P
003093;20040623;083249;P
003099;20040623;084822;P


The input range should be picked as 003089 and 003099. So the output should give the missing sequences..

Code:
003090
003091
003092
003093
003094
003095
003096
003097
003098
Back to top
View user's profile Send private message
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Wed Jun 23, 2004 9:44 am    Post subject: Reply with quote

Thanks a ton Kolusu.. I will look into themmmmm links...
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Jun 23, 2004 10:03 am    Post subject: Reply with quote

Moderator,

Where is my post?

Cheers,
Coolman
________
vaporizer questions


Last edited by coolman on Sat Feb 05, 2011 1:37 am; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 23, 2004 10:06 am    Post subject: Reply with quote

Coolman,

I deleted the post as you needed clarification from relaxing about the typo DBSORT and sample input and output data.

I edited relaxing post to reflect DFSORT so your post wouldn't make any sense

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


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Jun 23, 2004 10:10 am    Post subject: Reply with quote

Too bad Kolusu. I thought of posting some thing after a long time. You never give me a chance Mr. Green

You still have DBSORT in Relaxing's first post. Probably you overlooked at it. Very Happy
________
rolling a joint


Last edited by coolman on Sat Feb 05, 2011 1:37 am; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 23, 2004 10:46 am    Post subject: Reply with quote

Coolman,

Quote:

Too bad Kolusu. I thought of posting some thing after a long time. You never give me a chance


I took care of the Typo. well may be I will give up posting in the sort forum and you can try posting to the solutions.

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: Wed Jun 23, 2004 11:24 am    Post subject: Reply with quote

Kolusu wrote to Coolman
Quote:
well may be I will give up posting in the sort forum and you can try posting to the solutions.


Well, I have been known to post a solution occasionally when you don't beat me to it. Very Happy (But it does save me a lot of time when you post the solution and, of course, I only post solutions to DFSORT questions.)
_________________
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
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 23, 2004 1:48 pm    Post subject: Reply with quote

Relaxing,

The following DFSORT/ICETOOL JCL will give you all the missing records within the given range. You need to have DFSORT PTF UQ90053(Repeat Parm) installed for this job to work. A brief explanation of the job.

The first copy operator creates 2 files. File S1 will just have the account number.
File T1 will contain the MAX value of Seqnum and MIN Value of the seqnum.

Now we take this file with MAX and MIN file and generate a dynamic control card, so that it we generate all the seqnum between the min and max seqnum. For that we use the Repeat parm.

First we subtract the MIN from the MAX and add 1 to the difference. Now we generate dynamic control cards as follows
Code:

OUTFIL FNAMES=S2,                               
OUTREC=(SEQNUM,6,ZD,START=003089),REPEAT=000011


Now using a dummy record file we create all the seqnum in the range.

Once we have all the seq numbers in the range , we then concatenate the S1 & S2 file together and select all the unique seq numbers using the parm NODUPS.

Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN       DD *   
003089;20040623;081728;P
003093;20040623;083249;P
003099;20040623;084822;P
//NULL     DD *
DUMMY RECORD
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//S1       DD DSN=&S1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//S2       DD DSN=&S2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//CON      DD DSN=&S1,DISP=OLD,VOL=REF=*.S1
//         DD DSN=&S2,DISP=OLD,VOL=REF=*.S2
//OUT      DD SYSOUT=*
//TOOLIN   DD *                                           
  COPY FROM(IN)    USING(CTL1)                             
  COPY FROM(T1)    USING(CTL2)                             
  COPY FROM(NULL)  USING(CTL3)                           
  SELECT FROM(CON) TO(OUT) ON(1,6,CH) NODUPS             
//CTL1CNTL DD *                                           
  OUTFIL FNAMES=S1,OUTREC=(1,6)                           
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,OUTREC=(1,13),       
  TRAILER1=(MAX=(1,6,ZD,M11),X,MIN=(1,6,ZD,M11))         
//CTL2CNTL DD *   
  INREC FIELDS=(1,13,+1,ADD,(1,6,ZD,SUB,8,6,ZD),EDIT=(TTTTTT))
  OUTFIL FNAMES=CTL3CNTL,                                 
  OUTREC=(C' OUTFIL FNAMES=S2,',/,                         
          C' OUTREC=(SEQNUM,6,ZD,START=',8,6,             
          C'),REPEAT=',14,6,80:X)                         
//CTL3CNTL DD DSN=&C1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)


The output from this job is
Code:

003090
003091
003092
003094
003095
003096
003097
003098


Hope this helps...

Cheers

Kolusu

PS: I would like to thank Frank for testing this solution as my shop had syncsort which does not support the REPEAT parm.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 23, 2004 2:07 pm    Post subject: Reply with quote

Relaxing,

The following JCL will give you yesterday's records from the input file. A brief explanation of the job. We generate a dynamic control card using DB2 Unload. We dynamically generate a control card like this
Code:

  INCLUDE COND=(8,8,ZD,EQ,20040622)


Now using the dynamic control card we pick only the records which match yesterday's date.

Code:

//STEP0100 EXEC PGM=IKJEFT01                                 
//SYSTSPRT DD  SYSOUT=*,DCB=BLKSIZE=121                     
//SYSPRINT DD  SYSOUT=*                                     
//SYSTSIN  DD  *                                             
  DSN SYSTEM(XXXX)                                           
  RUN PROGRAM(DSNTIAUL) -                                   
      PLAN(DSNTIAUL)    -                                   
      PARMS('SQL')      -                                   
      LIB('DB2P.RUNLIB.LOAD')                               
//SYSREC00 DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)   
//SYSPUNCH DD DUMMY                                         
//SYSIN    DD  *   
SELECT CHAR(' INCLUDE COND=(8,8,ZD,EQ,')           
      ,SUBSTR(CHAR(CURRENT DATE - 1 DAY),1,4)       
      ,SUBSTR(CHAR(CURRENT DATE - 1 DAY),6,2)       
      ,SUBSTR(CHAR(CURRENT DATE - 1 DAY),9,2)       
      ,CHAR(')  ')                                 
       FROM SYSIBM.SYSDUMMY1                       
;
//*
//STEP0200 EXEC PGM=SORT         
//SYSOUT   DD  SYSOUT=*           
//SORTIN   DD  *                 
003089;20040623;081728;P         
003090;20040623;082035;P         
003091;20040620;082339;P         
003092;20040621;082944;P         
003093;20040623;083249;P         
003094;20040622;083554;P         
003095;20040622;083859;P         
003096;20040622;083906;R         
003097;20040623;084212;P         
003098;20040623;084517;P         
003099;20040623;084822;P         
//$ORTPARM DD *                   
  OPTION COPY                     
//SORTOUT  DD  SYSOUT=*           
//SYSIN    DD  DSN=&T1,DISP=OLD   
//*   


The output from this job is
Code:

003094;20040622;083554;P 
003095;20040622;083859;P 
003096;20040622;083906;R 


If you want records for the last 10 days then change the sysin parm in step0100 to the following.
Code:

SELECT CHAR(' INCLUDE COND=(8,8,ZD,EQ,')           
      ,SUBSTR(CHAR(CURRENT DATE - 10 DAYS),1,4)       
      ,SUBSTR(CHAR(CURRENT DATE - 10 DAYS),6,2)       
      ,SUBSTR(CHAR(CURRENT DATE - 10 DAYS),9,2)       
      ,CHAR(')  ')                                 
       FROM SYSIBM.SYSDUMMY1                       
;


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
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Fri Jun 25, 2004 7:15 am    Post subject: Reply with quote

Thanks a lot for your help...
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: Thu May 18, 2006 3:29 pm    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 April, 2006), you can now use:

Code:

   INCLUDE COND=(8,8,ZD,EQ,DATE1P-1)


to only include the records with yesterday's date. For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
_________________
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