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
 

 

Compare and copy

 
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: Thu Jun 23, 2011 7:57 pm    Post subject: Compare and copy
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: 578
Location: USA

PostPosted: Thu Jun 23, 2011 9:28 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 578
Location: USA

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

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

http://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    Post subject:
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

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Jun 24, 2011 6:44 pm    Post subject:
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    Post subject:
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: 578
Location: USA

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

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

http://ibmmainframes.com/viewtopic.php?t=33389

Thanks,
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: Fri Jun 24, 2011 10:40 pm    Post subject:
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    Post subject:
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    Post subject:
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: 578
Location: USA

PostPosted: Sat Jun 25, 2011 4:00 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sat Jun 25, 2011 10:42 am    Post subject:
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: 578
Location: USA

PostPosted: Mon Jun 27, 2011 3:25 am    Post subject:
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    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 syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts COMPARE command sivatechdrive TSO/ISPF 7 Fri Sep 16, 2016 4:31 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


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