IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

compare field A from file one against field B from file two


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rally

New User


Joined: 28 Jul 2005
Posts: 37

PostPosted: Thu Mar 05, 2009 5:17 am
Reply with quote

Hi,

I have 2 files (file one and two).

File One

Filed A (date)
20030101xxxx
20050401xxxx
20090501xxxx
20080401xxxx
20090101xxxx

File B

File B (date)
20080101aaaaaaaaaaaaaaaa

What I want to compare date from File one against date B from file two.
Below is the expeted output:
20090501xxxx
20080401xxxx
20090101xxxx

That is to say, the records in file one with date A > date B in file two
need write to output file.

I think DFSORT should can do this, but I cannot think over the solution...
Please help advise.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Mar 05, 2009 6:00 am
Reply with quote

Hi,

this might help
Code:
//STEP010  EXEC PGM=SORT                                               
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
20080101AAAAAAAAAAAAAAAA                                               
/*                                                                     
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)       
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION COPY                                                           
* CREATE DFSORT SYMBOL AS:                                             
* YYMMDD,20080101                                                       
  OUTFIL FNAMES=SORTOUT,                                               
  BUILD=(C'YYYYMMDD,''',1,8,C'''',80:X)
/*                               
//STEP020   EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SYMNAMES DD DSN=&&S1,DISP=SHR                                         
//SORTIN   DD *                                                         
20030101XXXX                                                           
20050401XXXX                                                           
20090501XXXX                                                           
20080401XXXX                             
20090101XXXX 
/*                           
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                         
  SORT FIELDS=COPY                       
  INCLUDE COND=(01,8,BI,GT,YYYYMMDD)     
/*



Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 05, 2009 6:32 am
Reply with quote

A slightly streamlined version:

Code:

//STEP010  EXEC PGM=SORT
//SORTIN   DD *
20080101aaaaaaaaaaaaaaaa
/*
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
* CREATE DFSORT SYMBOL AS:
* MYDATE,20080101
  INREC BUILD=(C'MYDATE,''',1,8,C'''',80:X)
/*
//STEP020   EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN   DD *
20030101xxxx
20050401xxxx
20090501xxxx
20080401xxxx
20090101xxxx
/*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INCLUDE COND=(1,8,CH,GT,MYDATE)
/*
Back to top
View user's profile Send private message
rally

New User


Joined: 28 Jul 2005
Posts: 37

PostPosted: Fri Mar 06, 2009 5:05 am
Reply with quote

Thanks, this is very helpful for my job.
Back to top
View user's profile Send private message
rally

New User


Joined: 28 Jul 2005
Posts: 37

PostPosted: Sat Mar 07, 2009 8:13 pm
Reply with quote

Frank,

Can we pass 2 fields from file one and compared in file two?

200801019999bbbb

INREC BUILD=(C'MYDATE,''',1,8,C'''',80:X)

We pass 2008080101 into MYDATE,
can we pass 9999 also in the same step to next step?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Mar 07, 2009 9:47 pm
Reply with quote

Sure. You just need to use OUTFIL with / instead of INREC like this:

Code:

//STEP010  EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN   DD *
200801019999bbbb
/*
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  OUTFIL BUILD=(C'MYDATE,''',1,8,C'''',80:X,/,
     C'SYM2,''',9,4,C'''')
/*


&&S1 will have:

Code:

MYDATE,'20080101'
SYM2,'9999'     


Include &&S1 for SYMNAMES in the next step and you can use the MYDATE and SYM2 symbols there.
Back to top
View user's profile Send private message
rally

New User


Joined: 28 Jul 2005
Posts: 37

PostPosted: Fri Mar 13, 2009 8:23 pm
Reply with quote

Let's say MYDATE is '20080101' and SYM2 is 0012.
How can we use these two sysnames to get new date.
for example, how to compute MYDATE + sym2?

By the way, is there any possible to convert CCYYMMDD to julian date use DFSORT only? Thanks.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Mar 13, 2009 10:08 pm
Reply with quote

rally wrote:
Let's say MYDATE is '20080101' and SYM2 is 0012.
How can we use these two sysnames to get new date.
for example, how to compute MYDATE + sym2?

By the way, is there any possible to convert CCYYMMDD to julian date use DFSORT only? Thanks.


DFSORT has the ability to add days to the current date but not any other date.

Check this link which shows you a way to convert the gregorian date to julian date

ibmmainframes.com/viewtopic.php?p=113841#113841
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top