Re: 4GL Command Line Processing
Posted in 1991
mtcdev!lei (Charles Lei) writes: > Can someone please advise how I can process command line arguments within > Informix 4GL, i.e. how does 4GL handle "argc" and "argv"? > > I would like to startup a program from the command line with an argument > that would specify a unique row, something like: > > a.out <customer #> > > In addition how would this work with RDS? Will something like > "fglgo program.4gi <customer #>" work? > > Thanks in advance for all replies. > Charles, The appropriate information is in Chapter 6 of the 4GL Reference Manual. Assuming you are using version 4.00, specifically the pages are 6-7R and 6-21R. If you don't have access to the manuals (why not?) then basically it goes like this: There is a function called arg_val which returns an argument from the command line to your program: arg_val(expr) where expr is an integer to define which arg you want. e.g. customer = argval(1) There a second function called num_args which returns the number of command line arguments: number_of_arguments = num_args() For example DEFINE customers ARRAY[8] of CHAR(10), i SMALLINT FOR i = 1 TO num_args() LET customers[i] = arg_val(i) END FOR calling sample.4ge smith jones brown black ... gives customers[1] = smith customers[2] = jones customers[3] = brown customers[4] = black : The same applies to RDS version as to the compiled version e.g. fglgo sample smoth jones brown black ... Ron Lees +-------------------------------------------------------------------+ | Ron Lees | | NEC Information Systems Australia Pty Ltd | | Software Development Centre (Canberra) | | | | Email: rlees@pdact.pd.necisa.oz.au | | Snail: PO Box 244, Belconnen ACT 2616, AUSTRALIA | | Voice: + 61 6 251 6411 | | Fax: + 61 6 251 6947 | +-------------------------------------------------------------------+