Put these in Input.txt and run
$AMJ000100030001
GD10
PD10
H
$DTA
Hello
$END0001
Prints Hello
$AMJ000200030001
GD10
LR12
SR15
PD10
H
$DTA
I LIKE THIS PEN OF
$END0002
Should Print "I LIKE THIS PEN OF HIS"
$AMJ000300120001
GD20
PD20
GD30
PD30
GD40
GD50
LR20
CR30
BT11
PD50
H
PD40
H
$DTA
VIIT
VIIT
IS SAME
IS NOT SAME
$END0003