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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: compare field A from file one against field B from file two
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: 1703
Location: Australia

PostPosted: Thu Mar 05, 2009 6:00 am    Post subject:
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 Moderator


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

PostPosted: Thu Mar 05, 2009 6:32 am    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Sat Mar 07, 2009 9:47 pm    Post subject:
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    Post subject:
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    Post subject:
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

http://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    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 Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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