We report the fabrication and testing, at 4.2 K, of an S1IS2FS3 device, where S, F, and I denote a superconductor (Nb), a ferromagnetic material (Permalloy), and an insulator (AlOx), respectively. The F layer covers about one half of the top electrode of the S1IS2 Josephson junction and is positioned off-center. Electric current, Itr, along the S3 electrode can change the magnetization of the F layer in such a way that, for one direction of Itr, a magnetic flux penetrates the junction perpendicular to the layers, whereas for the opposite direction, the perpendicular magnetic flux can be removed. In the former state, the modulation pattern of the Josephson critical current, Ic, in the magnetic field, H, may acquire minimum near H = 0 and restores its usual shape with maximum in the second state. These states can be used for building a compact cryogenic memory compatible with single flux quantum electronics.