Checking for file existence in SPL
Posted in 2006
Randy (IDS 9.40 on HP-UX) wanted a delete trigger's SPL procedure to create rows only if a corresponding .tif file physically exists, but SPL can't check the filesystem and can't capture a shell script's return value. Suggestions: have the shell script insert a row into a table that the SPL then queries, or trap a return code in an exception block; several posters argued the real answer is to do the work outside SPL in a host language (ESQL/C, Perl, Java, 4GL) or to write a C/Java UDR that tests for the file. No confirmation from the poster of which approach he adopted.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
Informix 9.40.FC3 HPUX 11.11 I have an SPL routine that create entries in a set of tables for use by another program that inserts documents into an EDM system. I only want to create the records when I have ensured that the physical .tif file exists. This SPL is being called from a delete trigger so I only have that specific time to deal with the recordset. I can easily check for file existence via a shell script, and I have another SPL that runs a shell script, but the manual says that SPL can't use any return values from a shell script and I don't see anything in the manuals that describe checking file system from within SPL. Am I out of luck? Thanks, Randy
I have never done this but I was going to I would create a shell that checks for the file and then if it exists add a record to a table with a value of the parameter passed to script. Have your SPL call the above script then let SPL check table for a record of the value equal to the value you passed to the above script. Kennedy, Randy wrote: > Informix 9.40.FC3 > HPUX 11.11 > > I have an SPL routine that create entries in a set of tables for use by > another program that inserts documents into an EDM system. I only want > to create the records when I have ensured that the physical .tif file > exists. This SPL is being called from a delete trigger so I only have > that specific time to deal with the recordset. I can easily check for > file existence via a shell script, and I have another SPL that runs a > shell script, but the manual says that SPL can't use any return values > from a shell script and I don't see anything in the manuals that > describe checking file system from within SPL. > > Am I out of luck? > > Thanks, > Randy > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --
Write it in a host language: ESQL/C, Perl-DBD/DBI, Java-JDBC, 4GL, etc. SQL & SPL are NOT universal programming tools! Art S. Kagel ----- Original Message ----- From: Randy Kennedy <ids@iiug.org> At: 11/20 17:16:44 Informix 9.40.FC3 HPUX 11.11 I have an SPL routine that create entries in a set of tables for use by another program that inserts documents into an EDM system. I only want to create the records when I have ensured that the physical .tif file exists. This SPL is being called from a delete trigger so I only have that specific time to deal with the recordset. I can easily check for file existence via a shell script, and I have another SPL that runs a shell script, but the manual says that SPL can't use any return values from a shell script and I don't see anything in the manuals that describe checking file system from within SPL. Am I out of luck? Thanks, Randy ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum.
write a C-udr to test for file probably easiest, shouldn't take long _____ Original message _____ Subject: Checking for file existence in SPL [7839] Author: "Kennedy, Randy" <RKennedy@scottsdaleaz.gov> Date: 21st November 2006 2:7:48 AM Informix 9.40.FC3 HPUX 11.11 I have an SPL routine that create entries in a set of tables for use by another program that inserts documents into an EDM system. I only want to create the records when I have ensured that the physical .tif file exists. This SPL is being called from a delete trigger so I only have that specific time to deal with the recordset. I can easily check for file existence via a shell script, and I have another SPL that runs a shell script, but the manual says that SPL can't use any return values from a shell script and I don't see anything in the manuals that describe checking file system from within SPL. Am I out of luck? Thanks, Randy ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum.
While I have to agree with Art, I happen to be working through some SPL issues for a client who has made a conscious decision NOT step outside of SPL. I have been facing a number of challenges in this arena (there's an interesting post/talk in here somewhere). You can set a return code and capture it in the exception block. For anything more extensive, load a table from the system process and then read it in the SPL. j. -----Original Message----- From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org]On Behalf Of ART KAGEL, BLOOMBERG/ 731 LEXIN Sent: Monday, November 20, 2006 5:21 PM To: ids@iiug.org Subject: Re: Checking for file existence in SPL [7841] Write it in a host language: ESQL/C, Perl-DBD/DBI, Java-JDBC, 4GL, etc. SQL & SPL are NOT universal programming tools! Art S. Kagel ----- Original Message ----- From: Randy Kennedy <ids@iiug.org> At: 11/20 17:16:44 Informix 9.40.FC3 HPUX 11.11 I have an SPL routine that create entries in a set of tables for use by another program that inserts documents into an EDM system. I only want to create the records when I have ensured that the physical .tif file exists. This SPL is being called from a delete trigger so I only have that specific time to deal with the recordset. I can easily check for file existence via a shell script, and I have another SPL that runs a shell script, but the manual says that SPL can't use any return values from a shell script and I don't see anything in the manuals that describe checking file system from within SPL. Am I out of luck? Thanks, Randy **************************************************************************** *** Forum Note: Use "Reply" to post a response in the discussion forum. **************************************************************************** *** Forum Note: Use "Reply" to post a response in the discussion forum.
Write a UDR in C or Java that check if the file exists ! Sérgio Ferreira > Write it in a host language: ESQL/C, Perl-DBD/DBI, Java-JDBC, 4GL, etc. > SQL & > SPL are NOT universal programming tools! > > Art S. Kagel > ----- Original Message ----- > From: Randy Kennedy <ids@iiug.org> > At: 11/20 17:16:44 > > Informix 9.40.FC3 > HPUX 11.11 > > I have an SPL routine that create entries in a set of tables for use by > another program that inserts documents into an EDM system. I only want > to create the records when I have ensured that the physical .tif file > exists. This SPL is being called from a delete trigger so I only have > that specific time to deal with the recordset. I can easily check for > file existence via a shell script, and I have another SPL that runs a > shell script, but the manual says that SPL can't use any return values > from a shell script and I don't see anything in the manuals that > describe checking file system from within SPL. > > Am I out of luck? > > Thanks, > Randy > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > >