An SSR code allocation is not a simple task since there is a multitude of rules that define the availability of codes to be used, depending on the origin of the flight, the station that is assigning the code, destination of the flight, the ATC equipment available, among others.
On our Airspace, the allocation is made accordingly to the EUROCONTROL SSR CAL.
You can find a simplified version of the document, for Portuguese Airspace below.
It is organized between Domestic, Departures, Arrivals and Transit. On each category you can find the different code blocks and the correspondent designation used on IVAC2.
Please note that the SSR Code Allocation for Arrivals and Transit shall only be done if the aircraft is inbound from an uncontrolled airspace.