Page 1 of 1

DFSORT FINDREP

PostPosted: Wed Nov 02, 2011 12:03 am
by johnwp53
Hi,
I'm executing the following to change loan numbers within a record.
A loan number can occur multiple times within a record and can be unsigned comp-3 and/or character.
The input file is VB 8192 and contains thousands of different record types.
The positions of the loan number/s within the records depends on the record type.
The FINDREP option below is simple and works OK but takes a long time to execute.
A couple of questions:
If the size of a record is say only 200 bytes, does the FINDREP stop at 200 bytes or continue to byte 8192?
Does each record get processed multiple times? i.e., in my case 4000 times.

OPTION COPY
INREC FINDREP=(INOUT=(C'0000000969907',C'0004000017999',
X'0000000969907F',X'0004000017999F',
C'0000000973130',C'0004000018007',
X'0000000973130F',X'0004000018007F',
C'0000000986943',C'0004000018018',
X'0000000986943F',X'0004000018018F',
...
... Repeated for a total of two thousand loan numbers
...
C'0000020840138',C'0004000044743',
X'0000020840138F',X'0004000044743F',
C'0000020842571',C'0004000044765',
X'0000020842571F',X'0004000044765F',
C'0000020850731',C'0004000044776',
X'0000020850731F',X'0004000044776F'))

Re: DFSORT FINDREP

PostPosted: Wed Nov 02, 2011 1:38 am
by Frank Yaeger
The input file is VB 8192 and contains thousands of different record types.

If the size of a record is say only 200 bytes, does the FINDREP stop at 200 bytes or continue to byte 8192?


It stops at the end of the record. It uses the RDW length to determine the length of the record.

Does each record get processed multiple times? i.e., in my case 4000 times.


Each record is only processed once but that processing consists of looking for each of your 4000 values at each position in your record.

Re: DFSORT FINDREP

PostPosted: Wed Nov 02, 2011 2:37 am
by johnwp53
Thanks for the quick reply Frank.
One more question:
If a match is found and replaced say with the 100th value are the remaining 3900 values skipped and processing within the record continued following the byte after the replaced value?

Re: DFSORT FINDREP

PostPosted: Wed Nov 02, 2011 4:53 am
by BillyBoyo
Do the records you are updating have at least one loan number in a fixed position? This would allow you to use your loan numbers as a "key" into the file and only do your FINDREP for those which exist within the FINDREP condition.

Maybe (you'd have to check on the limits) you could generate a whole bunch of ifs and only do do specific findreps if the condition is met.

If you are sorting the file anyway, you could also consider a Cobol "exit" and do it there, using SEARCH ALL against a table you loaded, and then a move to however many fields you need to.

I have no idea how many records you have on your file. Say you have 100,000. You are doing 4,000 * 200 (approximately, I assume the find stops when current position plus length "overlaps" the record), or about 800,000 tests per record, in my pretend example that would be 80,000,000,000 tests on the file. Even for "stopping early" when a hit is found, that would not save much.

You also have to be a little careful about changing something which isn't a loan number (say an amount).

However you do it, you should produce some "audit trail", ie before/after of records which change. The number of records changed, for instance, you should be able to predict - and reconcile any differences in counts (typos? loans redeemed/cancelled/whatever since list appeared).

Re: DFSORT FINDREP

PostPosted: Wed Nov 02, 2011 4:55 am
by Frank Yaeger
If a match is found and replaced say with the 100th value are the remaining 3900 values skipped and processing within the record continued following the byte after the replaced value?


Yes.