Page 1 of 1

VB to VB copy using SORT.

Posted: Sat Jan 07, 2017 8:25 am
by Rozi Lakhani
Hi,

I have to copy a VB to a new VB file. In this, I need to see if there is a records of length of 500 then I need to make it 480. Is that possible using SORT. Please help me.

Re: VB to VB copy using SORT.

Posted: Sat Jan 07, 2017 4:01 pm
by nicc
How do you identify which record of 500 bytes is to be reduced in length - if there are more than two types. Which 20 bytes are not to be copied? Does the 500 bytes include the RDW?

Re: VB to VB copy using SORT.

Posted: Tue Jan 10, 2017 11:42 am
by Rozi Lakhani
I don't know whoe to check on the lenght. But every record will have RDW.
if there are more than two types
I did not get you. Can you please explian it again.

Re: VB to VB copy using SORT.

Posted: Wed Jan 11, 2017 11:19 pm
by William Collins
You will have some records of 500 (or 496 or 504) bytes. You intend to lose 20 bytes. Which ones? Are they all the for same type of record (nicc's point)? If not, how are the records you want to lose data for identified?

Re: VB to VB copy using SORT.

Posted: Thu Jan 12, 2017 2:19 pm
by Rozi Lakhani
I forgot to tell the main information, the LRECL is 1000 and it should remain same after copy too. I need to find all the records which are of length 500 in the current file and last 20 butes should be removed while we copy it to output.

Re: VB to VB copy using SORT.

Posted: Sat Jan 14, 2017 1:39 pm
by William Collins
You need, on INREC, to have IFTHEN=(WHEN=(logicalexpression to test the record-length part of the RDW on each variable-length record for being 500, in binary (you define the field as binary). Then you BUILD=(1,4,5,476) and that is it.

Re: VB to VB copy using SORT.

Posted: Wed Jan 18, 2017 10:40 am
by Rozi Lakhani
Thanks William. :)