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
 

 

Edit a record in File1 if KEY present in File2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Edit a record in File1 if KEY present in File2
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    Post subject: Re: Edit a record in File1 if KEY present in File2
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    Post subject: Reply to: Edit a record in File1 if KEY present in File2
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    Post subject:
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    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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
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 Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts Edit large number of datasets (QSAM) zh_lad TSO/ISPF 3 Tue Apr 04, 2017 6:08 pm


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