Some of the you could get through macro variables created automatically by DIS, such as rc, job name, start and end time.
Records before/after you probably need some PROC CONTENTS/SASHELP.VTABLE query.
I recommend that you carefully examine the code generated by DI Studio, and then try to a programming effort. Please get back if you any specific problem arises.
Data never sleeps