View previous topic :: View next topic
Author
Message
Sriramhari New User Joined: 11 May 2009Posts: 17 Location: Bangalore
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
bodatrinadh Active User Joined: 05 Jan 2007Posts: 101 Location: chennai (India)
Hi Vidhya...
Why "125" is repeated twice ? it has one record in File 1...any specific reason?
Thanks
-3nadh
Back to top
Sriramhari New User Joined: 11 May 2009Posts: 17 Location: Bangalore
Hi Bodatrinadh,
Thanks for the observation. File-1 looks like
Code:
123AINFO1
123BINFO2
123CINFO3
124AINFO1
125AINFO1
125BINFO2
127AINFO1
Thanks,
R. Vidhya
Back to top
mistah kurtz Active User Joined: 28 Jan 2012Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
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
Sriramhari New User Joined: 11 May 2009Posts: 17 Location: Bangalore
Hi Mistah kurtz
yes, it is SyncSort.
Thanks,
Back to top
mistah kurtz Active User Joined: 28 Jan 2012Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
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
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Sriramhari,
File 1 is FB or VB??
Back to top
bodatrinadh Active User Joined: 05 Jan 2007Posts: 101 Location: chennai (India)
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
bodatrinadh Active User Joined: 05 Jan 2007Posts: 101 Location: chennai (India)
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
Sriramhari New User Joined: 11 May 2009Posts: 17 Location: Bangalore
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
Please enable JavaScript!