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

How to build one file from two input files


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

New User


Joined: 26 Feb 2018
Posts: 2
Location: italy

PostPosted: Tue Feb 27, 2018 6:45 pm
Reply with quote

Hi,
I need to generate one file taking different fields from two different input files.
Here an example:

INPUT FILE 1: 1234 ABCDE A1B2C3D4

INPUT FILE 2: 5678 FGHIL E1F2G3H4

OUTPUT FILE: A1B2C3D4 FGHIL 1234 5678 E1F2G3H4 ABCDE

Is it possible using some of DFSORT features?
I was thinking about OUTREC but can't manage to get any result.

Thanks for your help

Daniele
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Feb 27, 2018 7:58 pm
Reply with quote

Welcome to the forum

You need to describe in far more detail what is actually wanted.
What are the rules for getting from input to output.
Field lengths, positions and data types.

We can guess from the post above, but it is far better to get the description right first time to avoid responders wasting time on an incorrect solution.

Please also post the code that you have tried and the results.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Feb 27, 2018 7:59 pm
Reply with quote

Joinkeys?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Feb 27, 2018 8:55 pm
Reply with quote

Since there is no key, it is 1-1 match assumed, so make sure records are sorted correctly.
considering the size FB 80 , try this.
Code:
//STEP0100 EXEC PGM=SORT                                 
 //SYSOUT   DD SYSOUT=*                                   
 //SORTJNF1 DD DSN=DS1,DISP=SHR         
 //SORTJNF2 DD DSN=DS2,DISP=SHR           
 //SORTOUT  DD SYSOUT=*                                   
 //SYSIN    DD *                                           
   SORT FIELDS=COPY                                       
   JOINKEYS FILE=F1,FIELDS=(81,8,A),SORTED,NOSEQCK       
   JOINKEYS FILE=F2,FIELDS=(81,8,A),SORTED,NOSEQCK         
   REFORMAT FIELDS=() << Adjust it as per your needs shown above                     
 //JNF1CNTL DD *                                           
   INREC OVERLAY=(81:SEQNUM,8,ZD)                         
 //JNF2CNTL DD *                                           
   INREC OVERLAY=(81:SEQNUM,8,ZD)                         
 //*

Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Wed Feb 28, 2018 1:21 am
Reply with quote

If it is only one record in both the files, then you dont need a Joinkey.

You can concatenate both the files and use IFTHEN=(WHEN=GROUP,BEGIN=..) and PUSH=..

And use OUTFIL INCLDUE to read only second record and build the required fields.
Back to top
View user's profile Send private message
daniele

New User


Joined: 26 Feb 2018
Posts: 2
Location: italy

PostPosted: Wed Feb 28, 2018 3:20 pm
Reply with quote

Hi,
thank you all for your kind replies.Excuse me if i have not explained my needs very clearly.
My input data sets are sequential text data sets (lrecl=80,recfm=fb), here an extract from both:

INPUT 1:

Code:
09720170000000106284000000000000001F730SZ614572496393RM0010972017000000010628412
09720170000000267268000000000000001G293SZ614572496405RM0010972017000000026726812
09720170000000310378000000000000001L182SZ614572496416RM0040972017000000031037812
09720170000000406308000000000000001C518SZ614572496428RM0060972017000000040630812
09720170000000506309000000000000001H387SZ614572496439RM0060972017000000050630912
09720170000000606315000000000000001L611SZ614572496440RM0060972017000000060631512
09720170000000710375000000000000001E392SZ614572496451RM0040972017000000071037512

INPUT 2:

Code:
0972017000017904147000000000000001F730SZ614572496393RM0010972017000001790414744I
09720170000018016347000000000000001F604SZ614572498180LE0010972017000001801634765
09720170000018116633000000000000001F842SZ614572498191LE0010972017000001811663376
09720170000018216282000000000000001H632SZ614572498203LE0010972017000001821628283
09720170000018316725000000000000001L064SZ614572498214LE0010972017000001831672503
09720170000018416499000000000000001F784SZ614572498226TA00109720170000018416499A3
09720170000018506856000000000000001G252SZ614572498237TA0010972017000001850685659


My need is to generate a third data set having the same structure (lrecl=80,recfm=fb)
each record composed in this way:(byte 1 to 10 from first input),(byte 11 to 30 from second input),
(byte 31 to 60 from first input),(byte 61 to 80 from second input):

Code:
09720170000179041470000000000000001F730SZ614572496393RM001072017000001790414744I
09720170000018016347000000000000001G293SZ614572496405RM0010972017000001801634765
09720170000018116633000000000000001L182SZ614572496416RM0040972017000001811663376
09720170000018216282000000000000001C518SZ614572496428RM0060972017000001821628283
09720170000018316725000000000000001H387SZ614572496439RM0060972017000001831672503
09720170000018416499000000000000001L611SZ614572496440RM00609720170000018416499A3
09720170000018506856000000000000001E392SZ614572496451RM0040972017000001850685659


Thanks
D

Edited to use code tags and proper terminology
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top