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 two fields in different files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Compare two fields in different files
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Sun May 04, 2008 11:20 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Compare two fields in different files
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: 6967
Location: porcelain throne

PostPosted: Mon May 05, 2008 6:51 pm    Post subject:
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 Moderator


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

PostPosted: Mon May 05, 2008 9:00 pm    Post subject:
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

Senior Member


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

PostPosted: Mon May 05, 2008 10:47 pm    Post subject: Re: Reply to: Compare two fields in different files
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    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 member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am


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