Q: How to call SQR from SQL*Forms 3.0 on a VMS or OpenVMS platform (SQR v2.5.x /3.0.x - Oracle v6/7)

A: The Advantages, Disadvantages and Requirements are the same as for UNIX platforms - see the section for UNIX - above.

The steps for calling an SQR program with the USER_EXIT command are:
  • Compile the sqrexit.pc program.
  • Create the Oracle IAPXTB table.
  • Create the iapxtb.mar program and compile it.
  • Modify the liap.com and liad.com files and re-link the iap30 and iad30 executables.
  • Create a form to call SQR as a user exit.
  • Run the form.

    Calling an SQR program with the HOST command only requires the last two steps above.

       Following is a step by step description of the above:
    
       Calling SQR from Oracle SQL*FORMS 3.0 with the user_exit command on VMS:
    
    1) Change to the SQLFORMS30 directory.
    
    		$ set def  ORA_SQLFORMS30
    
    2) Create a symbol called SQRLIB to point to the SQR lib directory. For example:
    
    		$ SQRLIB:=disk_drive:[sqr_install.ora.workbench.lib]
    
    3) The file sqrexit.pc is provided as an all purpose user exit for passing
       values from SQL*FORMS and calling SQR. Use it as is or alter it to suit your
       requirements. Copy it from the SQR lib directory and precompile using PROC.
    
    		$ copy  'sqrlib'sqrexit.pc  sqrexit.pc
    		$ proc iname=sqrexit ireclen=132 oreclen=132
    
         Compile the resulting C program.
    
         (VMS)     	$ cc sqrexit.c
         (openvms) 	$ cc/standard=vaxc /float=ieee /extern_model=common sqrexit.c
    
    4) Create the table IAPXTB if it does not already exist. Use GENXTB to create
       it.
    
    	$ genxtb username/password
    
         Insert the user exit name into the IAPXTB table.
    		
    	$ runform30 genxtb username/password
    
    			********* GENXTB *********
    	User Exit       Type	 Remarks		Creation 	Modify
    	SQREXIT		 C	 SQR User Exit
    
         Enter the name, type, and description of  the user exit and press COMMIT
         to save it. Exit the form.
    
         Generate a macro assembler program (iapxtb.mar) using genxtb.
    		
    		$ genxtb username/password iapxtb.mar
    
         Assemble the resulting macro program.
    
    		$ macro iapxtb.mar
    
    5) Insert the object modules sqrexit and iapxtb into the SQL*FORMS library
       iapxtb.olb.
    
    		$ lib/insert iaplib sqrexit,iapxtb
    
         If the iapxtb module was already in the library, replace the old version
         instead.
    
    		$ lib/replace iaplib iapxtb
    
    6) Modify the SQL*FORMS linking script (liap.com) to add references to the SQR
       programs and library. Add the line in bold corresponding to your version of
       Oracle.
    
    	Before:
    
    	 $ @ora_rdbms:loutl  ora_sqlforms30_exe:'executable$$' -
             'exits'-
    	 sf:'IAPLIB'/lib/include('iapmain'iaparg,ipagch),-
    	 'menulibs'-
    	 sf:iaxlib/lib,-
    	 sf:typlib/lib/include=typnu2,-
    		     .          .        .             .
    
    	After:
    
    	 $ @ora_rdbms:loutl  ora_sqlforms30_exe:'executable$$' -
    	 'exits'-
    	 sf:'IAPLIB'/lib/include('iapmain'iaparg,ipagch),-
    	 'menulibs'-
    Oracle6  'sqrlib'dbcalxl6,'sqrlib'sqr/lib/include=(sqrerr,sqrvers,ucall,ufunc),-
    Oracle7  'sqrlib'dbcalxl7,'sqrlib'sqr/lib/include=(sqrerr,sqrvers,ucall,ufunc),-
    	 sf:iaxlib/lib,-
    	 sf:typlib/lib/include=typnu2,-
    		     .          .        .             .
    
    7) Relink a new runform30 executable (xiap30.exe) which includes SQR.
    
    		$ gliap sqrexit,iapxtb
    
    8) Define a new runform30 symbol for this new executable.
    
    		$ runform30x:==$ORA_SQLFORMS30:xiap30
    
    9) In order to use the user exit, you need to create a form using SQLFORMS30,
       and use the package procedure USER_EXIT to run the SQR program. For example:
    
    	In KEY-COMMIT trigger:
    
    		user_exit('sqrexit test.sqr -eout.err');
    
        Compile the form with the following command:
    
          		$ iag30 -ot formname username/password
    
    10) Run the form with the new runform30x executable.
    
    		$ runform30x formname username/password
    
    11) A version of ucall.c (called ucallfrm.pc) includes an SQR CALL routine
        named PUTFORM for copying data back to SQL*FORMS from SQR. Should you want
        to use PUTFORM, copy ucallfrm.pc and precompile using PROC.
    
               	$ copy  'SQRLIB'ucallfrm.pc ucallfrm.pc
    		$ proc iname=ucallfrm.pc ireclen=132 oreclen=132
    
          Compile the resulting C program
    
          (VAX) 	$ cc ucallfrm.pc
          (openvms)	$ cc/standard=vaxc /float=ieee /extern_model=common ucallfrm.c
    
          The changed line in LIAP.COM (step 6) becomes:
    
         Oracle6:
         ucallfrm,'sqrlib'dbcallxl6,'sqrlib'sqr/lib/include=(sqrerr,sqrvers,ufunc),-
    
         Oracle 7:
         ucallfrm,'sqrlib'dbcallxl7,'sqrlib'sqr/lib/include=(sqrerr,sqrvers,ufunc),-
    
          Relink the runforms30 executable as described in step 7.
    
          The SQR command for placing data back on the form is:
    
    		CALL PUTFORM USING {block.field} {$var}
    
          Where block.field is the name of the field in SQL*FORMS you want to
          replace. The value to replace must be a string variable. For example:
    
    		CALL PUTFORM USING 'reports.rows' $rows-processed
    
    		-----------------------------------------
    
       Calling SQR from Oracle SQL*FORMS 3.0 with the host command on VMS
    
    1) In order to use the host command, you need to create a form using SQLFORMS30,
       and use the package procedure HOST to run the SQR program. For example:
    
          In KEY-COMMIT trigger:
    
    		host('sqrexit test.sqr -eout.err');
    
          Compile the form with the following command:
    
          		$ iag30 -ot formname username/password
    
    2) Run the form with the runform30 executable.
    
    		$ runform30 formname username/password