convert ksh to C program


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting convert ksh to C program
# 1  
Old 09-14-2009
convert ksh to C program

Hi Guys...is there a way to convert a .ksh script to .C program..?
# 2  
Old 09-14-2009
you mean any tool??
if so.. I don't think there is any tool which can convert .ksh to .c..
# 3  
Old 09-15-2009
So is there a way to execute a block of ksh within c program...

e.g.

within shell script I can execute my DB2 program like follows...

------------------------------------
#!/bin/ksh -x

TIMESTAMP=`date '+%y%m%d%H%M'`
SCRPT_DIR=/scratch/appsupport/MODEL
SCRPT_NAME=${SCRPT_DIR}/*.sql
LogDir_SQL=${SCRPT_DIR}/logs
LogDir=/u01/db2/jobs/appsupport/logs
LogFile_SQL=${LogDir_SQL}/Model_appsupport_SQL_${TIMESTAMP}.log


db2 <<-EOF >>${LogFile_SQL} 2>&1
select * from employee

quit
EOF

exit
---------------------------------------

similarly can I execute the block mentioned above within a c program...?
Please help...
# 4  
Old 09-15-2009
DB2 used to have an api you could call from a C program. You really should be using that if it is avialble to you.

You can embed your script in a system() function call. However if you do this many, many times your C code will run very slowly. Plus you gain no measurable advantage over running it as a ksh script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert perl program to shell

Hi is there a way that i can convert this simple perl program into shell script #!usr/bin/perl -w use strict; use warnings; open INPUTFILE, "uniqprobecoordinates.out" || die "canot open the file $!"; open OUTPUTFILE, ">", "1_4reads.out"; while(<INPUTFILE>) { chomp; ... (3 Replies)
Discussion started by: bhargavpbk88
3 Replies

2. Shell Programming and Scripting

Convert Hex - KSH

Hello, I woild like to convert hex on KSH not BASH: I tried to use: tmp=31 printf "\x"${tmp}"" it works on bash - Output is '1' but not on ksh. please advice on the right syntax. Thanks. (4 Replies)
Discussion started by: LiorAmitai
4 Replies

3. Programming

C program - convert values based on the position

Hey! I'm new to C. I need to covert certain values using C. please see the below. I have figured out the logic to do it. Please provide some hints to do this with C Logic: If first position of POS = 0, shift POS to the left one byte. If third position of POS = 0, move spaces to third... (1 Reply)
Discussion started by: rocker_me2002
1 Replies

4. UNIX for Dummies Questions & Answers

convert a file from .ksh to .sh

hi I have written a shell scrpit in .ksh mode. I need to convert this scritp to .sh. What things i need to check while converting the file from .ksh to .sh. Could you please help me out. Thanks&Reagdrs Pavan Kumar (3 Replies)
Discussion started by: vnspkumar
3 Replies

5. Shell Programming and Scripting

Convert into C program

Hi, in this forum I was able to find a logic written by perderabo to write packed decimals. the code works fine. However, I would want to convert it to a c program. so as to do that I am not able to understand the below mentioned logic. Can someone please help me understand that? if... (0 Replies)
Discussion started by: hitmansilentass
0 Replies

6. Shell Programming and Scripting

Need to convert ksh script to Perl

Guys I am new to this forum, this may seem like a cheeky request. I have been asked by my manager to convert this ksh script to Perl. I do not have the foggiest about Perl and would appreciate any help on this. Basically this scipt automates a recovery process for EMC Legato Networker. It will... (1 Reply)
Discussion started by: rahimm1
1 Replies

7. Shell Programming and Scripting

please convert the below program into shell script

if ( ( grep -i "Exception : " /home/dklog* )) then echo " improper combination" elsif ( ( grep -i "invalid" /home/dklog*)) then echo " wrong process " fi fi in the above case i am facing the the syntx error please help in this case... (3 Replies)
Discussion started by: mail2sant
3 Replies

8. Shell Programming and Scripting

convert cpp program to c shell script ?

Hi guys I tried to convert this c++ code to c shell script but there are some bugs and I don't know how to solve it. This code prints the three variables in decreasing order: int main() { int x,y,z; cin >> x >> y >>z; if ( x < y ) if ( x < z ) if ( y < z ) cout << x <<" " <<... (2 Replies)
Discussion started by: domain
2 Replies

9. Shell Programming and Scripting

python code...convert to ksh or sh

Helloo... I am not much familiar with python..I found this small script in python I even do not have python on my computer...can anyone help me out to convert this into ksh or sh.. PLEASE any help I will appreciate.. here is python code.. #!/usr/bin/env python import random # Get a... (3 Replies)
Discussion started by: amon
3 Replies

10. UNIX for Dummies Questions & Answers

convert from ksh to bsh

How difficult is it to convert from bourn shell to korn shell and visversa. Reason: If someone bombsout or logs out incorrectly the application we are using give the next person to log in the same permissions as the person that bombed out. Therefore createing ownership problems on print files. (2 Replies)
Discussion started by: Boyd Young
2 Replies
Login or Register to Ask a Question