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

Extract record using 2 input file into multiple output files


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

New User


Joined: 07 Feb 2022
Posts: 15
Location: INDIA

PostPosted: Wed Dec 28, 2022 9:08 pm
Reply with quote

File 1 has Dept Code (1-3) and Emp ID (5-14)

Code:

INPUT 1:
010 1111111111
010 2222222222
022 3333333333
022 4444444444


File 2 has Employee details with different record type , in that only record type 3 alone contains Dept code at position 44.
NOTE : Record type (14-15), Emp Id (16-25), Dept Code (44-46)

Code:

INPUT 2:
*************011111111111                                 
*************021111111111
*************031111111111                                  010
*************041111111111                                 
*************012222222222                                 
*************022222222222
*************032222222222                                  010
*************042222222222                                 
*************033333333333                                 
*************023333333333
*************033333333333                                  022
*************043333333333                                 
*************014444444444                                 
*************024444444444
*************034444444444                                  022
*************044444444444                                 


Expected 2 output files , each file based on market.

Out File 1 for Dept Code : 010
Code:

OUTPUT 1:
*************011111111111                                 
*************021111111111
*************031111111111                                  010
*************041111111111                                 
*************012222222222                                 
*************022222222222
*************032222222222                                  010
*************042222222222                                 


Out File 2 for Dept Code : 022
Code:

OUTPUT 2:
*************033333333333                                 
*************023333333333
*************033333333333                                  022
*************043333333333                                 
*************014444444444                                 
*************024444444444
*************034444444444                                  022
*************044444444444                                 
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Wed Dec 28, 2022 9:21 pm
Reply with quote

1. This task is neither JCL nor VSAM

2. Try to read the following - Creating multiple output data sets and reports

3. If you do not understand at least something from #2, I'd recommend you to change your job to something more simple.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Dec 28, 2022 11:33 pm
Reply with quote

A simple JOINKEYS will do the task for the sample you have provided.
Code:
OPTION COPY                     
JOINKEYS F1=F1,FIELDS=(5,10,A) 
JOINKEYS F2=F2,FIELDS=(16,10,A)
REFORMAT FIELDS=(F2:1,63,F1:1,3)
OUTFIL FNAMES=(TEN),           
  INCLUDE=(64,3,CH,EQ,C'010'), 
  BUILD=(1,63)                 
OUTFIL FNAMES=(TWENTY),         
  INCLUDE=(64,3,CH,EQ,C'022'), 
  BUILD=(1,63)                 
END
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 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top