Machine-readable passports simply fill in the information that is already on the photo page of your passport (your last name, first & middle names, birthday, sex, the issuing country of the passport and the passport number). An old-style machine-readable passport is read optically (similar to a document scanner or camera) by the document reader, with the series of numbers at the bottom of the photo page (u201c XXX 123 u201d) being decoded by the computer. Biometric passports also prthe computer via the RFID chip in the passport and the RFID scanner in the document reader with the same information, along with a digital version of the photograph on your passport. Alternatively, if there is no document reader or the document reader is not available, the officer can manually key in the information.Below is the PIL query system used by CBP to scan your passport at airports and cruise ship terminals. As stated above, the blank spaces at the top of the screen are filled in by scanning your passport or alternately by manually keying in information. The digital photograph on a biometric passport is displayed in the square on the upper right corner of the screen. The highway PIL query at land borders operates on the same principle - except that the license plate information of the traveleru2019s vehicle is also entered into the system.After keying in the information, the computer will run the personu2019s names through various CBP and other law enforcement databases. Databases are kept for both immigration as well as customs violations. Searches are also run through various INTERPOL databases, the FBIu2019s National Crime Information Center as well as the RCMPu2019s Canadian Police Information Centre for any wants or warrants as well as criminality that may make the traveler inadmissible.If there is a possible name match, the system will look further at the date of birth and assign a score from to 100. A 100% match is where first, middle and last names are exactly the same as well as the date of birth. Wants and warrants may also come with various cautions - such as u201cknown to escape authorityu201d or u201cviolentu201d to allow the officer to determine what appropriate action to take.If the traveler requires a visa, the immigration box will also remind the officer to check for a visa. If the passport is detected by the computer to be fraudulent or stolen (from the INTERPOL databases) it will also be notated here.Finally, at the bottom, there are two buttons (not shown in screenshot) - u201creleaseu201d or u201crefer.u201d If the traveler is not to be referred to secondary inspection, the officer will click release, stamp the traveleru2019s passport (except for American and Canadian passports - which are stamped only upon request or at the officeru2019s discretion) and code the declaration form for the traveler to be released. If the officer decides that the traveler needs to be referred to secondary inspection, refer is clicked, and afterwards, it will ask the officer what type of referral (immigration secondary or customs secondary - both can be checked) and what was the reason for the referral (mandatory - ie. goods to declare or lookout on traveler, or selective - ie. traveleru2019s story does not add up, officer wants to investigate further). The system also generates random referrals at a 2% rate, and should there be a random referral or a lookout on the traveler, the release button is automatically blocked off. Once the traveler is referred, the officer will notate the daily u201chit codeu201d and code the referral reason on the declaration form and direct the traveler to claim his bags. The traveleru2019s passport will not be stamped because they have not yet been authorized to enter as they are being subject to additional inspection. The point officer (the one guarding the exit and collecting declaration forms from traveler) will check the code on the declaration card, and if the hit code is present, the traveler will be directed into secondary inspection.Regardless of whether or not you have been referred, your passage through the port will be noted into CBPu2019s database. Any officer on any future trip will be able to pull up the details of this passage, which notes down the date and time of the passage, the location (right down to which lane or self-service kiosk you used), the passport number of the passport used, whether or not you were referred to secondary, if you were referred, the reasons for referral and the end result of the secondary inspection. The user ID of the officer who scanned your passport is also notated down. As part of an agreement with Canada, this information is also shared with the Canada Border Services Agency, and as such entries into the US from Canada are notated as an exit record for Canada (and vice versa) - which makes it easier for Canadian authorities to crack down on potential overstayers or Canadians who are overstating their length of absence in order to claim a duty-free exemption they would in reality not be entitled to when returning to Canada.Source: I am a CBP officer