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
 

 

fetch next 7 records for the matching key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
useit

Active User


Joined: 05 Oct 2006
Posts: 144

PostPosted: Tue Apr 01, 2014 1:29 pm    Post subject: fetch next 7 records for the matching key
Reply with quote

hi,

i have a requirement to fetch records which fall with 7 days window. and defer the rest.

please find the beow details.

i have input file1 (LRECL = 17), INPUT FILE2=(LRECL=17).

Input file 2 has 21 days records for the key combination(key=1-17)

i want fetch copy 7 days records into one fle and remaining 14 days records into another file.(for matching key combination).

say for ex:

Code:
infile1:
0191012014-01-01
0191022014-12-02

infile2:
Code:
0191012014-01-01
0191012014-01-02
0191012014-01-03
0191012014-01-04
0191012014-01-05
0191012014-01-06
0191012014-01-07
0191012014-01-08
0191012014-01-09
0191012014-01-00
0191012014-01-11
0191012014-01-12
0191012014-01-13
0191012014-01-14
0191012014-01-15
0191012014-01-16
0191012014-01-17
0191012014-01-18
0191012014-01-19
0191012014-01-20
0191012014-01-21
0191022014-12-02
0191022014-12-04
0191022014-12-05
0191022014-12-06
0191022014-12-07
0191022014-12-08
0191022014-12-09
0191022014-12-10
0191022014-12-11
0191022014-12-12
0191022014-12-13
0191022014-12-14
0191022014-12-15
0191022014-12-16
0191022014-12-17
0191022014-12-18
0191022014-12-19
0191022014-12-20
0191022014-12-21
0191022014-12-22
0191022014-12-23



my outfile1 should contain:
Code:
0191012014-01-01
0191012014-01-02
0191012014-01-03
0191012014-01-04
0191012014-01-05
0191012014-01-06
0191012014-01-07
0191022014-12-02
0191022014-12-04
0191022014-12-05
0191022014-12-06
0191022014-12-07
0191022014-12-08
0191022014-12-09

outfile 2 should contain:
Code:
0191012014-01-08
0191012014-01-09
0191012014-01-00
0191012014-01-11
0191012014-01-12
0191012014-01-13
0191012014-01-14
0191012014-01-15
0191012014-01-16
0191012014-01-17
0191012014-01-18
0191012014-01-19
0191012014-01-20
0191012014-01-21
0191022014-12-10
0191022014-12-11
0191022014-12-12
0191022014-12-13
0191022014-12-14
0191022014-12-15
0191022014-12-16
0191022014-12-17
0191022014-12-18
0191022014-12-19
0191022014-12-20
0191022014-12-21
0191022014-12-22
0191022014-12-23


i tried with the below code. but which copys only the matching records into one file and non matching into another file. how can i copy next 7 records for the matching key combination??

Code:
//IN1      DD *
0191012014-01-01
0191022014-12-02                       
//IN2      DD *
0191012014-01-01
0191012014-01-02
0191012014-01-03
0191012014-01-04
0191012014-01-05
0191012014-01-06
0191012014-01-07
0191012014-01-08
0191012014-01-09
0191012014-01-00
0191012014-01-11
0191012014-01-12
0191012014-01-13
0191012014-01-14
0191012014-01-15
0191012014-01-16
0191012014-01-17
0191012014-01-18
0191012014-01-19
0191012014-01-20
0191012014-01-21
0191022014-12-02
0191022014-12-04
0191022014-12-05
0191022014-12-06
0191022014-12-07
0191022014-12-08
0191022014-12-09
0191022014-12-10
0191022014-12-11
0191022014-12-12
0191022014-12-13
0191022014-12-14
0191022014-12-15
0191022014-12-16
0191022014-12-17
0191022014-12-18
0191022014-12-19
0191022014-12-20
0191022014-12-21
0191022014-12-22
0191022014-12-23
 
           
//OUT12    DD DSN=outfile1,             
//            DISP=(NEW,CATLG,DELETE),UNIT=DASD,                     
//            SPACE=(CYL,(200,100)),MGMTCLAS=MCNEVER,               
//            DCB=(LRECL=17,RECFM=FB)                               
//OUT2     DD DSN=outfile2,             
//            DISP=(NEW,CATLG,DELETE),UNIT=DASD,                     
//            SPACE=(CYL,(500,200),RLSE),MGMTCLAS=MCNEVER,           
//            DCB=(RECFM=FB,LRECL=17,BLKSIZE=0)                     
//SYSIN    DD *                                                     
  JOINKEYS F1=IN1,FIELDS=(1,2,A,3,5,A)                               
  JOINKEYS F2=IN2,FIELDS=(1,2,A,3,5,A)                               
  JOIN UNPAIRED,F2                                                   
  REFORMAT FIELDS=(F2:1,17,?)                                       
  SORT FIELDS=(1,2,CH,A,3,5,ZD,8,10,CH,A)
                                         
  OUTFIL FNAMES=OUT12,INCLUDE=(18,1,CH,EQ,C'B'),build=(1,7) 
  OUTFIL FNAMES=OUT2,INCLUDE=(18,1,CH,EQ,C'2'),build=(1,7)   
/*                                                         


regds,
useit
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7307

PostPosted: Tue Apr 01, 2014 1:59 pm    Post subject: Reply to: fetch next 7 records for the matching key
Reply with quote

Use WHEN=GROUP for the match-marker value being B, with RECORDS=7, and PUSH the match-marker into an extension of your record.

On OUTFIL, using INCLUDE=/OMIT= to test your extended byte, which will tell you what to do with it.

Consider OUTFIL SAVE for the second file.

Remember, this will be a bit inexact if your F1 dates "overlap" or are within seven records of the end of your F2.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Apr 02, 2014 2:33 am    Post subject:
Reply with quote

Your control cards are a mess. You are compare keys are 1,2, and 3,5 which actually takes the first digit of the year in the date.
Code:

----+----1----+----2-
0191012014-01-01     


You need to compare on the full key which includes dates so that you can actually pick the correct date record.

Also you need to use the high volume file as F1. You had it in the reverse.

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//INA      DD DISP=SHR,DSN=your Huge input FB 17 byte file
//INB      DD DISP=SHR,DSN=your small input FB 17 byte file
//FIRST7   DD SYSOUT=*                                       
//OTHER    DD SYSOUT=*                                       
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(1,16,A)                             
  JOINKEYS F2=INB,FIELDS=(1,16,A)                             
  JOIN UNPAIRED,F1                                           
  REFORMAT FIELDS=(F1:1,17,?)                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(18,1,CH,EQ,C'B'),RECORDS=7,
                PUSH=(18:18,1))                               
                                                             
  OUTFIL FNAMES=FIRST7,INCLUDE=(18,1,CH,EQ,C'B'),BUILD=(1,17)
  OUTFIL FNAMES=OTHER,SAVE,BUILD=(1,17)                       
//*
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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