View previous topic :: View next topic
|
Author |
Message |
jctgf Currently Banned Active User
Joined: 04 Nov 2006 Posts: 109
|
|
|
|
hi,
is it true that it is possible to reduce the execution time of a batch COBOL program just by having the most referenced fields of the input/output records in the beginning of it?
someone here in the company i work for claims he got great results just by doing this sort of change.
i can't see how it could be true since processors today are very powerful, there are lots of memory available and operations that take place in it (memory) usually are very low cost.
thanks. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You could test this but...as you say, processors are very fast - VERY fast - so you would have to generate a heck of a lot of test data to verify it -probably a million or so records. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Such a change may have helped 30 -- or more -- years ago, but I doubt there would be much of a difference running on z/OS with Enterprise COBOL. And I doubt if it ever made much difference unless the record length was more than 4096 bytes. Modern machines run millions of COBOL statements per second of CPU time so any processing difference has to be massive (or there has to be a LOT of data being processed) for any such differences to be detectable. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
I doubt that the difference will be significant because mainframes are record oriented. (I am assuming that you are reading z/OS data sets rather than Unix files). When you read a record, the entire record is made available to the program immediately; it does not read fields as they are referenced.
The position of the field within the record might matter in cases where the program logic scans the input record byte by byte until it reaches the field that it is interested in. You might need to do this if the field is not in a fixed position in the record, but most of the time the position is defined in advance and you refer to it by a field name.
I conducted a quick experiment using a very simple Cobol program that reads a file into a working storage area and moves one field to another working storage area. The file had about 7 million records, lrecl=300, recfm=fb.
Test #1: Move 1 byte field from position 1 in the record: 0.93 CPU seconds
Test #2: Move 1 byte field from position 299 in the record: 0.92 CPU seconds
Test #3: As a control, another version of the program just read the file without moving anything: 0.86 CPU seconds |
|
Back to top |
|
|
jctgf Currently Banned Active User
Joined: 04 Nov 2006 Posts: 109
|
|
|
|
thanks a lot you all. |
|
Back to top |
|
|
|