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

Edit a record in File1 if KEY present in File2


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

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 30, 2013 1:08 am
Reply with quote

Hi All,

Have mentioned my requirement below. Its not really necessary to do this using DFSORT but I am thinking this could be done using JOINKEY. Please correct me if my understanding is wrong and if possible then how to get this done using JOINKEY.

File1 (Variable file) has some detailed information which needs to be put into the extract.
A field in the record to be set as 'Y' if
1. If the KEY in File1 is available in File2 (Variable file)
2. If value in 55 pos is 'XX'
The output extract (Variable file) hence would have the same no. of records as in File1 and some of records would have to be edited if the above conditions are satisfied.

File1
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
XXX     111111111     XXXXXXXXXX  20130419.. ±....           SYS     XXXX
XXX     222222222     XXXXXXXXXX  20130419.. ±....    EA     SYS     XXXX
XXX     333333333     XXXXXXXXXX  20130419.. ±....    NA     SYS     XXXX
XXX     444444444     XXXXXXXXXX  20130419.. ±....           SYS     XXXX


File2
Code:
----+----1----+----2----+----3----+----4
..P.222222222 000.NORTH00.Ì0000000....00
.*P.333333333 000.HOGAN00.Ì2000000....00


Output
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
XXX     111111111     XXXXXXXXXX  20130419.. ±....           SYS     XXXX
XXX     222222222     XXXXXXXXXX  20130419.. ±....    EA     SYS     XXXX Y
XXX     333333333     XXXXXXXXXX  20130419.. ±....    NA     SYS     XXXX
XXX     444444444     XXXXXXXXXX  20130419.. ±....           SYS     XXXX


This is what I have tried so far...
Code:
//SORT     EXEC  PGM=SORT                                   
//SORTJNF1 DD  DISP=SHR,DSN=File1
//SORTJNF2 DD  DISP=OLD,DSN=File2                       
//SORTOUT  DD  DSN=Output,             
//  DISP=(NEW,CATLG),UNIT=SYSDA,DCB=(LRECL=1124,RECFM=VB)   
//SYSOUT   DD  SYSOUT=*                                     
//SYSPRINT DD  SYSOUT=*                                     
//SYSIN    DD  *                                           
  JOINKEYS FILE=F1,FIELDS=(13,9,A)                   
  JOINKEYS FILE=F2,FIELDS=(9,9,A)                   
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:5)                                   
  OPTION COPY                                               
  OUTFIL FNAMES=SORTOUT,IFTHEN=(WHEN=(59,2,CH,EQ,C'EA'),   
     OVERLAY=(79:C'Y'))                                   
//                                                         

I am facing multiple issues ..
1. First I am not able to get the REFORMAT card correctly because of the variable length. Gives me a SYNTAX error with the current one as mentioned above. I am able to get an output file if I make the output file a FB
2. Not sure how to give the condition. I want all the records from File1.

Please do let me know if I have missed to give or if I need to give more information...
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 30, 2013 3:12 am
Reply with quote

Binop B wrote:
2. If value in 55 pos is 'XX'
Ooops.. this is 'EA'
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Apr 30, 2013 3:27 am
Reply with quote

use the following control cards which will give you the desired results

Code:

//SYSIN    DD *                                             
  OPTION COPY                                               
  JOINKEYS F1=INA,FIELDS=(13,9,A)                           
  JOINKEYS F2=INB,FIELDS=(09,9,A)                           
  JOIN UNPAIRED,F1                                         
  REFORMAT FIELDS=(F1:1,4,?,F1:5)         
                 
  INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'B',AND,60,2,CH,EQ,C'EA'),
  OVERLAY=(80:C'Y'))                                       

  OUTREC BUILD=(1,4,6)                                     
//*
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 30, 2013 8:57 pm
Reply with quote

Hi Skolusu,

Thanks a ton... I was able to build the output file as required... Thanks again... icon_biggrin.gif
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 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top