
Miscellaneous notes on IEC0SCR1, the MVS38j TRKCALC macro support routine.

In UTRK3390, there is a TRKCALC FUNCTN=TRKBAL,MAXSIZE=YES routine which
could bear some further explanation.  Specifically, how the DL is calculated.
I had these calculations in the code, but it was just too unwieldy.


Given formulas:
===============


FS = DL + 6DN           (FreeSpace was adjusted to remove 6 bytes of overhead)

     DL + 6
DN = ------ + R         where 0 <= R < 1; R is the Round-up factor
       232


Calculate DL, given FS:
=======================


FS = DL + 6DN

     232DL + 6DL + 36 + 232R
FS = -----------------------
             232

232FS = 238DL + 36 + 232R

     232FS - 36   232R 
DL = ---------- - ----
        238       238 


Calculate DN, given FS:
=======================


     DL + 6 
DN = ------ + R
       232

       232FS - 36   232R
       ---------- - ---- + 6
           238      238
DN = ----------------------- + R
              232

     232FS - 36 - 232R + (6 * 238) + 232R
DN = ------------------------------------
               238 * 232

     FS    (6*238) - 36 - 232R
DN = --- + -------------------
     238       238 * 232

     FS 
DN = --- + R                (more or less)
     238


The code (near label TBCKMAX and following) pretty well explains it 
from there.

Jim Morrison
Jan 19, 2002


