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

SyncSort - SYNCTOOL - JOINKEYS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Mon Aug 02, 2010 6:29 pm
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
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: 2481
Location: @my desk

PostPosted: Mon Aug 02, 2010 10:07 pm
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
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: 2481
Location: @my desk

PostPosted: Tue Aug 03, 2010 11:47 am
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
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: 2481
Location: @my desk

PostPosted: Fri Aug 06, 2010 3:02 pm
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 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 Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
Search our Forums:

Back to Top