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
 

 

JOINs in SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
pratiksha
Warnings : 1

New User


Joined: 10 Feb 2006
Posts: 10
Location: Bangalore

PostPosted: Tue May 27, 2008 5:30 pm    Post subject: JOINs in SYNCSORT
Reply with quote

Hi,

I need help in joining 2 files, Can anyone help me out...


I have 2 files,

1 file is as follows..lrec=96

10000000000000000000000000000000000000000000000000000000000000000000000000000000
20000000000000000000000000000000000000000000000000000000000000000000000000000000
30033333333333333333333300330000000000000000000000000000000000000000000000000000
40044444444444444444444444440000000000000000000000000000000000000000000000000000
60000000000000000000000000000000000000000000000000000000000000000000000000000000

2nd file is as below, lrec=96

10000000000000000000KK0000000000000000000000000000000000000000000000000000000000
20000000000000000000KK0000000000000000000000000000000000000000000000000000000000
30000000000000000000KK0000000000000000000000000000000000000000000000000000000000
40000000000000000000KK0000000000000000000000000000000000000000000000000000000000

The first three field are key fildes...

I want the output file such that

1 to 3rd position i want the key.From 4th to 96th position i want the data which is present in the file 2 where ever the keys match. If there is no match then 1 to 96 position should be same as in file 1.
Can u tell me if it is possible using sort...

tried out this

//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,3,A)
JOINKEYS FILES=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,F1,F1
REFORMAT FIELDS=(F1:1,3,F2:4,96)
SORT FIELDS=COPY


But the keys which dont match they get only first three positions. rest is blank. I want that to be same as in File 1.

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

sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Tue May 27, 2008 6:13 pm    Post subject:
Reply with quote

Pratiksha,
If your second file is always going to have 'KK' ,then the following will work for you.Else,we need to go for some other solution.

Code:


//PS020    EXEC PGM=SYNCTOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//CTL1JNF1 DD *                                                         
10000000000000000000000000000000000000000000000000000000000000000000000A
20000000000000000000000000000000000000000000000000000000000000000000000B
30033333333333333333333300330000000000000000000000000000000000000000000C
40044444444444444444444444440000000000000000000000000000000000000000000D
60000000000000000000000000000000000000000000000000000000000000000000000E
//CTL1JNF2 DD *                                                         
10000000000000000000KK00000000000000000000000000000000000000000000000000
20000000000000000000KK00000000000000000000000000000000000000000000000000
30000000000000000000KK00000000000000000000000000000000000000000000000000
40000000000000000000KK00000000000000000000000000000000000000000000000000
//CTL1OF01 DD DSN=xxx.xxxx.xxx.S.T2,                                 
//            DISP=(,CATLG,DELETE),                                     
//            UNIT=Sysdk,                                               
//            SPACE=(CYL,(55,55),RLSE)                                 
//TOOLIN    DD *                                                       
  SORT FROM(CTL1JNF1) USING(CTL1)                                       
//CTL1CNTL  DD *                                                       
  JOINKEYS FILES=F1,FIELDS=(1,3,A)                                     
  JOINKEYS FILES=F2,FIELDS=(1,3,A)                                     
  JOIN UNPAIRED,F1                                                     
  REFORMAT FIELDS=(F1:1,20,F2:21,2,F1:23,55)                           
  SORT FIELDS=COPY                                                     
  OUTFIL FILES=01,OUTREC=1,20,C'KK',23,55)                                                         


Note : You need to change the position(s) as per your file structure.

Thanks
Krishy
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Tue May 27, 2008 6:17 pm    Post subject:
Reply with quote

Try this. I tested this with lrecl as 80 just change the lrecl according to your requirements.

Code:

OPTION COPY                                         
JOINKEYS FILES=F1,FIELDS=(1,3,A)                     
JOINKEYS FILES=F2,FIELDS=(1,3,A)                     
JOIN UNPAIRED,F1                                     
REFORMAT FIELDS=(F1:1,80,F2:1,80)                   
OUTFIL FNAMES=MYOUT                                 
OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,81,3,CH),             
                  BUILD=(1,3,84,76)),               
       IFTHEN=(WHEN=(1,3,CH,NE,81,3,CH),             
                  BUILD=(1,80))       
               
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Tue May 27, 2008 6:21 pm    Post subject:
Reply with quote

Sorry,I mis understood your requirement.The above won't work as per your requirement.

Thanks
Krishy
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: Tue May 27, 2008 11:13 pm    Post subject: Reply to: JOINs in SYNCSORT
Reply with quote

Hello Krishy,

Would you prefer your 2 posts (and your reply to this) be removed ?

I can do this at no extra charge icon_smile.gif

d
Back to top
View user's profile Send private message
pratiksha
Warnings : 1

New User


Joined: 10 Feb 2006
Posts: 10
Location: Bangalore

PostPosted: Wed May 28, 2008 3:06 pm    Post subject: Reply to: JOINs in SYNCSORT
Reply with quote

Hi,


The solution provided worked for me Manuneedhi. Thanku so much. Can we join files having more than 1 keys also in the files???

Thanks & Regads,
Pratiksha
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed May 28, 2008 3:10 pm    Post subject:
Reply with quote

You are welcome.

AFAIK You can join more than one keys all you need is to change the FIELDS in the JOINKEYS accordingly.

Thanks
Manu
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm


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