               job  Read detail records
               ctl  6611
     *
     * Set a word mark in 1.  Read detail records from cards if there
     * are any.  Otherwise if 81 is not GM (program is not loaded from
     * tape) stop.  Otherwise read a record from tape into 1. If 80
     * is  A, branch to 1.  When running from tape and reading detail
     * cards before reading detail records from tape, insert the chain
     * loader below after the detail cards for each program.
     *
     * org at 336 so the program isn't clobbered by CS chained to W.
     *
               org  336
     detail    sw   1              In case we're done
     switch    blc  done           End of cards?
               r    chain          Read detail or chain loader
     done      bce  tape,81,"      GM means program loaded from tape
               h    done           No, halt
     tape      rtw  1,1            Read detail or chain loader
               ber  taperr
     chain     bce  1,80,A         Chain load?
               b    cont           No, back to program
     taperr    bsp  1
               h    tape
               dcw  #1
     *
     cont      equ  *&1
               job  Chain loader if program on tape and detail on cards        A
     *
     * Here's the chain loader if loading from tape and reading
     * detail from cards.
     *
               org  1
               sw   a,b
     a         sw   c,btape
     b         lca  btape&4,switch&4  Quit reading cards
     c         cs   detail,80
     btape     bin  tape,
