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

Compare and copy


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

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Thu Jun 23, 2011 7:57 pm
Reply with quote

I have two files of FB 250 , RT is record type

File 1
RT DATA NUM PHONE
Code:

1   Kiran                                                      12345    04012345678
2   address                                                    12345    04012345678
3   salary details                                             12345    04012345678
4   extra information                                          12345    04012345678
1   Rahul                                                      12346    04012345679     
2   address                                                    12346    04012345679   
3   salary details                                             12346    04012345679   
1   Hima                                                       12347    04012345670
2   address                                                    12347    04012345670
3   salary details                                             12347    04012345670
4   extra information                                          12347    04012345670


File 2
Code:
1   Kiran             
2   address             
3   salary details         
4   extra information           
1   Rahul           
2   address         
3   salary details       
1   Hima     
2   address       
3   salary details       
4   extra information     


I need to compare these two files based on File1 : record type 1 which is in 1st position and Name which is in 4th position with File2 : record type 1 whcih is in 1st position and Name which is in 4th position and copy FILE1 NUM which at position 146 of 5 bytes and Phone which is at 153 of 11 bytes to new file along with file2 data.

My output should looke like

Code:
NUM :12345    PHONE:04012345678
1   Kiran             
2   address             
3   salary details         
4   extra information
NUM :12346    PHONE:04012345679
1   Rahul           
2   address         
3   salary details       
NUM :12346    PHONE:04012345670
1   Hima     
2   address       
3   salary details       
4   extra information
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Jun 23, 2011 9:28 pm
Reply with quote

Hima1985,
With some assumptions..See if this helps..
Code:
//STEP0001     EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                                 
//SORTJNF1 DD DISP=SHR,DSN=INPUT FILE1                                 
//SORTJNF2 DD DISP=SHR,DSN=INPUT FILE2                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  JOINKEYS FILES=F1,FIELDS=(01,01,A,04,60,A,251,8,A)                   
  JOINKEYS FILES=F2,FIELDS=(01,01,A,04,60,A,251,8,A)                   
  JOIN UNPAIRED,F2                                                     
  REFORMAT FIELDS=(F1:01,64,F1:146,05,F1:153,11)                       
  SORT FIELDS=(65,05,ZD,A,70,11,ZD,A),EQUALS                           
  OUTFIL REMOVECC,BUILD=(1,64),                                         
                  SECTIONS=(65,05,70,11,                               
                            HEADER3=('NUM :',65,05,4X,'PHONE:',70,11)) 
