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
 

 

Replacing records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Wed Jun 10, 2009 8:35 pm    Post subject: Replacing records
Reply with quote

Hi All,

Can we replace records of a file with the other file records using sort?

Let us say my file A is of 5000 length and its VB file and it is having records like this, Starting at 11th byte, 5 bytes are my key

File A
1111111111AAAAA11111111111111111111111111111111111
2222222222AAAAA22222222222222222222222222222222222
3333333333AAAAA33333333333333333333333333333333333
4444444444AAAAA44444444444444444444444444444444444
1111111111BBBBB11111111111111111111111111111111111
2222222222BBBBB22222222222222222222222222222222222
3333333333BBBBB33333333333333333333333333333333333
4444444444BBBBB44444444444444444444444444444444444
1111111111CCCCC11111111111111111111111111111111111
2222222222CCCCC22222222222222222222222222222222222
3333333333CCCCC33333333333333333333333333333333333
4444444444CCCCC44444444444444444444444444444444444
1111111111DDDDD11111111111111111111111111111111111
2222222222DDDDD22222222222222222222222222222222222
3333333333DDDDD33333333333333333333333333333333333
4444444444DDDDD44444444444444444444444444444444444

FileB
1111111111AAAAA11111111111111111111111111111111111
4444444444AAAAA44444444444444444444444444444444444
1111111111CCCCC11111111111111111111111111111111111
3333333333CCCCC33333333333333333333333333333333333

Output should be
1111111111AAAAA11111111111111111111111111111111111
4444444444AAAAA44444444444444444444444444444444444
1111111111BBBBB11111111111111111111111111111111111
2222222222BBBBB22222222222222222222222222222222222
3333333333BBBBB33333333333333333333333333333333333
4444444444BBBBB44444444444444444444444444444444444
1111111111CCCCC11111111111111111111111111111111111
3333333333CCCCC33333333333333333333333333333333333
1111111111DDDDD11111111111111111111111111111111111
2222222222DDDDD22222222222222222222222222222222222
3333333333DDDDD33333333333333333333333333333333333
4444444444DDDDD44444444444444444444444444444444444

Which means FILE A is having 4 records with a key AAAAA and 4 records with key CCCCC but FILE B is having only two records with those keys, FileA four records of Key AAAAA and CCCCC needs to be overwritten by FILEB two records of key AAAAA and CCCCC. This count is not fixed....record count may be anything....but File A records of a perticular Key should be overwritten by FILEB records of perticualr Key
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: Wed Jun 10, 2009 10:59 pm    Post subject:
Reply with quote

I think I know what you want to do, but since you used some of the same records in File A and File B (e.g. the first record in each file is exactly the same), it's a bit difficult to verify that. Could you please show an example with different records in FileA and FileB and the output records you expect.

Also, you say for FileA the RECFM=VB and LRECL=5000. What is the RECFM and LRECL for FileB?

What is the approx number of unique keys in FileB? 100, 1000, 5000, more?
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Thu Jun 11, 2009 8:42 am    Post subject:
Reply with quote

Quote:
think I know what you want to do, but since you used some of the same records in File A and File B (e.g. the first record in each file is exactly the same), it's a bit difficult to verify that. Could you please show an example with different records in FileA and FileB and the output records you expect.


First record or any record data may be same or different..that is why i gave you some generic values as examples, if you need different example that can be like this

File A
1111111111AAAAA11111111111111111111111111111111111
2222222222AAAAA22222222222222222222222222222222222
3333333333AAAAA33333333333333333333333333333333333
4444444444AAAAA44444444444444444444444444444444444
1111111111BBBBB11111111111111111111111111111111111
2222222222BBBBB22222222222222222222222222222222222
3333333333BBBBB33333333333333333333333333333333333
4444444444BBBBB44444444444444444444444444444444444
1111111111CCCCC11111111111111111111111111111111111
2222222222CCCCC22222222222222222222222222222222222
3333333333CCCCC33333333333333333333333333333333333
4444444444CCCCC44444444444444444444444444444444444
1111111111DDDDD11111111111111111111111111111111111
2222222222DDDDD22222222222222222222222222222222222
3333333333DDDDD33333333333333333333333333333333333
4444444444DDDDD44444444444444444444444444444444444

FileB
5555555555AAAAA55555555555555555555555555555555555
6666666666AAAAA66666666666666666666666666666666666
7777777777CCCCC7777777777777777777777777777777777
8888888888CCCCC8888888888888888888888888888888888

