Sponsored Content
Full Discussion: Exit Code in HP-UX KSH.
Top Forums Programming Exit Code in HP-UX KSH. Post 17109 by mbb on Monday 11th of March 2002 10:37:40 AM
Old 03-11-2002
Exit Code in HP-UX KSH.

In one of my programs another process is called using the system command e.g.

lv_error = system("myproc");

where lv_error is declared as an int.

myproc would be returning 0 for success and 1 for failure. e.g.

if (success)
{
return(0);
}else{
return(1);
}

When the return code of myproc is examined in the shell via $? the value is reported correctly. When displayed in the calling C process a value of 0 or 1 is 256.

The man documentation is not very clear. It seems that 256 may correspond to -1 return code and that I should do some more checking after that.

Can anyone help?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Where can I find a list of exit codes? (Exit code 64)

I'm receiving an exit code 64 in our batch scheduler (BMC product control-m) executing a PERL script on UX-HP. Can you tell me where I can find a list of exit codes and their meaning. I'm assuming the exit code is from the Unix operating system not PERL. (3 Replies)
Discussion started by: jkuchar747
3 Replies

2. Shell Programming and Scripting

Need Clean Exit from KSH Status Loop

I have a ksh loop that monitors front panel key postitions. I need a keystroke or something to break out of the loop without exiting the script. Code is: #!/bin/ksh while true do POST=$(./keystat2 | nawk '{print $1}') if ]; then ... (2 Replies)
Discussion started by: ScottKe
2 Replies

3. UNIX for Advanced & Expert Users

How to exit the KSH functions

Hi I am having the script which contains more functions. I want to exit the function if any failure. I tried with exit - the session itself is getting logged out. How can i fix this issue? (11 Replies)
Discussion started by: sharif
11 Replies

4. Shell Programming and Scripting

HELP WITH .ksh script converting the exit status

Hi Can someone help me please? In a standard UNIX .ksh script, if you have the exit status..say 5...what line do you have to enter into the script for this number to be automatically converted to its actual exit reason by looking up the exit status file...wherever that is? thanks angus (1 Reply)
Discussion started by: angusyoung
1 Replies

5. Shell Programming and Scripting

Exit statement ignored inside KSH function

Hi All, I have multiple functions in my script and I'm trying to capture stdout from some of them, but I also do some error checking in them (in the functions that output something to their stdout that needs capturing) and I need to be able to end the entire script with an error message. ... (2 Replies)
Discussion started by: gkubok
2 Replies

6. Shell Programming and Scripting

KSH: Test telnet and exit

Hi, I need to do a test Telnet in KSH and if the connection is good then disconnect the telnet session with out logging in and without exiting the shell script. Example output of a good connection: $telnet xxx.xx.xx.xxx xxxx Trying xxx.xx.xx.xxx... Connected to xxx.xx.xx.xxx. Escape... (1 Reply)
Discussion started by: calex
1 Replies

7. Shell Programming and Scripting

Making a KSH exit if path is not correct

I am very green to shell programming and have no training and this is my first real attempt. I am fairly versed in Unix and running the cmds I need. I tried using the search feature but most of what I found was close but not quite what I am looking for, plus most looked more advanced than I... (7 Replies)
Discussion started by: htown71
7 Replies

8. Shell Programming and Scripting

Terminal is closing on exit in ksh

hi while executing the following script, my terminal window is getting closed if I enter a invalid option. I want the script should go back the the command prompt. how to do achive it. i execute the script as . ./test #! /usr/bin/ksh Printf " Type of Installer : \n\t\t 1. Whole Build... (3 Replies)
Discussion started by: vij_krr
3 Replies

9. Shell Programming and Scripting

KSH: Confused with behaviour of exit

Hi Everyone, I am confused on why the below snippet of code is not working as I intend it to do. I have googled and confirmed that "exit" is supposed to abort the execution of the script regardless if the exit was called from inside a function, or the main body of the script. log_and_die() { ... (3 Replies)
Discussion started by: maddmaster
3 Replies

10. Shell Programming and Scripting

Exit status of the ksh Script

Hi Im trying to write a script that will archive some file using java program.Below is the part of the script that I use and my problem is that the script always return with status 0.Below is part of my script(end part) purge.ksh echo "No of files before tar :... (4 Replies)
Discussion started by: saachinsiva
4 Replies
ODBC_PREPARE(3) 							 1							   ODBC_PREPARE(3)

odbc_prepare - Prepares a statement for execution

SYNOPSIS
resource odbc_prepare (resource $connection_id, string $query_string) DESCRIPTION
Prepares a statement for execution. The result identifier can be used later to execute the statement with odbc_execute(3). Some databases (such as IBM DB2, MS SQL Server, and Oracle) support stored procedures that accept parameters of type IN, INOUT, and OUT as defined by the ODBC specification. However, the Unified ODBC driver currently only supports parameters of type IN to stored procedures. PARAMETERS
o $connection_id -The ODBC connection identifier, see odbc_connect(3) for details. o $query_string - The query string statement being prepared. RETURN VALUES
Returns an ODBC result identifier if the SQL command was prepared successfully. Returns FALSE on error. EXAMPLES
Example #1 odbc_execute(3) and odbc_prepare(3) example In the following code, $success will only be TRUE if all three parameters to myproc are IN parameters: <?php $a = 1; $b = 2; $c = 3; $stmt = odbc_prepare($conn, 'CALL myproc(?,?,?)'); $success = odbc_execute($stmt, array($a, $b, $c)); ?> If you need to call a stored procedure using INOUT or OUT parameters, the recommended workaround is to use a native extension for your database (for example, mssql for MS SQL Server, or oci8 for Oracle). SEE ALSO
odbc_execute(3). PHP Documentation Group ODBC_PREPARE(3)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy