Assalamualaikum ustaz. Should the saf for prayer be formed when the iqamah is called or after the iqamah has finished?
Waalaikumussalam wrt. wbt.,
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions, and all those who follow his footsteps until the Final day.
Basically, among the manners of congregational prayer is to ensure the saf is straightened neatly. It is sunnah for the imam not to start the prayer before the saf is straightened and it is also sunnah for the imam to instruct the makmum who is behind him to straighten the saf. If the mosque is big, it is sunnah to appoint someone to ensure all the safs is straightened by going on rounds or instructing the other congregants to do so (in a raised voice).
It is also sunnah for everyone who is in attendance (in the saf) to ask others to fill or complete the saf if he sees any defects or empty space in the saf. The reason is it is included in amar makruf and also helping in goodness and obedience, where completing the sad is included as the perfection of prayer. 
From Anas bin Malik RA, Rasullullah PBUH said:
سَوُّوا صُفُوفَكُمْ فَإِنَّ تَسْوِيَةَ الصَّفِّ مِنْ تَمَامِ الصَّلاَةِ
“Straighten your rows. for the straightening of a row is a part of the perfection of prayer.” 
The Advantages of the First Saf
Furthermore, praying in the first saf has various advantages as stated in numerous narrations. Among the advantages of praying in the first saf is Allah and the angels will offer praise and salutations for them. This is based on a narration from Abd al-Rahman bin ‘Auf, he said Rasullullah PBUH said:
إِنَّ اللَّهَ وَمَلاَئِكَتَهُ يُصَلُّونَ عَلَى الصَّفِّ الأَوَّلِ
‘‘God and His angels bless the first row.” 
Imam al-Munawi when commenting on this hadith said: It means Allah and His angels will bless them (those who pray in the first saf) by asking for their forgiveness. 
Moreover, Rasullullah PBUH also stated the advantages that if they have to draw lots, then surely they would do so in order to get the first saf. Rasullullah PBUH said:
لَوْ يَعْلَمُ النَّاسُ مَا فِي النِّدَاءِ وَالصَّفِّ الأَوَّلِ، ثُمَّ لَمْ يَجِدُوا إِلاَّ أَنْ يَسْتَهِمُوا عَلَيْهِ لاَسْتَهَمُوا
“If the people were to know what excellence is there in the Adhan and in the first row, and they could not (get these opportunities) except by drawing lots, they would have definitely done that.” 
According to the above hadith, if people truly know the great rewards and advantages of praying in the first saf, then surely, they’d scramble to have the opportunity to fill the first saf. So much so that if there is no other way, surely, they’d use the method of drawing lots to determine who’ll get to fill the first saf.
When should the saf be formed?
Coming back to the above question, saf should start to be formed as soon as the iqamah is called. This follows a narration from Abu Hurairah RA, he said:
أُقِيمَتِ الصَّلاَةُ فَسَوَّى النَّاسُ صُفُوفَهُمْ
“Once Iqama was pronounced and the people had straightened the rows,” 
The above narration clearly shows that the saf is straightened after the iqamah is called. For the dalalah letter, ‘الفاء’ between them shows to the order. This opinion is strengthened with narration from Anas bin Malik RA, when he stands to pray when the muezzin was pronouncing:
قَدْ قَامَتِ الصَّلَاة
‘‘The time for prayer has come.”
Sa’id Ibn al Musayyib said:
إِذَا قَالَ الْمُؤَذِّنُ الله أَكْبَرُ وَجَبَ الْقِيَامُ وَإِذَا قَالَ حَيَّ عَلَى الصَّلَاةِ عُدِّلَتِ الصُّفُوفُ وَإِذَا قَالَ لَا إِلَهَ إِلَّا اللَّهُ كَبَّرَ الْإِمَامُ
“When the muezzin said ‘الله أَكْبَرُ’ it is obligatory (for the makmum) to stand and when the muezzin said ‘حَيَّ عَلَى الصَّلَاةِ’ the saf is straightened and when the muezzin said ‘لَا إِلَهَ إِلَّا اللَّهُ’, the imam will start with the takbir.” 
Thus, every makmum who attends the congregational prayer should be alert and vigilant when the iqamah is called. When the muezzin called the iqamah they should immediately stand and be in the saf neatly and straight.
 See al-Mu’tamad fi al-Fiqh al-Syafi’i, 1/439
 Narrated by al-Bukhari (723) and Muslim (433)
 Narrated by Ibn Majah (999)
 Narrated by al-Bukhari (615)
 Narrated by al-Bukhari (640)