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

Joinkeys - 5 output files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Sun Sep 10, 2023 2:19 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1992
Location: USA

PostPosted: Sun Sep 10, 2023 2:25 pm
Reply with quote

The answer in the style of your question:

Yes, it can be done easily.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1205
Location: Bamberg, Germany

PostPosted: Sun Sep 10, 2023 5:53 pm
Reply with quote

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
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Fri Sep 15, 2023 8:47 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1205
Location: Bamberg, Germany

PostPosted: Fri Sep 15, 2023 10:52 am
Reply with quote

@selvamsrinivasan85: Yes. If you don't mind, share your solution please.
Back to top
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Sat Sep 16, 2023 3:21 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1205
Location: Bamberg, Germany

PostPosted: Sun Sep 17, 2023 11:47 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1992
Location: USA

PostPosted: Tue Sep 19, 2023 12:19 pm
Reply with quote

1) My anwer followed 100% the style of your question.

2) Just recently me (and others) presented here a ready-to-use solution of almost the same task - ibmmainframes.com/viewtopic.php?t=69294&highlight=
It would be nice also to use search feature
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 6
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top