Page 1 of 3

Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 5:44 pm
by porwalrox
Hi,
I have a problem with merging two input VB files & then writing it to another VB file. If I send the output to the SORTOUT DD SYSOUT=*. It works fine.
When I send it to a VB file. It gives error:
ICE043A 9 INVALID DATA SET ATTRIBUTES: OUT RECFM - REASON CODE IS 14

//STEP EXEC PGM=SORT                                     
//SYSOUT DD SYSOUT=*                                     
//IN1 DD DSN=U299060.JN2FL1.PS,DISP=SHR                   
//IN2 DD DSN=U299060.JN2FL2.PS,DISP=SHR                   
//OUT DD DSN=U299060.JN2FLOUT.PS,DISP=SHR               
//SYSIN DD *                                             
 JOINKEYS F1=IN1,FIELDS=(1,7,A)                           
 JOINKEYS F2=IN2,FIELDS=(1,7,A)                           
 REFORMAT FIELDS=(F1:1,80,F2:1,80)                       
 JOIN UNPAIRED,F1,F2                                     
 OPTION COPY                         
 OUTFIL FNAMES=OUT,BUILD=(1,80,11,80)
/*                                   

Here JN2FL1 & JN2FL2 are of type VB.

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 5:56 pm
by BillyBoyo
Yet you are telling the REFORMAT record and the OUTFIL that you have F-type files.

A V always needs the RDW.

So, your FIELDS need to have 4 added to their start position.

Your REFORMAT needs to start with F1:1,4 and the other fields changed appropriately..

Your BUILD needs to start with 1,4 and the other fields changed appropriately.

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 6:22 pm
by porwalrox
Hi Billy!
I know that VB file have first 4 byte as Record Descriptor Word. So that will contain the length of the data. I have F1 & F2 of 80 bytes and JN2FLOUT is of 164 bytes.
So do i need to change my REFORMAT as REFORMAT FIELDS=(F1:1,4) & similarly for BUILD?

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 6:35 pm
by BillyBoyo
The keys for your JOIN include the RDW. Is that intended?

What happens with your BUILD if you have an unmatched on F1?

What is 11,80 about?

You now say you have 164, but why? 80+80 is 160.

Even though 1,80 includes the RDW, I think it is bad practice to do it that way.

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 6:49 pm
by porwalrox
Yes! i am joining those according to the keys available on 1-7 position.
Okay so file with 80 bytes also contains hidden first 4 bytes as RDW. After that it contains data.
Just i tried with 164 bytes, when 160 didn't work.

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 6:55 pm
by porwalrox
When i remove OUTFIL statement, OUT DD DSN.... & Build also. Then it gives exact output. First 4 bytes as blank then data from both files.
Something i am doing wrong with REFORMAT & BUILD. Could you please tell me that where i have made the mistake?

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 8:01 pm
by BillyBoyo
Can you explain what you are trying to do, show sample input and expected output.

You have three situations, matched, unmatched with record on F1, and unmatched with record on F2. What do you expect for each of those?

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 8:19 pm
by porwalrox
Hi billy! problem is not with the output. I know the situation, How JOIN UNPAIRED,F1,F2 is working? But I haven't work with VB files. I am facing this problem when i work with VB file. It also works fine with FB files.
Ex like:
Input1:
a1
b2
input2:
a1
c5

expected output:
a1...........of input1 + a1.........of input2
b2............of input1+ blanks from input2
blanks from input2 + c5.....from input2

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 9:22 pm
by BillyBoyo
Have a look at the dataset that is on your OUT DD. It's RECFM is F, isn't it?

Re: Merging two VB files to VB file

PostPosted: Wed Oct 31, 2012 10:14 pm
by porwalrox
No it is not. it is V.