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
 

 

Concatenate two files side by side

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 134
Location: India

PostPosted: Fri May 14, 2010 2:50 pm    Post subject: Concatenate two files side by side
Reply with quote

Hi,

I have two PS files say 1 and 2. File 1 & File 2 are having a LRECL=133.
Now Suppose File1 is having 5 columns A,B,C,D,E and File2 is having Columns F,G,H. I want to concatenate Columns A,B,D,F,G into another file say File3. Can anybody please let me know how to put these columns from two different files into another file. File3 is having LRECL=100.
Thanks
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 14, 2010 8:29 pm    Post subject:
Reply with quote

Hello,

What controls which record from file 1 is paired with which file 2 record(s)?

Is there some key?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri May 14, 2010 9:09 pm    Post subject:
Reply with quote

GaganGarg,

Look at this post for "Join fields from two files on a key or Join fields from two files record-by-record" here

http://ibmmainframes.com/viewtopic.php?p=84743
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri May 14, 2010 10:05 pm    Post subject:
Reply with quote

GaganGarg,

If you want more help with this, you have to give more details.

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.

Also, run this job and show the //SYSOUT messages you receive, so I can see what level you're at:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN    DD    *
    OPTION COPY
/*
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 134
Location: India

PostPosted: Mon May 17, 2010 9:43 am    Post subject:
Reply with quote

Hi,
LRECL for File 1 and File2 is 133. File3 (output file) is having LRECL=100. Length of column A=10, column B=12, Column C=5, column D=7, Column E=16, column F=10, Column G=12, Column H=14.
File1 and File2 are having equal number of records and There is 1:1 mapping between the file1 and file2 records, I mean record 1 is mapped to record 1 and record 2 is mapped to record 2 and so on.
File1, File2 and File3 are having RECFM=FB. All the fields in the file1 and 2 are of CH type. Files can have duplicates.


File1:

Code:

 Command ===>                                                 
 ****** ***************************** Top of Data *************
 000100 ABCDEFCODE23456789012123457RAMESHGXXXXXXXXXXXXXXXX     
 000101 ABCDEFCODE23456789012123457RAMESHGXXXXXXXXXXXXXXXX     
 000200 MNBRKTCODE23456789012123457SHARMALYYYYYYYYYYYYYYYY     
 ****** **************************** Bottom of Data ***********


File2:
Code:

 Command ===>                                                  Scroll ===> CSR 
 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 ****** ***************************** Top of Data ******************************
 000100 BILL PENDG00000000123DATE05-05-2010                                     
 000110 BILL CLEAR00000000000DATE16-05-2010                                     
 000120 BILL CLEAR00000001290DATE04-05-2010                                     
 ****** **************************** Bottom of Data ****************************
                                                                               


File3:
Code:

****** ***************************** Top of Data ******************
000100 ABCDEFCODE234567890121RAMESHGBILL PENDG00000000123         
000200 ABCDEFCODE234567890121RAMESHGBILL CLEAR00000000000         
000300 MNBRKTCODE234567890121SHARMALBILL CLEAR00000001290         
****** **************************** Bottom of Data ****************
                                                                   


My Client mainframe installation is using the DFSORT and please find below the scrrenshot for spool messages after submitting the sort step:
Code:

 COMMAND INPUT ===>                                            SCROLL ===> CSR 
********************************* TOP OF DATA **********************************
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 23:43 ON SUN MA
              OPTION COPY                                                       
ICE201I F RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K90014 C6-K90014 C7-K45047 C8-K42136 E9-K40168 C9-BASE   E5-K45240
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED


Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon May 17, 2010 11:19 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/133)
//IN2 DD DSN=...  input file2 (FB/133)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(101,8,ZD) WITH(30,21) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,22,28,7,101:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
  INREC BUILD=(30:1,21,101:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,100)
/*
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 134
Location: India

PostPosted: Tue May 18, 2010 9:05 am    Post subject:
Reply with quote

Hi Frank,

It worked fine. Thanks a lot.
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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


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