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
 

 

SyncSort - SYNCTOOL - JOINKEYS

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

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Wed Jul 21, 2010 2:33 am    Post subject: SyncSort - SYNCTOOL - JOINKEYS
Reply with quote

Hi,

Following is my requirement -

Input file has Order data - Each Order has different record types starting from record type 100 to record type 2900 e.g.

0100 XXXXXX
0200 YYYYYY
0300 ZZZZZZ
1000 AAAAA
.
.
2900 BBBB

This set will be repeated for each Invoice -

My requirement is to get the records in the following order for only Order type = A, this can be identified in 1000 record. I have a ket on 20,37.

1000
0200
0300
2400
2200
2300
2500
2100

since I am filtering 1000 records for only Type A orders, I need to delete other record types which dosent have corresponding 1000 type record.
I could do this in 2 step.

Step 1 - SYNCTOOL step to create get the records in the required order
and then create a file with only 1000 records.

Code:
//MATCH   EXEC PGM=SYNCTOOL                         
//TOOLMSG  DD SYSOUT=*                             
//DFSMSG   DD SYSOUT=*                             
//INP1     DD DSN=INPUT1,
//             DISP=SHR                             
//MATCH1   DD DSN=TEMP1,       
//             DISP=(NEW,CATLG,DELETE),             
//             RECFM=FB,LRECL=1918,                 
//             AVGREC=K,                           
//             SPACE=(1918,(100,40),RLSE)           
//MATCH2   DD DSN=TEMP2,       
//             DISP=(NEW,CATLG,DELETE),             
//             RECFM=FB,LRECL=1918,                 
//             AVGREC=K,                           
//             SPACE=(1918,(100,40),RLSE)           
//*                                                 
//TOOLIN DD *                                       
 COPY FROM(INP1)  TO(MATCH1) USING(CTL1)           
 SORT FROM(INP1)  TO(MATCH2) USING(CTL2)           
 /*                                                       
//CTL1CNTL DD *                                         
 INCLUDE COND=(1,4,CH,EQ,C'1000',AND,311,1,CH,EQ,C'A')
 OUTREC FIELDS=(1,1918)                                 
/*                                                       
//CTL2CNTL DD *                                         
 INCLUDE COND=(1,4,CH,EQ,C'0200',OR,                     
               1,4,CH,EQ,C'0300',OR,                     
               1,4,CH,EQ,C'1000',OR,                     
               1,4,CH,EQ,C'2100',OR,                     
               1,4,CH,EQ,C'2200',OR,                     
               1,4,CH,EQ,C'2300',OR,                     
               1,4,CH,EQ,C'2400',OR,                     
               1,4,CH,EQ,C'2500')                       
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'1000'),               
               BUILD=(1:1,1918,1919:C'A')),             
        IFTHEN=(WHEN=(1,4,CH,EQ,C'0200'),               
               BUILD=(1:1,1918,1919:C'B')),             
               BUILD=(1:1,1918,1919:C'B')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'0300'),     
               BUILD=(1:1,1918,1919:C'C')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2400'),     
               BUILD=(1:1,1918,1919:C'D')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2200'),     
               BUILD=(1:1,1918,1919:C'E')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2300'),     
               BUILD=(1:1,1918,1919:C'F')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2500'),     
               BUILD=(1:1,1918,1919:C'G')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2100'),     
               BUILD=(1:1,1918,1919:C'H'))     
 SORT FIELDS=(20,37,CH,A,1919,1,CH,A),EQUALS   
 OUTREC FIELDS=(1,1918)                       
/*                                             

Step 2:
Use JOINKEYS between MATCH1 and MATCH2 file to get rid of records which dosent have corresponding 1000 records.

Code:
//SORTCPY1 EXEC  PGM=SORT,                         
//             PARM='RC16=ABE'                     
//SORTMSG  DD  SYSOUT=*                             
//SYSIN    DD  *                                   
      JOINKEYS FILE=F1,FIELDS=(20,37,A) SORTED     
      JOINKEYS FILE=F2,FIELDS=(20,37,A) SORTED     
      JOIN UNPAIRED,F1                             
      REFORMAT FIELDS=(F1:1,1918,F2:1,1)           
      SORT FIELDS=COPY                             
      OUTFIL FILES=OUT,INCLUDE=(1919,1,CH,NE,C' '),
      OUTREC=(1,1918)                               
/*                                                 
//SORTJNF1 DD  DSN=TEMP2,     
//             DISP=SHR                             
//SORTJNF2 DD  DSN=TEMP2,     
//             DISP=SHR                             
//SORTOUT  DD  DSN=OUTPUT,     
//             DISP=(,CATLG,DELETE),               
//             RECFM=FB,LRECL=1918,                 
.
.


Is there a way to get the second sort step in the first SYNCTOOL step itself or is there any better way to acieve this?

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

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Mon Aug 02, 2010 6:29 pm    Post subject:
Reply with quote

Quote:
Is there a way to get the second sort step in the first ICETOOL step itself
Yes, you can.
Back to top
View user's profile Send private message
SORTQUERY

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Mon Aug 02, 2010 9:31 pm    Post subject:
Reply with quote

Can you please let me know how or provide me some reference material for the same...I could'nt get any on teh web.

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

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Mon Aug 02, 2010 10:07 pm    Post subject:
Reply with quote

Syncsort Manuals are copyrighted material and hence you wont find them in the web. You can request one instead from Syncsort support or send a PM to Alissa Margulies mentioning your CPU details.

Does the Invoice number have the same value for a single 'set' of records?
Is it the invoice number that you're trying to match in your second sort at pos 20,37?
Does the '1000' record always have Order Type='A'?
Can the 'Order Type' field have duplicate values in a single 'set'?
Back to top
View user's profile Send private message
SORTQUERY

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Mon Aug 02, 2010 10:38 pm    Post subject:
Reply with quote

This data is only related to an Order, not Invoice - Sorry about the typo and confusion.

20,37 is my key - it has the Group number who has placed the order. All the record type will have the same Group Number for one Order.

There are multiple type of Orders, I need to process only Order Type = 'A'.

There will be only 1 '1000' type record for a particular Order.

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

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Tue Aug 03, 2010 11:47 am    Post subject:
Reply with quote

Quote:
20,37 is my key - it has the Group number who has placed the order. All the record type will have the same Group Number for one Order
For a set of records having the same 'Group Number', will the Order type be same?
Is it compulsory for a 'Group' to have a '1000' type record?
Back to top
View user's profile Send private message
SORTQUERY

New User


Joined: 14 Jul 2010
Posts: 13
Location: United States

PostPosted: Tue Aug 03, 2010 6:48 pm    Post subject:
Reply with quote

yes, Order type will be the same - that is present in 1000- type record.
Each set will always have 1 1000- record type.

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

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Fri Aug 06, 2010 3:02 pm    Post subject:
Reply with quote

SORTQUERY wrote:
yes, Order type will be the same - that is present in 1000- type record.
Sorry, I got engaged with some tasks and could n't check your post.

May be I am missing something here. If Order Type is the same for all the records in a group, can't it be in any record, a '0100' record or '0200' or any other record type in the group. If that is the case, you can modify your INCLUDE COND to have ONLY order groups having Order Type='A' and do it in a single SORT.

Code:
//SYSIN DD *                                         
 INCLUDE COND=((1,4,CH,EQ,C'0200',OR,                     
                1,4,CH,EQ,C'0300',OR,                     
                1,4,CH,EQ,C'1000',OR,                     
                1,4,CH,EQ,C'2100',OR,                     
                1,4,CH,EQ,C'2200',OR,                     
                1,4,CH,EQ,C'2300',OR,                     
                1,4,CH,EQ,C'2400',OR,                     
                1,4,CH,EQ,C'2500'),AND,
              311,1,CH,EQ,C'A')                       
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'1000'),               
               BUILD=(1:1,1918,1919:C'A')),             
        IFTHEN=(WHEN=(1,4,CH,EQ,C'0200'),               
               BUILD=(1:1,1918,1919:C'B')),             
               BUILD=(1:1,1918,1919:C'B')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'0300'),     
               BUILD=(1:1,1918,1919:C'C')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2400'),     
               BUILD=(1:1,1918,1919:C'D')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2200'),     
               BUILD=(1:1,1918,1919:C'E')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2300'),     
               BUILD=(1:1,1918,1919:C'F')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2500'),     
               BUILD=(1:1,1918,1919:C'G')),   
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2100'),     
               BUILD=(1:1,1918,1919:C'H'))     
 SORT FIELDS=(20,37,CH,A,1919,1,CH,A),EQUALS   
 OUTREC FIELDS=(1,1918)
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 getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am


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