$ !Defining global variables first
$ i = 0
$ fstring = ""
$ fnew = ""
$ inquire/global count "Enter No of Fields : "
$ Start_loop:
$ if i .ges. count
$ then
$     goto processit
$ else
$     inquire fl "Enter Start Position: "
$     inquire fe "Enter Length: "
$     if i .eqs. 0
$     then
$         fnew = fl+":"+fe
$     else
$         fnew = fnew+" "+fl+":"+fe
$     endif
$     i = i + 1
$     goto Start_loop
$ endif
$ processit:
$ show symbol fnew
$ write sys$output "Proceeding to Process string"
$ !exit

$ ! Reassignment of fnew to fstring
$ fstring = fnew

$ ! ------ Start of process string
$ SP1 = ""
$ SP1 = F$locate(" ",fstring)
$ i = 0

$ Start1:
$ length = F$LENGTH(fstring)
$ fnew = fstring
$ if i .GT. length then goto endit
$ SP2 = F$Extract(i,SP1,fnew)
$ show symbol SP2
$ i = i + SP1 + 1
$ fnew = f$Extract(SP1,length,fnew)
$ goto Start1
$ endit:
$ !exit
$ ! ------ end  of process string

$ kk = 0
$ jj = ""
$ fsss = ""

$ count = f$length(fstring)
$ write sys$output  "String length is : ",count

$ write sys$output "Alternate Process Output"
$ alt_loop:
$ !if kk .ges. count
$ !then
$ !    goto endloop
$ !endif 
$ !jj = f$element(kk,":",fstring)
$ !write sys$output "Starting Position : ",jj
$ !kk = f$locate(":",fstring)
$ !kk = kk + 1
$ !fsss = f$extract(kk,f$length(jj),jj)
$ !show symbol fsss
$ !show symbol kk
$ !goto alt_loop
$ !endloop:
$ !exit
