Passing Variables...
Posted in 1999
Topics: SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL, Migration, Import/Export & Data Conversion
I am working a series of reports that are going to be the end of me yet. I am on a very old version of the engine so I cannot do remote connections so to gather and co-mingle data from 4 different databases running under 4 different environments I am going to have to use a shell script to switch environents, fire off data collection modules, unload to flat files and then load the flat files into 4 tables and do my joins so I can generate the reports. My problem is... I need to limit the queries by date ranges. Does anyone have an idea how I can pass the date ranges from the shell script that fires off the 4gl collection modules and back to the shell script. I can't use globals because when I switch environments I will lose the globals... Any help would be apprecaited. Thanks, Dana
Hi! You can call 4gl programs with parameters like myprog.4ge "01/01/1999" "31/12/1999" use arg_val(n) function to read them from the command line. HTH Michael dana wrote: > I am working a series of reports that are going to be the end of me yet. > I am on a very old version of the engine so I cannot do remote > connections so to gather and co-mingle data from 4 different databases > running under 4 different environments I am going to have to use a shell > script to switch environents, fire off data collection modules, unload > to flat files and then load the flat files into 4 tables and do my joins > so I can generate the reports. My problem is... > I need to limit the queries by date ranges. Does anyone have an idea how > I can pass the date ranges from the shell script that fires off the 4gl > collection modules and back to the shell script. I can't use globals > because when I switch environments I will lose the globals... > Any help would be apprecaited. > Thanks, Dana
Thanks for your help Michael, Do you know of any way to pass parameters back to the shell script? In order to do what I need to do I need to go between 4 different environments and in order to make it possible I need to figure out a way to pass the params back to the script so they can be passed to the next 4gl in the sequence. Thanks, Dana Michael Krzepkowski wrote: > > Hi! > > You can call 4gl programs with parameters like > myprog.4ge "01/01/1999" "31/12/1999" > > use arg_val(n) function to read them from the command line. > > HTH > > Michael > > dana wrote: > > > I am working a series of reports that are going to be the end of me yet. > > I am on a very old version of the engine so I cannot do remote > > connections so to gather and co-mingle data from 4 different databases > > running under 4 different environments I am going to have to use a shell > > script to switch environents, fire off data collection modules, unload > > to flat files and then load the flat files into 4 tables and do my joins > > so I can generate the reports. My problem is... > > I need to limit the queries by date ranges. Does anyone have an idea how > > I can pass the date ranges from the shell script that fires off the 4gl > > collection modules and back to the shell script. I can't use globals > > because when I switch environments I will lose the globals... > > Any help would be apprecaited. > > Thanks, Dana
Hi! If you just need to check for success or failure the 4ge returns zero to shell if it had "exit program (0)". If you need to return more complex values Create a file or files with either one or many values and retrieve them in the shell using sed, awk, grep or similar tools and pass them to the next 4ge. Try to put as much control as you can into shell script, it should be easier. HTH Michael dana wrote: > Thanks for your help Michael, Do you know of any way to pass parameters > back to the shell script? In order to do what I need to do I need to go > between 4 different environments and in order to make it possible I need > to figure out a way to pass the params back to the script so they can be > passed to the next 4gl in the sequence. > Thanks, Dana > > Michael Krzepkowski wrote: > > > > Hi! > > > > You can call 4gl programs with parameters like > > myprog.4ge "01/01/1999" "31/12/1999" > > > > use arg_val(n) function to read them from the command line. > > > > HTH > > > > Michael > > > > dana wrote: > > > > > I am working a series of reports that are going to be the end of me yet. > > > I am on a very old version of the engine so I cannot do remote > > > connections so to gather and co-mingle data from 4 different databases > > > running under 4 different environments I am going to have to use a shell > > > script to switch environents, fire off data collection modules, unload > > > to flat files and then load the flat files into 4 tables and do my joins > > > so I can generate the reports. My problem is... > > > I need to limit the queries by date ranges. Does anyone have an idea how > > > I can pass the date ranges from the shell script that fires off the 4gl > > > collection modules and back to the shell script. I can't use globals > > > because when I switch environments I will lose the globals... > > > Any help would be apprecaited. > > > Thanks, Dana