Output should be
5555555555AAAAA55555555555555555555555555555555555
6666666666AAAAA66666666666666666666666666666666666
1111111111BBBBB11111111111111111111111111111111111
2222222222BBBBB22222222222222222222222222222222222
3333333333BBBBB33333333333333333333333333333333333
4444444444BBBBB44444444444444444444444444444444444
7777777777CCCCC7777777777777777777777777777777777
8888888888CCCCC8888888888888888888888888888888888
1111111111DDDDD11111111111111111111111111111111111
2222222222DDDDD22222222222222222222222222222222222
3333333333DDDDD33333333333333333333333333333333333
4444444444DDDDD44444444444444444444444444444444444

Quote:
Also, you say for FileA the RECFM=VB and LRECL=5000. What is the RECFM and LRECL for FileB?


File B also same RECFM=VB and LRECL=5000

Quote:
What is the approx number of unique keys in FileB? 100, 1000, 5000, more?


There no specific value for this, this can be anything...100,1000,5000 or more
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Mon Jun 15, 2009 10:54 am    Post subject:
Reply with quote

Seems like only program is the solution for this........????
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Mon Jun 15, 2009 12:02 pm    Post subject:
Reply with quote

Hi,

I think this can be achieved by sort using JOINKEYS. I am looking into this, once i come up with a solution, i will let you know.
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Mon Jun 15, 2009 2:05 pm    Post subject:
Reply with quote

Hi,

I tried the following code with some sample data, also i used the record length as 15 for testing instead 5000 as mentioned by you. The Key position starts from offset 6 and is of length 5. Change the code to have record length of 5000 and test with your sample data.
Let me know how it works.

Input:

Code:
File A
11111aaaaa00100
11111aaaaa00200
11111aaaaa00300
22222bbbbb00400
33333ccccc00500
33333ccccc00600

File B
33333aaaaa00000
44444aaaaa00100 
55555ccccc00200
66666ddddd00300   

//STEP1       EXEC  PGM=SORT                           
//SYSUDUMP DD SYSOUT=*                               
//SYSOUT   DD SYSOUT=*                               
//SYSSRT   DD SYSOUT=*                               
//SORTJNF1 DD DSN=IDxxx.SORT.FIL1,DISP=SHR         
//SORTJNF2 DD DSN=IDxxx.SORT.FIL2,DISP=SHR         
//SORTOUT  DD  DSN=IDxxx.SORT.FIL3,                 
//             DISP=(NEW,CATLG,DELETE),               
//             SPACE=(TRK,(10,5),RLSE),               
//             DCB=(RECFM=vB,LRECL=15,BLKSIZE=0)     
//SYSIN       DD   *                                 
  JOINKEYS FILE=F1,FIELDS=(6,5,A),                   
                 SORTED                               
  JOINKEYS FILE=F2,FIELDS=(6,5,A),                   
                 SORTED                               
  JOIN UNPAIRED,F1                                   
  REFORMAT FIELDS=(F2:1,15,F1:1,15),FILL=X'FF'       
  SORT FIELDS=(1,15,CH,A) 
   OUTFIL IFTHEN=(WHEN=(1,1,BI,EQ,X'FF'),BUILD=(1:16,15)),     
            IFTHEN=(WHEN=NONE,BUILD=(1:1,15))                 
  SUM FIELDS=NONE                                             
/*   


Output:

Code:
33333aaaaa00000
44444aaaaa00100
55555ccccc00200
22222bbbbb00400
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Mon Jun 15, 2009 6:44 pm    Post subject:
Reply with quote

Murugan,

Thanks for the reply

But this seems to be attaching the records at top for the keys which are present in FILE A & FILE B

This is not the actual requirement. I need o/p as below from u r example

33333aaaaa00000
44444aaaaa00100
22222bbbbb00400
55555ccccc00200
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Mon Jun 15, 2009 7:07 pm    Post subject:
Reply with quote

Hi,

See, i have joined records from both the files based on the key and
reformatted the output file to replace the records in file1 for which there
is a matching record in file 2 based on the key value.Also the output file
contains unpaired records from file1.

I have tested the above code and got the result which i have mentioned
in the output which is

33333aaaaa00000
44444aaaaa00100
22222bbbbb00400
55555ccccc00200

Have you tried this code? Just execute the above code with the sample data which i have used for file A & file B

If i misunderstood your requirement, could you explain me in detail.
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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