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

Compare two fields in different files


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

New User


Joined: 10 Jan 2008
Posts: 36
Location: CHINA

PostPosted: Sun May 04, 2008 8:46 am
Reply with quote

I have two files A and B.
A has only one record.the key field is date from position 8 to 17
Code:
 ----+----1----+----2----+----3----+----4----+--
 *****************************
 affdfdffdfdfdf2008-03-01abcddfee                               
 *******************************

B has many records. the key field is from positon 1.

Code:
  ----+----1----+----2----+----3
*****************************
  2007-10-04fa34124fadsf       
  2008-02-05fa44312fadsf       
  2008-01-08fad34132adsf       
  2008-02-15fa3241234fadff     
  2008-08-11fad41dsfadsf       
  2008-05-01fa341234adsf       
  2008-05-03fadeqwefadsf       
  2008-06-04fad34df234324       
  2008-03-07fae33455545f       
  2008-08-07faf34dsfadsf       
  2008-05-18fad3423434sf       


I want to extract the records from B whose date field is greater than A.

Thanks in advance.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun May 04, 2008 9:19 am
Reply with quote

What are the record lengths and formats (Fix or Variable) of the two files?
Back to top
View user's profile Send private message
Absinthia

New User


Joined: 10 Jan 2008
Posts: 36
Location: CHINA

PostPosted: Sun May 04, 2008 10:24 am
Reply with quote

the records of both files are LRECL=80,RECFM=FB
Craq Giegerich wrote:
What are the record lengths and formats (Fix or Variable) of the two files?
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: Sun May 04, 2008 11:20 pm
Reply with quote

In your example, the date field in file1 doesn't appear to start in position 8, but assuming it actually does, you can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *      input file1
adfdfdf2008-03-01abcddfee
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'TDATE,''',8,10,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *     input file2
2007-10-04fa34124fadsf
2008-02-05fa44312fadsf
2008-01-08fad34132adsf
2008-02-15fa3241234fadff
2008-08-11fad41dsfadsf
2008-05-01fa341234adsf
2008-05-03fadeqwefadsf
2008-06-04fad34df234324
2008-03-07fae33455545f
2008-08-07faf34dsfadsf
2008-05-18fad3423434sf
/*
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,10,CH,GT,TDATE)
/*
Back to top
View user's profile Send private message
Absinthia

New User


Joined: 10 Jan 2008
Posts: 36
Location: CHINA

PostPosted: Mon May 05, 2008 7:27 am
Reply with quote

Frank Yaeger,
thanks a lot,it works. icon_biggrin.gif
Back to top
View user's profile Send private message
harishch_ch

New User


Joined: 07 Jan 2008
Posts: 27
Location: bangalore

PostPosted: Mon May 05, 2008 6:37 pm
Reply with quote

I am receiving Syntax error for INREC statement,
can some one solve it?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 05, 2008 6:51 pm
Reply with quote

no, sorry. The 'guess what this means' department is closed for today!

ask again tomorrow, and be sure to post your question to existing topics to as to confuse forum members and insure that you only get flammed and receive little or no answers to your open-ended, ambiguous, non-sensical questions.
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: Mon May 05, 2008 9:00 pm
Reply with quote

Quote:
I am receiving Syntax error for INREC statement,


Harish,

Is that for the INREC statement shown in THIS thread or for some totally different INREC statement?

You need to show the job and control statements you used, and the DFSORT messages you received in //SYSOUT before anyone can have a clue to what you're talking about. We can't read your mind or look over your shoulder.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon May 05, 2008 10:47 pm
Reply with quote

Hi,
harishch_ch wrote:
I am receiving Syntax error for INREC statement,
I would guess You are not using DFSORT and even if SyncSort then release 1.3 definitions are not availble at Your shop. Support for symname symbolics was included in SyncSort for z/OS 1.3.

Please check the SYSOUT of recently submitted SORT JOB, if You get ICEXXX messages, you are using DFSORT & if messages are of type WERXXX, you are using SyncSort.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top