  We derive the initial condition for the perturbative fragmentation function
of a heavy quark through order O(alpha_s^2) in the MS-bar scheme. This initial
condition is useful for computing heavy quark (or lepton, in case of QED)
energy distributions from calculations with massless partons. In addition, the
initial condition at O(alpha_s^2) can be used to resum collinear logarithms
ln(Q^2/m^2) in heavy quark energy spectrum with next-to-next-to-leading
logarithmic accuracy by solving the DGLAP equation.
