Aircraft: A340
Phase of flight: Descent
Anomaly: ATC Issue All Types; Airspace Violation All Types

At Sector 86; I observed a westbound target at FL380 south of MARIG. I verified my strips to ensure that I did not have anyone coming in from that vicinity and noted that the only aircraft at FL380 due in my sector was Boeing at SAVIK. The Boeing was a northbound flight that should not have been near MARIG. I confirmed with the Ocean Sector 24 Controller that there was no one in bound from the east and then verified with the Ocean Sector 87 Controller that the Boeing was not deviating; including requesting an ADS position report from the Boeing. Shortly thereafter; an A340 checked in on frequency. I had no information on this aircraft and asked him to standby. The Boeing then checked in. The Boeing was given a squawk and his position from SAVIK was verified. As soon as the Boeing was RADAR identified; the aircraft was cleared to descend to FL360 to prevent a loss of separation with the A340. The A340 was given a code and was then RADAR identified. The Boeing was then cleared to JFK without further incident. At Sector 86; I observed a westbound target at FL380 south of MARIG. I verified my strips to ensure that I did not have anyone coming in from that vicinity and noted that the only aircraft at FL380 due in my sector was the Boeing at SAVIK. The Boeing was a northbound flight that should not have been near MARIG. I confirmed with the Ocean Sector 24 Controller that there was no one in bound from the east and then verified with the Ocean Sector 87 Controller that the Boeing was not deviating; including requesting an ADS position report from the Boeing. Shortly thereafter; the A340 checked in on frequency. I had no information on this aircraft and asked him to standby. The Boeing then checked in. The Boeing was given a squawk and his position from SAVIK was verified. As soon as the Boeing was RADAR identified; the aircraft was cleared to descend to FL360 to prevent a loss of separation with the A340. The A340 was given a code and was then RADAR identified. The Boeing was then cleared to JFK without further incident. The A340's routing was verified to enable flight plan entry and was cleared direct SIE. The ZDC Controller working the SIE Sector was contacted to ensure flight data was passed on the A340 and the aircraft proceed to SIE and subsequently IAD. Santa Maria needs a procedure to ensure that flight data is passed to New York Ocean. Aircraft unable to log in CPDLC and not hearing from ATC for close to 3 hours need to at least suspect that there might be a problem; especially when the only system message they receive is that they are logged into a facility on the other side of the continent. The A340's routing was verified to enable flight plan entry and was cleared direct SIE. The ZDC Controller working the SIE Sector was contacted to ensure flight data was passed on the A340 and the aircraft proceed to SIE and subsequently IAD. Recommendation; Santa Maria needs a procedure to ensure that flight data is passed to New York Ocean. Aircraft unable to log in CPDLC and not hearing from ATC for close to 3 hours need to at least suspect that there might be a problem; especially when the only system message they receive is that they are logged into a facility on the other side of the continent. ZNY Controller described an unsafe condition when traffic inbound from the Santa Maria facility was NORDO for some time; developing into a separation problem. The reporter suggests improved procedures between the two subject ATC facilities.