Passing arguments to awk

I have an awk script below which I call using for example

awk -f ../../A-Scripts/select-model.awk iterations.txt 16x12 10

I want to be able to use it in a different way like this

awk -f ../../A-Scripts/select-model.awk iterations.txt nxz=16x12 iter=10

or 

awk -f ../../A-Scripts/select-model.awk iterations.txt iter=10 nxz=16x12

I might like to have some arguments optional as well so if iter is not passed,
the value of iter is defaulted to 10 say.

  BEGIN {

    if ( ARGC != 4 ) {
      Version = "V01"
      eg1 = "select-model.awk iterations.log 4x3 10 > model-10.xz"
      print ""
      print " ********************************************************"
      print " SCRIPT: select-model.awk "Version
      print " ERROR: Incorrect number of arguments"
      print " USAGE: awk -f select-model.awk fin nxz iter > fout"
      print " E.g. awk -f "eg1
      print ""
      print " CREATED BY: CHRISTOPHER DIMECH"
      print " ********************************************************"
      print ""
      exit 1
    }

    fin = ARGV[ARGC-3]
    nxy = ARGV[ARGC-2]
    iter = ARGV[ARGC-1]
    delete ARGV[ARGC-1]
    delete ARGV[ARGC-2]
    split(nxy, a, "x")
    nx = a[1]
    ny = a[2]
  }

# Arrange the model values in table form  and create the .vmod file

  {
    if ( $2 == iter":" )
    {

      print "% XI=(0,-0.5)"
      print "% XF=(80,20)"
      print ""
      print "%< LAYER 1"
      print ""
      print "% INTI=LIN"
      print "%( INTERFACE"
      print "0 0"
      print "80 0"
      print "%)"
      print ""
      print "% PS=OFF"
      print ""
      print "% INTP=LIN"
      print "%( MODELP"

      skip = 5   # Skip the first 5 fields
      for (i = 0; i < ny; ++i) {
        var = ""
        for (j = skip + 1; j <= NF; j += ny ) {
          var = var FS $(i + j)
        }
        print var
      }

      print "%)"
      print ""
      print "%>"

    }
  }

Execute your script like that:

awk  -viter=10 -vnxz=16x12 -f ../../A-Scripts/select-model.awk iterations.txt

Add this to your BEGIN clause:

if (length(iter)==0) iter=10

Also change/delete section that is getting arguments from ARGV to variables, as this won't be needed anymore.