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 

Can I use DFSORT to splice two files with a Date range.

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


Joined: 13 Jun 2005
Posts: 3
Topics: 2

PostPosted: Mon Jun 13, 2005 8:15 am    Post subject: Can I use DFSORT to splice two files with a Date range. Reply with quote

I have 2 files. The first file has a KEY and a DATE
eg.
K1 2004/02/01
K1 2004/03/01
K2 2004/01/01
K2 2004/02/01

The Second file Has the same key,a start Date and an End date and some extra fields.

k1 2002/01/01 2002/04/02 AA
k1 2002/04/03 2002/10/01 BB
k1 2002/10/02 2004/02/01 CC
k1 2004/02/03 2004/10/15 DD
k2 2002/10/01 2002/10/15 EE
k2 2002/10/16 2002/12/31 FF
k2 2003/01/01 2004/09/15 GG

There will never be an overlap in the dates for a particular key.


The output file should have only the first file records with the extra fields from the second file. The matching should be done such that the key should match and the date from the first file should be between the dates in the second file both (Start and end dates )inclusive.

K1 2004/02/01 CC
K1 2004/03/01 DD
K2 2004/01/01 GG
K2 2004/02/01 GG


I hope I have explained my requirements well

Please let me know if it can be done using SPLICE of ICETOOL.
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Mon Jun 13, 2005 12:56 pm    Post subject: Reply with quote

I am working on it...

Alain
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Mon Jun 13, 2005 5:00 pm    Post subject: Reply with quote

Mallu,

The idea is to cut the records of file 2 in to 2 pieces to be able to do a sort on the date.
First part is considered as HDR, second as TRL. Records from file 1 are considered as details.
I flagged HDR with 0, details with 1, TRL with 2. All the records between HDR & TRL are selected, the others not.
To understand what the logic is about this you have to take a look to this thread :
http://www.mvsforums.com/helpboards/viewtopic.php?t=3793

To run this JCL you need the last December DFSORT PTF UQ95213 or UQ95214.
Code:

//STEP0001 EXEC PGM=ICETOOL
//DFSMSG   DD SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//TOOLIN   DD *
  COPY FROM(IN1) TO(OUT1) USING(ICE0)
  COPY FROM(IN2) USING(ICE1)
  SORT FROM(OUT1) TO(OUT2) USING(ICE2)
  COPY FROM(OUT2) TO(OUT3) USING(ICE3)
  SPLICE FROM(OUT3) TO(OUTX) ON(82,5,ZD) WITH(1,13) WITH(81,6) -
  WITHALL USING(ICE4)
/*
//IN1      DD *
K1 2004/02/01
K1 2004/03/01
K2 2004/01/01
K2 2004/02/01
K2 2004/09/14
K2 2004/09/16
/*
//IN2      DD *
K1 2002/01/01 2002/04/02 AA
K1 2002/04/03 2002/10/01 BB
K1 2002/10/02 2004/02/01 CC
K1 2004/02/03 2004/10/15 DD
K2 2002/10/01 2002/10/15 EE
K2 2002/10/16 2002/12/31 FF
K2 2003/01/01 2004/09/15 GG
/*
//OUT1     DD DSN=&&OUT1,
//            DISP=(MOD,DELETE,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(1,1),RLSE),
//            DCB=(RECFM=FB,LRECL=81)
//OUT2     DD DSN=&&OUT2,
//            DISP=(NEW,DELETE,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(1,1),RLSE),
//            DCB=(RECFM=FB,LRECL=96)
//OUT3     DD DSN=&&OUT3,
//            DISP=(NEW,DELETE,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(1,1),RLSE),
//            DCB=(RECFM=FB,LRECL=86)
//OUTX     DD SYSOUT=*
//ICE0CNTL DD *
  INREC OVERLAY=(81:C'1')
/*
//ICE1CNTL DD *
  OUTFIL FNAMES=OUT1,
         OUTREC=(1,13,X,26,55,81:C'0',/,
                 1,2,X,15,10,X,26,2,81:C'2')
/*
//ICE2CNTL DD *
  SORT FIELDS=(1,13,CH,A,81,1,ZD,A)
/*
//ICE3CNTL DD *
  INREC  IFTHEN=(WHEN=INIT,OVERLAY=(82:SEQNUM,5,ZD)),
         IFTHEN=(WHEN=(81,1,CH,NE,C'2'),
                 OVERLAY=(87:SEQNUM,5,ZD,START=1,INCR=1),
                 HIT=NEXT),
         IFTHEN=(WHEN=(81,1,CH,NE,C'0'),
                 OVERLAY=(92:SEQNUM,5,ZD,START=1,INCR=1),
                 HIT=NEXT),
         IFTHEN=(WHEN=(81,1,CH,EQ,C'0'),
                 OVERLAY=(82:SEQNUM,5,ZD,START=1,INCR=1)),
         IFTHEN=(WHEN=(81,1,CH,EQ,C'2'),
                 OVERLAY=(82:SEQNUM,5,ZD,START=1,INCR=1)),
         IFTHEN=(WHEN=(87,5,ZD,NE,92,5,ZD),
                 OVERLAY=(82:82,5,ZD,SUB,92,5,ZD,M11,LENGTH=5))
  OUTFIL FNAMES=OUT3,
         OMIT=(87,5,ZD,EQ,92,5,ZD),
         OUTREC=(1,86)
/*
//ICE4CNTL DD *
  OUTFIL FNAMES=OUTX,
         OMIT=(81,1,CH,EQ,C'2'),
         OUTREC=(1,80)
/*

Alain
Back to top
View user's profile Send private message
Venkata Ramana Reddy
Beginner


Joined: 02 Dec 2002
Posts: 70
Topics: 19
Location: California

PostPosted: Tue Jun 14, 2005 12:16 pm    Post subject: Reply with quote

Mallu,
Do you have Easytrieve in your shop.?
_________________
Venkataramana
-- Good judgement comes from experience, and often experience comes from bad judgement.
Back to top
View user's profile Send private message
mallu
Beginner


Joined: 13 Jun 2005
Posts: 3
Topics: 2

PostPosted: Thu Jun 16, 2005 3:11 pm    Post subject: Reply with quote

Thank You Alain
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