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

Comparing File with greater than equal to condition


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

New User


Joined: 16 Apr 2005
Posts: 33

PostPosted: Thu Jan 06, 2011 4:14 pm
Reply with quote

Hello all,
I have 2 files
file1 of length 80(having 1 record with numeric data from 1to 7byte)
file2 of length 400

I want to compare each record in file2(10-17) with the data in file1(1-7) giving >= condition and data is ZD.if the value in file2 is GE to value from file1 need to write to output file.

Could any one let me know is that possible to do using SORT?

Eg:
File1:
882388

file2
xxxxxxxxx8888888xxx
xxxxxxxxx7777777xxx
xxxxxxxxx9999899xxx

outfile
xxxxxxxxx8888888xxx
xxxxxxxxx9999899xxx


Thanks & Regards,
Bhavya
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Jan 06, 2011 5:06 pm
Reply with quote

One way you might do it is to build a SYMNAMES record from the data in File1 and use this in an INCLUDE statement for processing File2.
Quote:
want to compare each record in file2(10-17) with the data in file1(1-7)

10-17 is a 8-byte field which differs from 1-7 which is a 7-byte field.

Garry.
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 Jan 06, 2011 11:38 pm
Reply with quote

Quote:
I want to compare each record in file2(10-17) with the data in file1(1-7)


If you need more help with this, give the correct positions, or verify that these are the correct positions.

Also, what is the RECFM of the input files?
Back to top
View user's profile Send private message
bhavya_sha

New User


Joined: 16 Apr 2005
Posts: 33

PostPosted: Fri Jan 07, 2011 9:37 am
Reply with quote

File1 of Record length 80
The key length in both file is 7 bytes. i.e, 10-16 in file2.

File2 of Record length 357

File1 data (key 1 -7)
899299 (key 10-16)

File2 data
xxxxxxxxx9999999 xx xxxxxxx xxxxxxx xxxxxxxxxxxxx
xxxxxxxxx8888865 xx xxxxxxx xxxxxxx xxxxxxxxxxxxx
xxxxxxxxx9333444 xx xxxxxxx xxxxxxx xxxxxxxxxxxxx

If key data from file2 >= file1 key i.e, 9999999 >= 899299
write record to output file as below
output file
xxxxxxxxx9999999 xx xxxxxxx xxxxxxx xxxxxxxxxxxxx
xxxxxxxxx9333444 xx xxxxxxx xxxxxxx xxxxxxxxxxxxx

Thanks & Regards,
Bhavya
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: Tue Jan 11, 2011 2:47 am
Reply with quote

Again, you have 6 digits for the key in file1 (899299) and 7 digits for the key in file2 (9999999) - you need to be more careful when giving your requirements. Assuming that the key in file1 really is 7 digits with leading zeros in positions 1-7 (e.g. 8992999 or 0899299), you can use a DFSORT job like the following to do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/80)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(C'F1KEY,+',1,7,80:X)
/*
//S2 EXEC PGM=SORT
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file2 (FB/357)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INCLUDE COND=(10,7,ZD,GE,F1KEY)
/*
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 7
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 Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top