Page 1 of 1

Variable block to Fixed block conversion

PostPosted: Wed Aug 17, 2011 11:03 pm
by vinayaka1
Hello

I have one VB file and I have to convert it into FB
For ex I have VB file having record length of 1000 bytes.. now I have to convert it into FB of 2000 bytes.
while converting like this first 4 bytes will lost

I have to use the FB 2000 bytes file for some processing and output will also be FB 2000 bytes.

Now I have to convert this FB 2000 bytes file to VB of 1000 bytes and the latest VB file will also have records that are in original file but when I compare those two they are different

What I want now is when I compare orignal VB file and the latest vb file both should be same.

Re: Variable block to Fixed block conversion

PostPosted: Wed Aug 17, 2011 11:07 pm
by vinayaka1
regarding previous post please suggest by which utility my requirement will be fulfilled. I want to do this operation using JCL

Re: Variable block to Fixed block conversion

PostPosted: Thu Aug 18, 2011 12:01 am
by Frank Yaeger
You can use this DFSORT job to convert from VB to FB:

//VF EXEC PGM=SORT                                                 
//SYSOUT DD SYSOUT=*                                               
//SORTIN DD DSN=...  input file (VB/1000)                         
//SORTOUT DD DSN=...  output file (FB/2000)     
//SYSIN DD *                                                       
  OPTION COPY                                                       
  OUTFIL VTOF,BUILD=(5,996,2000:X),VLFILL=C' '                     
/*                                                                 


You can use this DFSORT job to convert back from FB to VB:

//FV EXEC PGM=SORT                                                 
//SYSOUT DD SYSOUT=*                                               
//SORTIN DD DSN=...  input file (FB/2000)       
//SORTOUT DD LRECL=1000,DSN=...  output file (VB/1000)                                                     
//SYSIN DD *                                                       
  OPTION COPY                                                       
  OUTFIL FTOV,VLTRIM=C' '                                           
/*     

Re: Variable block to Fixed block conversion

PostPosted: Thu Aug 18, 2011 12:09 am
by dick scherrer
Hello,

If, after using the conversion jobs Frank provided, the files still do not match, post the first 3 records from each file (using HEX ON).

Re: Variable block to Fixed block conversion

PostPosted: Thu Aug 18, 2011 1:13 am
by Frank Yaeger
I suppose I should have mentioned that my solution assumes that the original VB input file does NOT have trailing blanks. If it does, we could use a different VLFILL/VLTRIM character instead of blank (e.g. X'FF').

Re: Variable block to Fixed block conversion

PostPosted: Thu Aug 18, 2011 12:58 pm
by vinayaka1
File has trailing blanks and I used above jobs by using c'*' already but it didn't work.
actually my original VB input is 15004 length and has keyfields and it is converted to 20000 FB by exracting few records using key fields and outrec is represented in the below format
"OUTREC=(1:5,15000,15001:625C' '),CONVERT"
It is again coverted into VB of 15004 by just using OUTFIL FTOV.
Please let me know if you have any doubts and let me know what I can do now to get the result

Re: Variable block to Fixed block conversion

PostPosted: Fri Aug 19, 2011 5:42 am
by dick scherrer
Hello,

let me know what I can do now to get the result


If the records are too long to post, you can still look the first few on your terminal. . .

Browse one file (hex on)
Split the screen
Browse the other (hex on)
Sync both screens and then srcoll right until you find the dofference

Or write some code to compare the files byte-by-byte and identify any difference(s).