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

split 2 input files into 3 output files based on fields


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

New User


Joined: 07 May 2005
Posts: 9
Location: Duluth, US

PostPosted: Mon May 25, 2009 3:58 pm
Reply with quote

i want to convert 2 input files into 3 output files based on below conditions

i/p record first 2 byte - pic 9(2)
last 5 bytes - pic s9(9) comp-3

input file 1

15abc12345
15ggd11111
15hsr22222
15asd98765

input file 2

16xyz12345
16trh44444
16utt55555
16gdf98765

.....

output 1
15abc12345
15ggd11111
15hsr22222
15asd98765
16trh44444
16utt55555


output2
16xyz12345
16gdf98765

output 3
1612345 name1 field1
1698765 name2 field2

names1 & 2 are x(25)
fields1 & 2 are s9(9) comp-3

i want to do this in a single step
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Mon May 25, 2009 4:52 pm
Reply with quote

Can you explain the your conditions clearly.I am not clear with that....
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Mon May 25, 2009 4:54 pm
Reply with quote

Quote:

i want to convert 2 input files into 3 output files based on below conditions.


What are those conditions?

Quote:

names1 & 2 are x(25)
fields1 & 2 are s9(9) comp-3


From where these fields you are extracting?

Provide Information properly to get proper solutions.
Back to top
View user's profile Send private message
prathap_ts
Warnings : 1

New User


Joined: 07 May 2005
Posts: 9
Location: Duluth, US

PostPosted: Mon May 25, 2009 5:24 pm
Reply with quote

conditions

output 1 should contain unique records from input 1 and 2 based on last 5 digits

15abc12345
15ggd11111
15hsr22222
15asd98765
16trh44444
16utt55555


output 2 should contain duplicate records from input 1 and 2 based on last 5 digits (only 2nd occurance)

16xyz12345
16gdf98765

output 3 is made of first two bytes , last five bytes of duplicates records (say output 2) plus few more new fields like name1 and field1

1612345 name1 field1
1698765 name2 field2

leave the new fields... below output is ok in file 3

1612345
1698765

thanks in advance.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 26, 2009 7:56 pm
Reply with quote

Pratap_ts,

The following DFSORT JCL will give you the desired results. I assumed that your both files are of the same lrecl and recfm.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=your input file1,DISP=SHR
//         DD DSN=Your input file2,DISP=SHR                   
//OUT1     DD SYSOUT=*                                         
//OUT2     DD SYSOUT=*                                         
//OUT3     DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=(6,5,PD,A),EQUALS                               
  OUTREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(6,5))               
  OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,10)       
  OUTFIL FNAMES=OUT2,INCLUDE=(81,8,ZD,GT,1),BUILD=(1,10)       
  OUTFIL FNAMES=OUT3,INCLUDE=(81,8,ZD,GT,1),BUILD=(1,2,6,5)   
/*
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top