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

Syncsort Set the indicator to know match found or not


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

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Wed Oct 23, 2013 4:09 pm
Reply with quote

File-1 looks like (VB file)
Code:

123AINFO1
123BINFO2
123CINFO3
124AINFO1
125BINFO2
127AINFO1


File-2 looks like
Code:

123F
124F
125F
128F


Expected Output
Code:

123AYINFO1
123BINFO2
123CINFO3
124AYINFO1
125AYINFO1
125BINFO2
127ANINFO1


Condition:
Output file need to have all the records from F1 (UNPAIRED,F1)
If Match found in File 2
If File-1 record's 4th Char is A,
Set the indicator 'Y' in 5th position
Else
Set the indicator 'N' in 5th position

if File1 record's 4th Character not='A' then No change.

How to Set the indicator as Y or N..?
Is it possible to do it in Sort using Joinkeys..? Any inputs.

Thanks,
R. Vidhya.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Oct 23, 2013 4:22 pm
Reply with quote

Hi Vidhya...

Why "125" is repeated twice ? it has one record in File 1...any specific reason?

Thanks
-3nadh
Back to top
View user's profile Send private message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Wed Oct 23, 2013 4:27 pm
Reply with quote

Hi Bodatrinadh,
Thanks for the observation. File-1 looks like
Code:

123AINFO1
123BINFO2
123CINFO3
124AINFO1
125AINFO1
125BINFO2
127AINFO1


Thanks,
R. Vidhya
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Oct 23, 2013 4:31 pm
Reply with quote

Just wanted to confirm whether you are using DFSORT or Syncsort? From one of your old post, it looks like you have Syncsort.
Back to top
View user's profile Send private message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Wed Oct 23, 2013 4:42 pm
Reply with quote

Hi Mistah kurtz

yes, it is SyncSort.

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

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Oct 23, 2013 5:32 pm
Reply with quote

Hi Sriramhari
Assuming that all the files are FB and LRECL 80.
Please check the below job.
Code:
//STEP01   EXEC PGM=SORT                       
//SORTJNF1 DD *                               
123AINFO1                                     
123BINFO2                                     
123CINFO3                                     
124AINFO1                                     
125BINFO2                                     
127AINFO1                                     
//SORTJNF2 DD *                               
123F                                           
124F                                           
125F                                           
128F                                           
//SORTOUT  DD SYSOUT=*                         
//SYSOUT   DD SYSOUT=*                         
//SYSIN    DD *                               
    JOINKEYS FILE=F1,FIELDS=(1,3,A)           
    JOINKEYS FILE=F2,FIELDS=(1,3,A)           
    JOIN     UNPAIRED,F1                       
    REFORMAT FIELDS=(F1:1,9,F2:1,3),FILL=C'?' 
    OPTION   COPY                             
    INREC    IFTHEN=(WHEN=(10,3,CH,NE,C'???'),
                     BUILD=(1,4,5:C'Y',6:5,5)),
             IFTHEN=(WHEN=NONE,BUILD=(1,9))   


Output:
Code:
123AYINFO1
123BYINFO2
123CYINFO3
124AYINFO1
125BYINFO2
127AINFO1
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Oct 23, 2013 5:34 pm
Reply with quote

Sriramhari,

File 1 is FB or VB??
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Oct 23, 2013 5:44 pm
Reply with quote

Try this code -

Assuming LREC=10 and FB for F1 and F2.

Code:

//SYSOUT   DD SYSOUT=*                                       
//SORTJNF1 DD *                                               
123AINFO1                                                     
123BINFO2                                                     
123CINFO3                                                     
124AINFO1                                                     
125AINFO1                                                     
125BINFO2                                                     
127AINFO1                                                     
//SORTJNF2 DD *                                               
123F                                                         
124F                                                         
125F                                                         
128F                                                         
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                               
  JOINKEYS FILES=F1,FIELDS=(1,3,A)                           
  JOINKEYS FILES=F2,FIELDS=(1,3,A)                           
  SORT FIELDS=COPY                                           
  REFORMAT FIELDS=(F1:1,10,F2:1,10)                           
  JOIN UNPAIRED,F1,F2                                         
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,11,3,CH,AND,9,1,ZD,EQ,+1),   
                BUILD=(1,4,C'Y',5,5)),                       
        IFTHEN=(WHEN=(1,3,CH,EQ,11,3,CH,AND,9,1,ZD,NE,+1),   
                BUILD=(1,9)),                                 
        IFTHEN=(WHEN=(1,3,CH,NE,11,3,CH),BUILD=(1,4,C'N',5,5))
                                                             
  OUTFIL OUTREC=(1,10),OMIT=(1,1,CH,EQ,C' ')                 


Output :-

Code:

123AYINFO1
123BINFO2 
123CINFO3 
124AYINFO1
125AYINFO1
125BINFO2 
127ANINFO1


Thanks
-3nadh
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Oct 23, 2013 5:58 pm
Reply with quote

Sorry i did not notice it was a VB file for F1..

Please try this code -

Code:

  JOINKEYS FILES=F1,FIELDS=(5,3,A)                             
  JOINKEYS FILES=F2,FIELDS=(1,3,A)                             
  SORT FIELDS=COPY                                             
  REFORMAT FIELDS=(F1:5,10,F2:1,10)                             
  JOIN UNPAIRED,F1,F2                                           
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,11,3,CH,AND,9,1,ZD,EQ,+1),     
                BUILD=(1,4,C'Y',5,5)),                         
        IFTHEN=(WHEN=(1,3,CH,EQ,11,3,CH,AND,9,1,ZD,NE,+1),     
                BUILD=(1,9)),                                   
        IFTHEN=(WHEN=(1,3,CH,NE,11,3,CH),BUILD=(1,4,C'N',5,5)) 
                                                               
  OUTFIL OUTREC=(1,10),OMIT=(1,1,CH,EQ,C' ')                   


Thanks
-3nadh
Back to top
View user's profile Send private message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Thu Oct 24, 2013 11:01 pm
Reply with quote

Hi All,
Thank you for the inputs, FILE-1 is VB; FILE-2 is FB. Sort out file is FB, it should be VB. (don't want to convert FTOV) - it will be two steps. Part of the sort card used:
Code:

JOINKEYS FILE=F1,FIELDS=(06,13,A)   
JOINKEYS FILE=F2,FIELDS=(07,13,A)   
JOIN     UNPAIRED,F1                 
REFORMAT FIELDS=(F1:1,420,F2:1,103) 
   many comparisons...

File-2 values are required for further comparison,
JOINKEYS REFORMAT RECORD LENGTH= 523, TYPE = F
But build records is from File-1. How to include a RDW field in first 4 position.
BUILD=(1,4,X'1C',5,220,C'N',222,108)) -- error either 4X'00' also not working. Any Suggesstions Please.

Thanks,
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 How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Adding 'ODD' and 'EVEN' indicator at ... DFSORT/ICETOOL 6
No new posts A directory in the pathname was not f... ABENDS & Debugging 0
No new posts I need a 4 lines block where substrin... DFSORT/ICETOOL 12
Search our Forums:

Back to Top