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

[sqr-users] exists () function not working - Any work around suggestion?




Right after my code below in my first email where I check if the ACI file 
exists I do a check to see if the file /tmp/sss2034.spf can be accessed and 
if it exists for processing


SQC is below:

If I do not have the proper permissions to access the /tmp/sss2034.spf
and the ACI file does not exist.  The process monitor says "Processing" and 
there is no update of the message text on the process monitor.  And the 
error message in the SQR.log is an SQR generated error message "(SQR 6002)
Can't open the printer file: /tmp/sss2034.spf
13): Permission denied"

If I do not have the proper permissions to access the /tmp/sss2034.spf file 
and the ACI file does exist.  The process monitor says "ERROR" and there is 
an update of the message text on the process monitor.  And the error message 
in the SQR.log is from my SQC "Cannot open report file: /tmp/sss2034.spf"

Here is the SQC code:

!----------------------------------------------------------------------!
!  Function:    Perform-Check                                          !
!----------------------------------------------------------------------!

begin-procedure Perform-Check
let $sql-statement = 'SSSOUT.SQC,Perform-Check'

begin-select ON-ERROR=SQL-Error

RUN.SRVRDESTFILE,
RUN.CLNTDESTFILE,
RUN.RUNLOCATION

    let $run_loc                = &run.runlocation
    if $run_loc = '2'
       let $run_dest    = &run.srvrdestfile
    else
       let $run_dest    = &run.clntdestfile
    end-if
    let $run_dest = rtrim($run_dest, ' ')

    #debuge show 'Run location    : ' $run_loc
    #debuge show 'Run destination : ' $run_dest

from PSPRCSRUNCNTL RUN

where   RUN.OPRID       = $prcs_oprid
and     RUN.RUNCNTLID   = $prcs_run_cntl_id

end-select

! Test directory exists and is accessible
    let $sys_command    = 'cd ' || $run_dest
    #debuge show 'System command  : ' $sys_command
    CALL SYSTEM USING $sys_command #comm_status
    let $comm_err       = 'N'
    if $run_loc = '1'
       if #comm_status < 32                     ! Windows
          let $comm_err = 'Y'
       end-if
    else
       if #comm_status != 0                     ! Unix
         let $comm_err  = 'Y'
       end-if
    end-if
    #debuge show 'Command error   : ' $comm_err
    if $comm_err = 'Y'
       let $filerror = 'Cannot access output directory: ' || $run_dest
       show $filerror (+1,5) bold
       let #prcs_run_status     = #prcs_run_status_error
       let $prcs_message_parm1  = $run_dest
       let #prcs_message_nbr    = 17
       let #prcs_continuejob    = 0
       do Update-Prcs-Run-Status
       stop
    end-if

! Test report file can be opened for writing by this user
    close 12
    #debuge show 'SQR report      : ' $sqr-report
    let $programfile = substr($sqr-report, 1, length($sqr-report)-3) ||
'spf'   ! change .lis to .spf

    open $programfile as 12 for-writing record=80:fixed status =
#programfile_status

    #debuge show 'Report file     : ' $programfile
    #debuge show 'File status     : ' #programfile_status

    if #programfile_status <> 0
       let $filerror = 'Cannot open report file: ' || $programfile
       show $filerror (+1,5) bold
       let #prcs_run_status     = #prcs_run_status_error
       let #prcs_message_nbr    = 37
       let #prcs_continuejob    = 0
       do Update-Prcs-Run-Status
       stop
    end-if
end-procedure !Perform-Check


Thanks Kirk


