IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

fields in the beginning/end of the record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Mar 16, 2011 5:05 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Mar 16, 2011 5:12 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Mar 16, 2011 5:32 pm
Reply with quote

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
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Wed Mar 16, 2011 6:07 pm
Reply with quote

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
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Mar 16, 2011 6:18 pm
Reply with quote

thanks a lot you all.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top