Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

split 2 input files into 3 output files based on fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: split 2 input files into 3 output files based on fields
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: 208
Location: Cochin/Kerala/India

PostPosted: Mon May 25, 2009 4:52 pm    Post subject:
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: 356
Location: New York

PostPosted: Mon May 25, 2009 4:54 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: split 2 input files into 3 output files based on f
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us