Thank you, Ty. Below is my code for the reading buffer.
inst.write('FORM:ELEM READ, TIME')
inst.write('SYST:ZCH ON')
inst.write('CURR:RANG 2e-9')
inst.write('INIT')
inst.write('SYST:ZCOR:ACQ')
inst.write('SYST:ZCOR ON')
inst.write('TRAC:CLE')
inst.write('TRIG:COUN 100')
inst.write('TRAC:POIN 100') # Set no. of pt in the buffer
inst.write('TRAC:FEED SENS')
inst.write('TRAC:FEED:CONT NEXT')
inst.write('SYST:ZCH OFF')
time.sleep(2)
inst.write('INIT')
databuffer= inst.query('TRAC:DATA?', delay= 28)
print(inst.query('SYSTem:ERRor?'))
inst.write('*RST')
-----
I believe that I misunderstood TRAC:DATA. The statement asks the machine to return values stored in buffer to the computer's memory. I should have SYST:ZCH OFF' before TRAC:FEED SENS and TRAC:FEED:CONT NEXT because TRAC:FEED asks the machine to read current values to store in buffer (in the above case, 100 points in buffer).
BTW, do I need TRAC:FEED:CONT NEXT, which seems to be redundant for reading current values to buffer?
What about TRIG:COUN 100? TRAC:POIN 100 is the command to allocate 100 points in buffer for 100 current values in the later code.
Below is my code for READ. It seems to be straightforward and has no problem.
inst.write('SYST:ZCH ON')
inst.write('CURR:RANG 2e-9') # set to 2nA-range for ZCOR
inst.write('INIT')
inst.write('SYST:ZCOR:ACQ')
inst.write('SYST:ZCOR ON')
inst.write('CURR:RANG:AUTO ON')
inst.write('SYST:ZCH OFF')
inst.query(':READ?')