/*                                                                     
//JNF1CNTL DD *                                                         
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,ZD,EQ,1),                         
                          PUSH=(251:ID=8))                             
//*                                                                     
//JNF2CNTL DD *                                                         
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,ZD,EQ,1),                         
                          PUSH=(251:ID=8))                             
//*                                                                     

OUTPUT
Code:
NUM :12345    PHONE:04012345678
1  Kiran                       
2  address                     
3  salary details             
4  extra information           
NUM :12346    PHONE:04012345679
1  Rahul                       
2  address                     
3  salary details             
NUM :12347    PHONE:04012345670
1  Hima                       
2  address                     
3  salary details             
4  extra information           

Thanks,
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 24, 2011 4:01 pm
Reply with quote

Here is the error i am getting.

Code:
ERROR IN JNF1 PROCESSING             
JNF1 STATISTICS                       
NO KEYWORDS FOUND ON CONTROL STATEMENT
Back to top
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Fri Jun 24, 2011 4:07 pm
Reply with quote

Please post the jcl you are using.
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 24, 2011 4:14 pm
Reply with quote

Dave,

Same one which SQLCODE1 suggested.
Back to top
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Fri Jun 24, 2011 4:18 pm
Reply with quote

I am sure sqlcode1 must have tested the jcl before posting, are you sure you have not messed with the DD names or control card names.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jun 24, 2011 4:20 pm
Reply with quote

you left off the message numbers.

are they WER or ICE messages?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Jun 24, 2011 4:27 pm
Reply with quote

I think you dont have DFSORT installed.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jun 24, 2011 5:21 pm
Reply with quote

Hima1985,
Refer to this post and message. it is from syncsort.

ibmmainframes.com/archive/o_t__t_51085__sort-capacity-exceeding-probelm..html

WER486A  ERROR IN JNF1 PROCESSING

However, this may still be possible without joinkeys. Please answer or clarify below assumptions.

I see that for each new phone number in file 1, seq number resets to 1. Is that always true? Are you always going to have 1 to 1 match between 2 file meaning 1st record of first phone number group goes with first record of file2's first group?

P.S. The solution posted above works for dfsort and is tested.

Thanks,
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 24, 2011 5:59 pm
Reply with quote

SQLCODE,

Thanks You, I am getting WER error messages.

Let me explain you the requirement.

File1 have records with record tyeps 1,2,3,4,...etc as well file2 have records with record type 1,2,3,4,5,...etc

we need to copare file1 record type and name associated that record type with file recodd type and name associated with it. record type 1 is always represents name record.

if file1 record type1 name and file2 recordtype1 name matches we need to copy file2 data to output file along with some values from file1 as i mentioned in my first post

file1
RT Name num phno
1 srinu 12345 04012345678

File2
RT name
1 srinu

output
NUM:12345 phno:04012345678
1 srinu

this is what i am expecting.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Jun 24, 2011 6:44 pm
Reply with quote

Quote:
Thanks You, I am getting WER error messages.


WER messages are from SYNCSORT - you should post questions about SYNCSORT in the JCL forum.

Garry.
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 24, 2011 6:56 pm
Reply with quote

Gary,

I have both the products in my shop, DFSORT solution also helps me in solving my problem as i can use DFSORT also.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jun 24, 2011 7:24 pm
Reply with quote

Hima1985,
Use this link to identify your DFSort function level and post appropriate DFSort messages.

ibmmainframes.com/viewtopic.php?t=33389

Thanks,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Jun 24, 2011 10:40 pm
Reply with quote

Quote:
I have both the products in my shop, DFSORT solution also helps me in solving my problem as i can use DFSORT also.


Hima1985,

sqlcode1 gave you a solution that works with DFSORT providing you have the JOINKEYS PTF which has been available since November, 2009. You came back saying that it didn't work with Syncsort which makes sense since DFSORT supports JOINKEYS options that Syncsort doesn't support.

Then you came back saying you have both products but you didn't say if you tried sqlcode1's solution with DFSORT. Did you? If so, what were the results? If it didn't work, show the complete JES log for the DFSORT run including all of the ICExxxs messages.
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 24, 2011 11:59 pm
Reply with quote

Frank,

Oh sorry, just forgot to post that, just tested with DFSORT, it worked like charm. Thanks to sqlcode.

But just curious how can this be achieved with out joinkey? Is it possible?

Thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Jun 25, 2011 12:14 am
Reply with quote

Quote:
But just curious how can this be achieved with out joinkey? Is it possible?


TRANSLATION: give me a syncsort solutionl
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Sat Jun 25, 2011 4:00 am
Reply with quote

Hima1985,
Because you still haven't answered all the questions,I wouldn't be surprised if you come back and inform that the solution isn't working!!!

Thanks,
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Sat Jun 25, 2011 9:17 am
Reply with quote

Dick Brenholtz,
Thanks for the translation icon_smile.gif good one , other people in group might have made you to think like that with their posts before, but its not the case with me. Jfyi: I can post this in syncsort link if I want syncsort solution lol
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jun 25, 2011 10:42 am
Reply with quote

Hello,

You have been given a dfsort solution.

Why do you think it appropriate to ask for another?

Maybe there is something i misunderstand icon_confused.gif

d
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Jun 27, 2011 3:25 am
Reply with quote

Hima1985,
See if below works. Below is the content of TEST.FB250DM which is 250 bytes/FB file.
Code:
$$$

I don't have syncsort documentation and hence I don't really know if the solution mentioned is supported or not with your Syncsort function level but I really "hope" it should work for your requirement.
Code:
//STEP0001     EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DISP=SHR,DSN=TEST.FB250DM                       
//         DD DISP=SHR,DSN=TEST.FB25001     --> file1                 
//         DD DISP=SHR,DSN=TEST.FB250DM                       
//         DD DISP=SHR,DSN=TEST.FB25002     --> file2                 
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(251:ID=1)), 
       IFTHEN=(WHEN=GROUP,BEGIN=(1,1,ZD,EQ,1),                       
                           END=(1,1,ZD,EQ,4),PUSH=(252:4,30))         
 SORT FIELDS=(252,30,CH,A),EQUALS                                     
 OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(283:SEQNUM,8,ZD,RESTART=(252,30))),
        IFTHEN=(WHEN=GROUP,BEGIN=(283,8,ZD,EQ,1),                     
                            PUSH=(291:146,5,296:153,11))             
  OUTFIL BUILD=(1,31,132:X),                                         
  INCLUDE=(251,1,ZD,EQ,2,AND,1,3,CH,NE,C'$$$'),                       
         SECTIONS=(291,16,                                           
         HEADER3=('NUM :',291,05,4X,'PHONE:',296,11,132:X))           
/*                                                                   

OUTPUT
Code:
NUM :12347    PHONE:04012345670
1  Hima                       
2  address                     
3  salary details             
4  extra information           
NUM :12345    PHONE:04012345678
1  Kiran                       
2  address                     
3  salary details             
4  extra information           
NUM :12346    PHONE:04012345679
1  Rahul                       
2  address                     
3  salary details             

Thanks,
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Need COBOL COPY Help in MVS Environment COBOL Programming 4
Search our Forums:

Back to Top