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

SYNCSORT Help


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Fri Jun 03, 2011 11:24 am
Reply with quote

I have 2 PS files.
And I need to create 3rd file with entries which are present in file 1 but not in file 2, using syncsort.

File 1 structure is as below,

Code:

12345678901234567890 <== just the scale
ABCD           1234
               5678
               9233
EFGH           1111
               3333
ABCD           6767



File 2 structure is as below,
Code:

12345678901234567890 <== just the scale
ABCD           1234
ABCD           5678
ABCD           9233
EFGH           1111
EFGH           3333


Is there any way to Sort the first file and create a loop for file 1 to match with file 2?

Expected output is F3:
Code:

12345678901234567890 <== just the scale
ABCD           6767


Both are PS files,
File1 LRECL = 32
File2 LRECL = 80
File3 LRECL = 80

Please let me know if you need any more details.

Thanks in advance.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Fri Jun 03, 2011 11:27 am
Reply with quote

The structure got distorted in the above post icon_sad.gif
FIXED

Column 1 starts at position 1 and column 2 starts are position 16 for both F1 and F2.

I am really sorry for the formatting error.
Back to top
View user's profile Send private message
rmaruri

New User


Joined: 29 Jun 2005
Posts: 13
Location: USA

PostPosted: Mon Jun 06, 2011 7:07 am
Reply with quote

Use SORT JOIN.

Here is the sample. Change it as per the requirement.

JOINKEYS FILES=F1,FIELDS=(1,6,A)
JOINKEYS FILES=F2,FIELDS=(1,6,A)
JOIN UNPAIRED F1,ONLY
REFORMAT FIELDS=(F1:1,6)
SORT FIELDS=COPY
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Mon Jun 06, 2011 5:33 pm
Reply with quote

I was using the same code as suggested but this one gives, along with ABC 6767

5678
9233
3333

comes in the output, but i need only the below entry
ABCD 6767
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 5:59 pm
Reply with quote

I suppose if you don't want the blank keys at all, just OMIT them.

If the blank keys are supposed to inherit the key value of the previous non-blank key, then you'll need to do a bit of tinkering.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Mon Jun 06, 2011 8:36 pm
Reply with quote

Thanks Bill for the reply...
Yes, you got it correct, the blank fields should retain the previous non blank values. Is there any looping facility? or something to keep it stored?

Thanks in advance.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jun 07, 2011 12:10 am
Reply with quote

I don't think there is any "looping" available. I think you can define groups of records such that they can be processed with the key from the first record in the group.

I'd look at the manual Table of Contents and Index. Search this forum. Search the internet. Hope that someone with more specific knowledge than I have picks this up again :-)

Unfortunately, SYNCSORT manuals are not generally available unless you are entitled to one, which I'm not.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Jun 07, 2011 2:22 am
Reply with quote

chatterjesis,

Tried on DFSort but should work on Syncsort. AFAIK, Syncsort doesn't allow "subtasking".
Also,why do you need output with 80 bytes? If you are just selecting unmatched records from file1, shouldn't your output be 32 bytes only?
Code:

//STEP0001     EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DISP=SHR,DSN=YOUR INPUT1 FB32                       
//SORTOUT  DD DISP=(NEW,PASS),DSN=&&T1                           
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                               
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,GT,C' '),PUSH=(1:1,4)) 
/*                                                               
//STEP0002     EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                           
//SORTJNF1 DD DISP=SHR,DSN=&&T1                                   
//SORTJNF2 DD DISP=SHR,DSN=YOUR INPUT2 FB80                       
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  JOINKEYS FILES=F1,FIELDS=(01,04,A,16,04,A)                     
  JOINKEYS FILES=F2,FIELDS=(01,04,A,16,04,A)                     
  JOIN UNPAIRED,F1,ONLY                                           
  REFORMAT FIELDS=(F1:01,32)                                     
  INREC OVERLAY=(80:X)                                           
  SORT FIELDS=COPY                                                                                                                                   


OUTPUT
Code:

ABCD           6767


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

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Wed Jun 08, 2011 9:41 am
Reply with quote

Thanks a lot!
This one worked like wonder!
Back to top
View user's profile Send private message
prasanth_thavva

New User


Joined: 28 Jul 2005
Posts: 86
Location: Chennai

PostPosted: Sat Jun 18, 2011 7:52 am
Reply with quote

Even we can use OMIT COND to eliminate the records which has spaces in first 4 bytes and then in the next step we can use join keys to un matched records from file A i think achieve the results
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Sat Jun 18, 2011 8:13 am
Reply with quote

Prasanth
chatterjesis wrote:
Thanks Bill for the reply...
Yes, you got it correct, the blank fields should retain the previous non blank values. Is there any looping facility? or something to keep it stored?

Thanks in advance.

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

New User


Joined: 28 Jul 2005
Posts: 86
Location: Chennai

PostPosted: Sat Jun 18, 2011 12:11 pm
Reply with quote

Sql'

Thanks, but actually i would like to figure out what exactly below card does when it executes

OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,GT,C' '),PUSH=(1:1,4))

I have got it like if the first 4 bytes are spaces push, but exactly what push command does ? can you explain me

whether it will write this in temporary area if it a has spaces in first 4 bytes
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 18, 2011 11:08 pm
Reply with quote

Hello,

Quote:
I have got it like if the first 4 bytes are spaces push,
Try working with the code - i believe this is incorrect.

Suggest you look at other topics that have done GROUPing. . .
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
No new posts Arithmetic division using Syncsort SYNCSORT 6
Search our Forums:

Back to Top