View previous topic :: View next topic
|
Author |
Message |
selvamsrinivasan85
New User

Joined: 09 Aug 2010 Posts: 36 Location: Chennai
|
|
|
|
Hi all,
I have a requirement to create match and no match files using sort.
I achieved using 3 steps. Can this be simplified further?. Just want to hear it out. All are having FB/80.
Req:
Step 1:
Input File 1 - FB/80 : Keys (1,10)
Input File 2 - FB/80 : Keys (5,10)
Output
1. No match File 1 - FB/80
2. No match File 2 (Not required)
3. Match file.
Step 2 :
Input : No match file 1
Output file 1 : contains indicator (27th posistion) - I
Output file 2 : contains indicator (27th posistion) - U
Step 3:
Input : Match file
Output file 1 : contains indicator (27th posistion) - I
Output file 2 : contains indicator (27th posistion) - U
Can these files can be created in first step itself?. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2209 Location: USA
|
|
|
|
The answer in the style of your question:
Yes, it can be done easily. |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1387 Location: Bamberg, Germany
|
|
|
|
Task 1: Make use of JOINKEYS, JOIN UNPAIRED and REFORMAT in a good way
Task 2: Use the Join Indicator from 1) to include what's needed for your OUTFIL datasets
It's less than 24 lines of code to achieve your requirement in a single step. |
|
Back to top |
|
 |
selvamsrinivasan85
New User

Joined: 09 Aug 2010 Posts: 36 Location: Chennai
|
|
|
|
Hi Joerg,
Thanks for your suggestions!. So it's basically OUTFIL with extra INCLUDE condition for me to produce extra files. All 5 Outputs produced in single step successfully.
@ Sergeyken,
I never expected this answer from a senior person like you. |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1387 Location: Bamberg, Germany
|
|
|
|
@selvamsrinivasan85: Yes. If you don't mind, share your solution please. |
|
Back to top |
|
 |
selvamsrinivasan85
New User

Joined: 09 Aug 2010 Posts: 36 Location: Chennai
|
|
|
|
Hi Joerg,
Please find the sort card below
Code: |
//STEP010 EXEC PGM=SORT
//SORTJNF1 DD DSN=TEST.INPUT1.COMP,DISP=SHR
//SORTJNF2 DD DSN=TEST.INPUT2.COMP,DISP=SHR
//F1INS DD DSN=TEST.FILE1.INSERT,DISP=SHR
//F1UPD DD DSN=TEST.FILE1.UPDATE,DISP=SHR
//F2ONLY DD DUMMY
//MTINS DD DSN=TEST.MATCH.INSERT,DISP=SHR
//MTUPD DD DSN=TEST.MATCH.UPDATE,DISP=SHR
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,10,A)
JOINKEYS FILE=F2,FIELDS=(5,10,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OPTION COPY
OUTFIL FNAMES=F1INS,INCLUDE=(161,1,CH,EQ,C'1',AND,27,1,CH,EQ,C'I'),
BUILD=(1,80)
OUTFIL FNAMES=F1UPD,INCLUDE=(161,1,CH,EQ,C'1',AND,27,1,CH,EQ,C'U'),
BUILD=(1,80)
OUTFIL FNAMES=F2ONLY,INCLUDE=(161,1,CH,EQ,C'2'),
BUILD=(81,80)
OUTFIL FNAMES=MTINS,INCLUDE=(161,1,CH,EQ,C'B',AND,27,1,CH,EQ,C'I'),
BUILD=(1,80)
OUTFIL FNAMES=MTUPD,INCLUDE=(161,1,CH,EQ,C'B',AND,27,1,CH,EQ,C'U'),
BUILD=(1,80)
/*
|
|
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1387 Location: Bamberg, Germany
|
|
|
|
JOIN UNPAIRED,F1 is enough as you put F2 to DUMMY anyway. This also can be used to reduce your REFORMAT statement. REFORMAT FIELDS=(F1:1,80,?) is sufficient for your task. Update the INCLUDE= fields accordingly. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2209 Location: USA
|
|
Back to top |
|
 |
|
|