[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Return Codes issued by an SQR program?



The #variable you want to set is #return-status.

#return-status is one of those variables contained in one of the standard
sqc's that are normally included in most peoplesoft sqrs:

        #include 'tranctrl.sqc'  ! Tools transaction control module
        #include 'setenv.sqc'    ! Set environment procedure
----------------------------------------------------------------------------
In your sqr, here is the sort of code you need to write:

begin-procedure SQLError

   #debuga display 'Processing: SQLError'

   let #return-status = 1         ! Prevents next step in shell script
                                  ! jobstream from being executed if
                                  ! a fatal SQL Error occurs.
   add 1 to #SQLErrCount

   print 'SQL Error'        (+1,1,9)
   print #InputTran         (0,+6,6)    edit 99,999
   print $SetID             (0,+8,5)
   print $Project_Id        (0,+6,15)
   print $ErrField          (0,+6,15)
   print $ErrDescr          (0,+6,50)

   print 'SQL status:'      (0,+6,11)
   print #sql-status        (0,+2,7)    edit 9999999.99
   print $sql-error         (+1,1,170)

   do Rollback-Transaction

   stop quiet

end-procedure SQLError
-----------------------------------------------------------------------

If you are running from unix, the catching statement in your script looks
something like this:

$SQRDIR/sqr $SQR_PRG1 batch/batch@$DB_INSTANCE.world -debuga -E
-F$OUTPUT_FIL1
            -M$PS_SQR/allmaxes.max        >> $LOG_FIL

retval=$?

if [ $retval -ne 0 ]
then
    msg  "Error: SQR program error($SQR_PRG1)"
    exit 1
fi

----------------------------------------------------------------------------
---------------

Gracen Duffield
Texas Department of Housing and Community Affairs
475-3839


-----Original Message-----
From: Bill Milano [mailto:Bill_Milano@AMSINC.COM]
Sent: Monday, June 21, 1999 2:31 PM
To: Multiple recipients of list SQR-USERS
Subject: Return Codes issued by an SQR program?


Hi,

I'm relatively new to the mailing list, so I may really be displaying my
ignorance here but here goes...

I can't find this in the SQR documentation and none of my co-workers know:
Is there a way to get an SQR program to issue standard system return codes?

Currently, I'm working with a few people to use SQR as cross-platform data
conversion and interface tool. We want to string a number of processes
together dependent on the return codes of each, but I can't seem to find a
documented way to get an SQR program to return one.

Any help would be appreciated.

Thanks in advance,
Bill Milano
Senior Principal
AMS, Inc.