Page 1 of 1

Copy/relocate data from VB to FB dataset

PostPosted: Tue May 10, 2016 3:08 pm
by danny_ce16
I have a input VB file A with LRECL 573 and i need to generate a output FB file with LRECL 568. Both the files will look like below.

Input File A (in Hex format)

     A2        
10000CF400020100
4000C12000C5460C
 


I need to copy the data present in 11h position, 6 chars to File B, 13 to 18th position as below. 0 to 12 and 19 till end will be initialized by us and it wont change.

Output File B (in Hex format)

                             
000000000000020100
000C0000C000C5460C
 


We tired various methods (like one below) to copy but none seem to work as expected.


SORT FIELDS=COPY
OUTFIL FNAMES=FILEB,VTOF,OUTREC=(13:11,6,HEX,544X)
 


Kindly help us with this issue.

Re-titled

Re: Need help with sortcard

PostPosted: Tue May 10, 2016 10:06 pm
by BillyBoyo
It is not clear what you expect for output. The above would give you 12 blanks, 12 bytes of hexadecimal representation of the six bytes from position 11, and then 544 blanks. Is that anywhere close to what you want.

You need to show expected output for given input, and output you are receiving for given control cards. If you want all those blanks, just ditch the HEX bit and check your counting and you should be there.

Re: Need help with sortcard

PostPosted: Wed May 11, 2016 3:43 pm
by danny_ce16
Sorry for the ambiguity.

this input file would be spaces from position 14 till end of length (573)
    A2        
10000CF400020100444444444444 *TILL-LRECL-END*
4000C12000C5460C000000000000 *TILL-LRECL-END*


and output file would be low values from position 17 till end of length (568)

0000000000000201000000000000 *TILL-LRECL-END*
000C0000C000C5460C0000000000 *TILL-LRECL-END*

Re: Need help with sortcard

PostPosted: Wed May 11, 2016 4:58 pm
by enrico-sorichetti
when You post use a meaningful title
most of the people replying avoid as a plague the stupid titles

If You cannot describe Your requirements/ issues in 5/10 words than You have bigger problems

Re: Need help with sortcard

PostPosted: Wed May 11, 2016 5:12 pm
by danny_ce16
I need help with sortcard, to copy data (0C250416000C) from certain position (11,6) of VB file to a FB file (13,6). Rest of the data in output file will be constant and initialized by us, so no change in them. did i make it sound simple now? i tried hard to describe it in 5/10 words though.

Re: Need help with sortcard

PostPosted: Wed May 11, 2016 9:21 pm
by Terry Heinze
Maybe a better title would have been "Copy/relocate data from VB to FB dataset".

Re: Need help with sortcard

PostPosted: Thu May 12, 2016 11:37 pm
by Aki88
Hello,

danny_ce16 wrote:I need help with sortcard, to copy data (0C250416000C) from certain position (11,6) of VB file to a FB file (13,6). Rest of the data in output file will be constant and initialized by us, so no change in them. did i make it sound simple now? i tried hard to describe it in 5/10 words though.


If I've understood it right, see if the below code helps:


 OPTION COPY                                    
 OUTFIL VTOF,BUILD=(12X,15,6)         <--  Tweak SORT card here to add additional positions depending on your wish.
 



Input data with HEX ON; please note, I've used a random VB file as input, but with your input data at 11th position for 6 bytes, as the remaining positions are irrelevant (as stated in your post):

----+----1----+----2----+----3----+----4----+-
1604300304      000000---À/--- /À-- --ÀÁ ÂÂ/-Â
FFFFFFFFFF020100FFFFFF666666662666626666266666
1604300304C5460C00000000041000D1400D0045D22102


The output comes as:


Required data in 13th position -
                 
----+----1----+---
                 
444444444444020100
000000000000C5460C
 


Hope this helped.