by subroutines do you mean functions? I’m interpreting it as that, you can’t define functions but you can use Actions (plenty out on google regarding C# Actions) which then can be called like a function. define that at the top like the example below.
Action AddMiscCode = (miscCode, packNum) =>
{
using(var custShipSvc = Ice.Assemblies.ServiceRenderer.GetService(Db))
{
CustShipTableset csts = new CustShipTableset();
csts = custShipSvc.GetByID(packNum);
custShipSvc.GetNewShipMisc(ref csts, packNum, 0, 0);
custShipSvc.GetShipMiscDefaults(ref csts, miscCode);
var x = csts.ShipMisc.Where(r => r.Added()).FirstOrDefault();
x.DocMiscAmt = 999999.99M;
x.DspMiscAmt = 999999.99M;
x.MiscAmt = 999999.99M;
custShipSvc.Update(ref csts);
}
};