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
 

 

Comparing File with greater than equal to condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Comparing File with greater than equal to condition
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

Active Member


Joined: 08 May 2006
Posts: 992
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Jan 06, 2011 5:06 pm    Post subject:
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 Moderator


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

PostPosted: Thu Jan 06, 2011 11:38 pm    Post subject:
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    Post subject: Reply to: Comparing File with greater than equal to conditio
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 Moderator


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

PostPosted: Tue Jan 11, 2011 2:47 am    Post subject:
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    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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
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


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