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

Concatenate two files side by side


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Fri May 14, 2010 8:29 pm
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
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

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

DFSORT Developer


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

PostPosted: Fri May 14, 2010 10:05 pm
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
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 Developer


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

PostPosted: Mon May 17, 2010 11:19 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top