MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Merge laterally two files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Thu Jul 17, 2003 3:10 am    Post subject: Merge laterally two files Reply with quote

Hi all,

I have two files like this

File1 , LRECL =10

AAAA......
BBBB......

File 2, LRECL=10

1234......
5678......

I need to have an o/p file like this

File 3, LRECL=20

AAAA......1234......
BBBB......5678......

the binary zeroes (ie dots) need to be there in the o/p file.

For this i have wrote a code like this...

Quote:

//S1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=FILE1,DISP=SHR
//IN2 DD DSN=FILE2,DISP=SHR
//T1 DD DSN=&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),
// DISP=(MOD,PASS),DCB=(RECFM=FB,LRECL=20,BLKSIZE=0)
//OUT DD DSN=FILE3,DISP=SHR
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SORT FROM(T1) TO(OUT) USING(CTL3)
//CTL1CNTL DD *
OUTREC FIELDS=(1:1,10,20:SEQNUM,8,PD)
//CTL2CNTL DD *
OUTREC FIELDS=(11:1,10,20:SEQNUM,8,PD)
//CTL3CNTL DD *
OPTION EQUALS
SORT FIELDS=(20,8,PD,A)
SUM FIELDS=(1,10,BI,11,10,BI)
OUTREC FIELDS=(1,20)
/*


But this code is giving me error as
Quote:

IN1 : RECFM=FBA ; LRECL= 10; BLKSIZE= 10
OUTREC RECORD LENGTH = 27
T1 : RECFM=FB ; LRECL= 20; BLKSIZE= 27980
OUTPUT LRECL DIFFERS FROM SORTOUT LRECL
T1 HAS INCOMPATIBLE LRECL


Can anyone pls tell me how to change the code to get the desired result.

I have gone thru Kolusu's post earlier but it didnt help me out here

Thanks,
Deepesh
Back to top
View user's profile Send private message AIM Address
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Thu Jul 17, 2003 4:05 am    Post subject: Reply with quote

Deepesh,

I have a question. What if the number of records are not same in the files?
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Thu Jul 17, 2003 4:53 am    Post subject: Reply with quote

Cogito,

I coded the DCB parameter after i got an error earlier. Now if i remove the DCB parameter and then submit i get the following error...

IN2 : RECFM=FBA ; LRECL= 10; BLKSIZE= 10
OUTREC HAS OVERLAPPING COLUMNS SPECIFIED
SYNCSMF CALLED BY SYNCSORT; RC=0000

Sad
Back to top
View user's profile Send private message AIM Address
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Thu Jul 17, 2003 5:18 am    Post subject: Reply with quote

Deepesh,

The overlapping is obvious here. In CTL2CNTL, you are asking for, 10 binary zeroes at first, then first 10 columns from the input file. The number of bytes used are 20. Then, you are asking for sequence numbers from the 20th column itself.

So, modify your CTL1 and CTL2 so that, Sequence numbers start at 21st column. From the first file, there will be 10 bytes of data, 10 binary zeroes and 8 PD sequence numbers. (Total 28 and not 27). From the second file, there will be 10 binary zeroes, 10 bytes of data and 8 PD sequence numbers. (Total 28 and not 27).

You still have not answered my query in my first post.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Thu Jul 17, 2003 5:38 am    Post subject: Reply with quote

deepeshk79,

There are a couple of errors in your job.let me clarify as to how you can merge two files together

we copy the first file to a temp file with follwing layout

1 to 10 bytes - we have contents from IN1 as is

10 to 20 bytes - we need to pad with binary zeroes for the second file contents

21 - you can have a seqnum


for the second file you need to copy to temp file with the following layout

1 to 10 bytes - we need to pad with binary zeroes

10 to 20 bytes - we copy contents of IN2 as is

21 - you can have a seqnum


now you concatenate these files together and sort on the seqnum while summing the bytes 11 thru 20


so change your ctl1cntl to the following

Code:

 OUTREC FIELDS=(1,10,              $ FROM INPUT AS IS
                10Z,               $ 10 BINARY ZEROES   
                SEQNUM,8,PD)       $ 8 BYTES SEQNUM



change your ctl2cntl to the following

Code:

 OUTREC FIELDS=(10Z              $ 10 BINARY ZEROES   
                1,10,            $ FROM INPUT AS IS
                SEQNUM,8,PD)     $ 8 BYTES SEQNUM


Change your Ctl3cntl to the following. For the binary you can only sum on 2,4,8 bytes only. you coded as 10 bytes.

Code:

OPTION EQUALS
SORT FIELDS=(21,8,PD,A)                 $ SORT ON SEQNUM
SUM FIELDS=(11,8,19,2),FORMAT=BI        $ SUM ON THE BYTES 11 - 20   
OUTREC FIELDS=(1,20)                    $ STRIP THE SEQNUM


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Mon Jul 21, 2003 1:17 am    Post subject: Reply with quote

Thanks kolusu,

It worked!!!.

Bye,
Deepesh
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group