execute programs 4go in a directory different from the current
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hello to all: My question is the following one, how I can execute programs 4gl of another directory different from the current directory without placing all the PATH in the name of program 4go or frm for example the programs are in the directory /d4go the screens in the directory /dfrm my current directory is CD / mydir attempt to execute fglgo programa.4go and it does not work how it could do it or that parameters of surroundings I must modify so that it works? Thanks for everything En espa'ol Hola a todos: Mi pregunta es la siguiente, c'mo puedo ejecutar programas 4gl de otro directorio distinto al directorio actual sin colocar todo el PATH en el nombre del proglama 4go o los .frm por ejemplo los programas estan en el directorio /d4go las pantallas en el directorio /dfrm mi directorio actual es cd /midir intento ejecutar fglgo programa.4go y no funciona ' c'mo podr'a hacerlo o que parametros de entorno debo modificar para que funcione ? Gracias por todo _______________________ Para respuestas via e-mail quitar de la direcci'n "QUITALO" to answer via e-mail you must erase "QUITALO" into e-mail address freus@QUITALOdip-alicante.es
F. R. I. wrote in message <813b6a$se$1@diana.bcn.ttd.net>... >Hello to all: > > My question is the following one, how I can execute programs 4gl of another >directory different from the current directory without placing all the PATH >in the name of program 4go or frm for example > >the programs are in the directory /d4go >the screens in the directory /dfrm >my current directory is CD / mydir >attempt to execute fglgo programa.4go >and it does not work > You can address forms by putting /dfrm in DBPATH, but I don't think that works for programs. Your best bet is probably create your own environment variable and use a shell script: somewhere, like in /etc/profile or the user's .profile: RDSPROGPATH=/d4go export RDSPROGPATH shell, named rdsgo: fglgo $RDSPROGPATH/$1 the user would then type: rdsgo programa.4go >how it could do it or that parameters of surroundings I must modify so that >it works? > >Thanks for everything > > > En espa'ol > >Hola a todos: >Mi pregunta es la siguiente, c'mo puedo ejecutar programas 4gl de otro >directorio distinto al directorio actual sin colocar todo el PATH en el >nombre del proglama 4go o los .frm por ejemplo > >los programas estan en el directorio /d4go >las pantallas en el directorio /dfrm >mi directorio actual es cd /midir >intento ejecutar fglgo programa.4go >y no funciona > >' c'mo podr'a hacerlo o que parametros de entorno debo modificar para que >funcione ? > >Gracias por todo > > >_______________________ >Para respuestas via e-mail quitar de la direcci'n "QUITALO" >to answer via e-mail you must erase "QUITALO" into e-mail address >freus@QUITALOdip-alicante.es > > >
At our site, where we compile to 4gi, 4go and 4ge, all the programs are in their own directory, located under a top-level 'progs' directory. This progs directory is referenced by a $PROGS environment variable. To execute the program we have set up a "runapp" shell script which cd's into the $PROGS/<program> directory and then runs the 4ge (or 4go in your case). Common forms are placed in another directory $FORMS, and added to the DBPATH variable. The above solution works well with our development structure, in that the runapp script can check for a developer's working version of the program ($HOME/progs/<program>) and run this, otherwise the base version of the program is executed ($PROGS/<program>). The Unix CDPATH facility is used to accomplish this simply. Sample "runapp" script: #!/bin/ksh <set env vars> prog=$1 CDPATH=$HOME/progs:$PROGS if cd $prog then if [ -x $prog.4go ] then echo "Running $prog ..." fglgo $prog.4go fi fi # End sample runapp script Hope the above example helps, TTFN In article <81bo9g$kg11@webint.na.informix.com>, Dennis Pimple <dennisp@informix.com> writes > >F. R. I. wrote in message <813b6a$se$1@diana.bcn.ttd.net>... >>Hello to all: >> >> My question is the following one, how I can execute programs 4gl of >another >>directory different from the current directory without placing all the PATH >>in the name of program 4go or frm for example >> >>the programs are in the directory /d4go >>the screens in the directory /dfrm >>my current directory is CD / mydir >>attempt to execute fglgo programa.4go >>and it does not work >> > >You can address forms by putting /dfrm in DBPATH, but I don't think that >works for programs. Your best bet is probably create your own environment >variable and use a shell script: > >somewhere, like in /etc/profile or the user's .profile: >RDSPROGPATH=/d4go export RDSPROGPATH > >shell, named rdsgo: >fglgo $RDSPROGPATH/$1 > >the user would then type: >rdsgo programa.4go >>how it could do it or that parameters of surroundings I must modify so that >>it works? >> >>Thanks for everything >> >> >> En español >> >>Hola a todos: >>Mi pregunta es la siguiente, cómo puedo ejecutar programas 4gl de otro >>directorio distinto al directorio actual sin colocar todo el PATH en el >>nombre del proglama 4go o los .frm por ejemplo >> >>los programas estan en el directorio /d4go >>las pantallas en el directorio /dfrm >>mi directorio actual es cd /midir >>intento ejecutar fglgo programa.4go >>y no funciona >> >>¿ cómo podría hacerlo o que parametros de entorno debo modificar para que >>funcione ? >> >>Gracias por todo >> >> >>_______________________ >>Para respuestas via e-mail quitar de la dirección "QUITALO" >>to answer via e-mail you must erase "QUITALO" into e-mail address >>freus@QUITALOdip-alicante.es >> >> >> > > -- Simon Barber
Another option is to place a script named based on the root of the program
which executes the fglgo for the program in the home of the program or a
convenient bin directory. Then if latter you want to replace the R4GL
version with a C4GL or D4GL version you just change the script and noone
needs to change what they type. So if the programs is programa.4go then
in the path put:
PATH=/d4go:$PATH
in /d4go put a script programa containing:
#! /usr/bin/ksh
cmd=$_
dir=${cmd%%/tt}
prg=${cmd##*/}
if [[ -x $dir/${prg}.4go ]]; then
$dir/${prg}.4ge $*
else
fglgo $dir/${prg}.4go $*
fi
This is a generic script which can be linked to any program name and will
work without modification and will automatically use the compiled version
over the pcode version if available.
Art S. Kagel
Simon Barber wrote:
>
> At our site, where we compile to 4gi, 4go and 4ge, all the programs are
> in their own directory, located under a top-level 'progs' directory.
> This progs directory is referenced by a $PROGS environment variable.
>
> To execute the program we have set up a "runapp" shell script which cd's
> into the $PROGS/<program> directory and then runs the 4ge (or 4go in
> your case). Common forms are placed in another directory $FORMS, and
> added to the DBPATH variable.
>
> The above solution works well with our development structure, in that
> the runapp script can check for a developer's working version of the
> program ($HOME/progs/<program>) and run this, otherwise the base version
> of the program is executed ($PROGS/<program>). The Unix CDPATH facility
> is used to accomplish this simply.
>
> Sample "runapp" script:
>
> #!/bin/ksh
> <set env vars>
>
> prog=$1
> CDPATH=$HOME/progs:$PROGS
>
> if cd $prog
> then
> if [ -x $prog.4go ]
> then
> echo "Running $prog ..."
> fglgo $prog.4go
> fi
> fi
> # End sample runapp script
>
> Hope the above example helps,
>
> TTFN
>
> In article <81bo9g$kg11@webint.na.informix.com>, Dennis Pimple
> <dennisp@informix.com> writes
> >
> >F. R. I. wrote in message <813b6a$se$1@diana.bcn.ttd.net>...
> >>Hello to all:
> >>
> >> My question is the following one, how I can execute programs 4gl of
> >another
> >>directory different from the current directory without placing all the PATH
> >>in the name of program 4go or frm for example
> >>
> >>the programs are in the directory /d4go
> >>the screens in the directory /dfrm
> >>my current directory is CD / mydir
> >>attempt to execute fglgo programa.4go
> >>and it does not work
> >>
> >
> >You can address forms by putting /dfrm in DBPATH, but I don't think that
> >works for programs. Your best bet is probably create your own environment
> >variable and use a shell script:
> >
> >somewhere, like in /etc/profile or the user's .profile:
> >RDSPROGPATH=/d4go export RDSPROGPATH
> >
> >shell, named rdsgo:
> >fglgo $RDSPROGPATH/$1
> >
> >the user would then type:
> >rdsgo programa.4go
> >>how it could do it or that parameters of surroundings I must modify so that
> >>it works?
> >>
> >>Thanks for everything
> >>
> >>
> >> En español
> >>
> >>Hola a todos:
> >>Mi pregunta es la siguiente, cómo puedo ejecutar programas 4gl de otro
> >>directorio distinto al directorio actual sin colocar todo el PATH en el
> >>nombre del proglama 4go o los .frm por ejemplo
> >>
> >>los programas estan en el directorio /d4go
> >>las pantallas en el directorio /dfrm
> >>mi directorio actual es cd /midir
> >>intento ejecutar fglgo programa.4go
> >>y no funciona
> >>
> >>¿ cómo podría hacerlo o que parametros de entorno debo modificar para que
> >>funcione ?
> >>
> >>Gracias por todo
> >>
> >>
> >>_______________________
> >>Para respuestas via e-mail quitar de la dirección "QUITALO"
> >>to answer via e-mail you must erase "QUITALO" into e-mail address
> >>freus@QUITALOdip-alicante.es
> >>
> >>
> >>
> >
> >
>
> --
> Simon Barber