>From:  "Lynds,Rick" <rlynds@mwdh2o.com> on 02/28/2003 11:00 AM
>Please respond to sqr-users@sqrug.org@SMTP@Exchange
>To:    sqr-users@sqrug.org@SMTP@Exchange
>cc:
>Subject:       RE: [sqr-users] exists( ) not working - Any work around 
>suggestio 
>n?
>
>The function is working properly - it does get to the routine 
>"Print-error".
>
>Looks to me like your problem is access to the /tmp directory where the SQR
>is running.  Note the message:
>
>(SQR 6002) Can't open the printer file: /tmp/sss2034.spf
>(13): Permission denied
>
>It is trying to print your error message - but it is unable to open the 
>.spf
>file. (That is the file produced prior to reformatting it to whatever 
>output
>format you chose).
>
>Be sure your access to the /tmp directory is set up properly for the 
>account
>that is actually logged in to the server.  (VP1?)
>
>HTH
>
>Rick Lynds
>Metropolitan Water District
>
>-----Original Message-----
>From: Kirk Katzbet [mailto:kk_413@hotmail.com]
>Sent: Friday, February 28, 2003 8:43 AM
>To: sqr-users@sqrug.org
>Subject: [sqr-users] exists( ) not working - Any work around suggestion?
>
>
>Thanks in advance:
>
>Has anybody experienced the exist() function not working.  I get a value
>that is not zero and my sqr does not seem to recognize this.  yet if I show
>the value it is 2.0.  Is there any other way to determine if a file doe not
>exist?  Here is my code below (ia m using SQR version 3.0.12.4):  In
>procedure "print-error" it does not display the $filerror in the log and 
>the
>
>process monitor does not get displayed.  It does not make into the 
>procedure
>
>"Update-App-Error"
>
>
>   let #exists = exists($file)
>   if #exists <> 0
>     let $filerror = 'ACI file not found ' || $file
>     if #prcs_process_instance = 0
>
>        input $answer '*** ACI file not found'
>
>     end-if
>     do print-error
>     let #Ret_Code = 3
>     do Update-App-Error
>     stop
>   end-if
>
>!--------------------------------------------------------------------!
>!  Print Error                                                       !
>!--------------------------------------------------------------------!
>begin-procedure Print-Error
>      #debug do debug-msg('Print-Error')
>
>   if $filerror <> 'N'
>     Use-Report Combined_Clients
>     print $filerror                       (+2,5) bold
>     do Check-Current-Line
>     display $filerror
>     Use-Report Summary
>     print $filerror                       (+2,5) bold
>   end-if
>
>end-procedure  !Print-Error
>
>
>!--------------------------------------------------------------------!
>! Update Application Error                                           !
>!--------------------------------------------------------------------!
>Begin-Procedure Update-App-Error
>    #debug do debug-msg('Update-App-Error')
>
>    if #prcs_process_instance > 0
>
>       let #prcs_message_set_nbr = #prcs_msg_set_nbr
>       let #prcs_message_nbr   = 0
>       let #prcs_run_status    = #prcs_run_status_error
>       let #prcs_rc            = #ret_code
>       let $prcs_message_parm1         = $filerror
>       let #prcs_continuejob   = 30    !set to blank
>       do Update-Prcs-Run-Status
>
>    end-if
>
>End-Procedure ! Update-App-Error
>
>++++++++++++++++++++++++++
>Here is the error log
>
>SQR: Structured Query Report Writer V3.0.12.2
>Copyright (C) MITI, 1994, 1995.  All Worldwide Rights Reserved.
>
>
>----------------------------------
>Begin-Report
>
>
>----------------------------------
>Declare-Cycle-Variables
>
>
>----------------------------------
>Init-Report
>
>
>FYAP Clients Combined
>
>Begin Job: 2003-02-25 16.18.06
>
>
>----------------------------------
>Get-Run-Control
>
>Process instance  :8325
>Old run status    :7.000000
>8324.000000
>Process instance :8325
>New run status   :7.000000
>Prcs Instance : 8325.000000
>(SQR 2908) Warning: Cannot CLOSE file 1 -- file not opened.
>
>dbname        : FSDEV
>Proc Instance : 8325
>Oprid         : VP1
>ACI file     : /home/fsdev/fs512/FSDEV/COMBCLI/combcli.txt
>
>ACI file     : /home/fsdev/fs512/FSDEV/COMBCLI/combcli.txt
>
>2.000000
>
>----------------------------------
>Print-Error
>
>(SQR 6002) Can't open the printer file: /tmp/sss2034.spf
>(13): Permission denied
>
>SQR: Program Aborting.
>
>
>Thanks Kirk
>
>
>
>
>
>_________________________________________________________________
>Add photos to your messages with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>
>_______________________________________________
>sqr-users mailing list
>sqr-users@sqrug.org
>http://www.sqrug.org/mailman/listinfo/sqr-users
>
>_______________________________________________
>sqr-users mailing list
>sqr-users@sqrug.org
>http://www.sqrug.org/mailman/listinfo/sqr-users
>
>
>
>
>
>_________________________________________________________________
>STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
>http://join.msn.com/?page=features/junkmail
>







_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users