Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
fields in the beginning/end of the record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: fields in the beginning/end of the record
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: 1894
Location: UK

PostPosted: Wed Mar 16, 2011 5:12 pm    Post subject:
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: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Mar 16, 2011 5:32 pm    Post subject:
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: 658
Location: Whitby, ON, Canada

PostPosted: Wed Mar 16, 2011 6:07 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us