How to compare a filed of file1 with values in file2



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

How to compare a filed of file1 with values in file2

Postby lakshmipathik » Sat Apr 06, 2013 12:37 am

Hi,
I have a file 1 with data like below
Name code ind  CT
------  ----- ---   ---
aaa     123  N    ijk
bbb     234  y     lmn
ccc     125  n     opq


I have a file2 with data like below
ind  Min   Max  CT
---- ----   -----  ----
N   100    125   iii
Y    126   190   jjj
N   191    250  kkk


output file should like this: (i.e. CODE value in file1 should compare with 'Min' and 'Max' values of file2 and if it falls in that range, CT value from file2 should be taken and replace in CT value of file1)
Name code ind  CT
------  ----- ---   ---
aaa     123  N    iii
bbb     234  y     kkk
ccc     125  n     iii


please let me know if it can be possible using sort...

Code'd
lakshmipathik
 
Posts: 12
Joined: Thu May 08, 2008 11:14 am
Location: bangalore
Has thanked: 5 times
Been thanked: 0 time

Re: How to compare a filed of file1 with values in file2

 

Re: How to compare a filed of file1 with values in file2

Postby enrico-sorichetti » Sat Apr 06, 2013 1:09 am

this forum has two sections dedicated to <sort>

one for IBM DFSORT ( ICE.... messages )
another one for SYNCSORT ( WER..... messages )

everywhere on the net good manners dictate to post into the proper section
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: How to compare a filed of file1 with values in file2

Postby BillyBoyo » Sat Apr 06, 2013 2:14 am

If you tell us which Sort product you have, the topic will be moved to the appropriate part of the forum.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to compare a filed of file1 with values in file2

Postby lakshmipathik » Sat Apr 06, 2013 2:16 am

Hi,
we have DFSORT.

Thanks.
lakshmipathik
 
Posts: 12
Joined: Thu May 08, 2008 11:14 am
Location: bangalore
Has thanked: 5 times
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post