View previous topic :: View next topic
|
Author |
Message |
mahaes
New User
Joined: 04 Jul 2006 Posts: 6
|
|
|
|
PLZ GIVE THE REASON..
why REORDER is used inthe pl/1 coding.. |
|
Back to top |
|
|
Kodisala
New User
Joined: 13 Apr 2005 Posts: 5 Location: Hyderabad
|
|
|
|
REORDER is one of the optimization options that are specified for a procedure or begin-block. The REORDER option allows the compiler to generate optimized code to produce the result specified by the source program when error-free execution takes place. |
|
Back to top |
|
|
mahaes
New User
Joined: 04 Jul 2006 Posts: 6
|
|
|
|
hi, i didnt understand clearly from these lines....
can u explain little bit clear...
plz.. |
|
Back to top |
|
|
rskumar
New User
Joined: 21 Nov 2005 Posts: 35 Location: chennai
|
|
|
|
hi Mahesh,
REORDER keyword in PL/I is similar to the Defragmentation process that u carry on in WINDOWS OS. The unused space in between the arrays, variables etc get removed and the entire space is available for us to store data.
whenever v see the space in a drive in windows, the system specifies the free space it has but when u try to copy a file to that space of the specified size, you will get an error msg. meaning: the system shows you the unused space by the applications but not the end space in the hard disk. Disk Defragmentation just reorders the space, or reshuffles the space and makes the entire unused space available for us.
hope this is clear for you.
rskumar :-) |
|
Back to top |
|
|
mahaes
New User
Joined: 04 Jul 2006 Posts: 6
|
|
|
|
thanks kumar for explaining the concept in a very clear manner..... |
|
Back to top |
|
|
MCEVOY
New User
Joined: 21 Nov 2005 Posts: 18
|
|
|
|
I think you will find that the main purpose of the REORDER option is to allow the optimising compiler to change the sequence of operations from what the programmer has coded to a more efficient way of arriving at the same result.
For example, unnecessary repetition of assignments within DO loops can be avoided by moving the assignment outside the loops.
If you don't code REORDER, then ORDER applies by default.
I always code REORDER as I can never think of a reason not to. |
|
Back to top |
|
|
kunasatheesh
New User
Joined: 27 Sep 2007 Posts: 6 Location: Hyderabad India
|
|
|
|
Thanks for question as well as for answer...good one .. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
REORDER keyword in PL/I is similar to the Defragmentation process that u carry on in WINDOWS OS. The unused space in between the arrays, variables etc get removed and the entire space is available for us to store data. |
could not be more wrong ...
please post the link where You found such a wrong definition |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
And apparently that completely wrong answer has been out there for almost 3 years |
|
Back to top |
|
|
kunasatheesh
New User
Joined: 27 Sep 2007 Posts: 6 Location: Hyderabad India
|
|
|
|
Hi Enrico,
If you know the answer please post it, i m unable to find in that link. Please post it.
Hi Babu,
If you know correct answer please post it. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
And apparently that completely wrong answer has been out there for almost 3 years |
it happens
when I see that a topic has been updated I just look at the date of the last post, and after I scroll backwards to see what has been going on
( I forget to check the dates sometimes ) |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
unable to find in that link |
freshen up Your searching and reading skills for manuals
start from
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IBMSH350
click on ( Search Documents ), will get You to
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IBMSH350?filter=&SEARCHBS=Search+Documents
in the search box type reorder and click on (Search), will get You to
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IBMSH350?searchRequest=reorder&SEARCH=Search&Type=FUZZY&SearchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK
click on the programming reference link and the programming guide
it will tell the (RE)order effects
the (RE)order option is a bit misleading in its wording
PL/I when optimizing will allways shuffle code around ( like taking things out of loops )
as long as there are no side effects ( see order/reorder issues )
for example write a stupid program with
Code: |
dcl 1 structa ,
2 field1a ...
2 field2a ...
2 field3a ... ;
dcl 1 structb ,
2 field1b ...
2 field2b ...
2 field3b ... ;
|
make sure that the fieldxa and fieldxb are defined in the same way
play around moving fields from one structure to the other one in different order
Code: |
field1a = field1b
field2a = field2b
field3a = field3b |
if You have the compiler generate the assembler listing
You will see what happens with different optimizations
if the data type are the same PL/1 will use simple MVC machine instructions
and ( unless the compiler has become suddenly stupid ) for the assignments above it should use one and only one MVC instruction
and if You carry on the assignments in reverse order PL/1 will anyway realize that the fields are contiguous components of structures
and use ..... one simple MVC
I'll try to test it later on and post exhaustive results |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
Some compilers use REORDER to indicate that the compiler can reorder assembler instructions to take advantage of the fetch/decode/execute pipeline in the hardware. For example, it might specially order instructions that don't use the same registers so they can run through the pipeline without conflicts and delays. Some modern hardware implements out of order execution to try to do the same thing. Does PL/I do that optimization with REORDER? The doc seemed vague but implied this might be the case. |
|
Back to top |
|
|
|