RE: Passing a value from Unix into 4GL ?
Posted in 2004
This is a multi-part message in MIME format. ------_=_NextPart_001_01C43F0E.D6D47466 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thank you very much. I tried this and it worked very well. =20 I played around with the RETURN syntax, forgetting about the EXIT syntax. =20 =20 Thanks Fernando. =20 Regards Dirk =20 =20 -----Original Message----- From: Fernando Ortiz [mailto:fortiz@lacorona.com.mx]=20 Sent: Thursday, May 20, 2004 8:28 PM To: Dirk Moolman; informix-list@iiug.org Subject: Re: Passing a value from Unix into 4GL ? =20 Hi Dirk, =20 There's a workaround if the unix command only returns ONE integer value. =20 As you can see I'm not a shell programmer, but the following script do a line count in the file given as first parameter and then returns the line count as the exit code. =20 [ortiz@adela bin]$ cat cuenta #/bin/bash a=3D`wc -l $1` b=3D`echo $a | cut -f 1 -d \\ ` exit $b =20 And this small 4gl, prompts for a file name, runs the shell script and returns the 'exit code' from the script. =20 [ortiz@adela bin]$ cat cuenta.4gl MAIN =20 DEFINE w_arch char(30), w_comm char(80), w_line smallint =20 PROMPT "File name ? " FOR w_arch LET w_comm =3D "cuenta ", w_arch RUN w_comm RETURNING w_line LET w_line =3D w_line / 256 DISPLAY "LINES =3D ", w_line =20 END MAIN =20 =20 =20 The programs works BUT I need to divide the returning value by 256, maybe is a problem in my linux port. =20 [ortiz@adela bin]$ fglgo -V INFORMIX-4GL Version 7.30.UC7 Pcode Version 730 =20 =20 HTH ----- Original Message -----=20 From: Dirk Moolman <mailto:DirkM@mxgroup.co.za> =20 To: informix-list@iiug.org=20 Sent: Thursday, May 20, 2004 10:56 AM Subject: Passing a value from Unix into 4GL ? =20 I am searching the net, but can't find an answer yet. =20 =20 How can I run a 4GL, that will run a Unix command, and then keep the result of the Unix command in a variable in the 4GL ? =20 =20 Example: =20 =20 Let's say I have a script that does a word count (wc) on a file. I want to run this script from a 4GL program, and then use the result of the word count in the 4GL. =20 Should be simple, but I don't know how ... =20 =20 =20 =20 =20 Dirk Moolman Database and Unix Administrator MXGROUP =20 =20 "People demand freedom of speech as a compensation for the freedom of thought which they seldom use."=20 -Kierkegaard=20 =20 =09 =09 =09 =09 ________________________________ << ella for Spam Control >> has removed 976 Spam messages and set aside 515 Newsletters for me You can use it too - and it's FREE! www.ellaforspam.com =20 ------_=_NextPart_001_01C43F0E.D6D47466 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dus-ascii"> <meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)"> <style> <!-- /* Font Definitions */ @font-face {font-family:Courier; panose-1:2 7 4 9 2 2 5 2 4 4;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} p.MsoPlainText, li.MsoPlainText, div.MsoPlainText {margin:0in; margin-bottom:.0001pt; font-size:10.0pt; font-family:"Courier New";} span.EmailStyle18 {font-family:Arial; color:navy;} @page Section1 {size:8.5in 11.0in; margin:1.0in 77.95pt 1.0in 77.95pt;} div.Section1 {page:Section1;} --> </style> </head> <body bgcolor=3Dwhite lang=3DEN-US link=3Dblue vlink=3Dpurple> <div class=3DSection1> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Thank you very much. I tried = this and it worked very well.</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>I played around with the RETURN = syntax, forgetting about the EXIT syntax.</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Thanks Fernando.</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Regards</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Dirk</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 = face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original = Message-----<br> <b><span style=3D'font-weight:bold'>From:</span></b> Fernando Ortiz [mailto:fortiz@lacorona.com.mx] <br> <b><span style=3D'font-weight:bold'>Sent:</span></b> Thursday, May 20, = 2004 8:28 PM<br> <b><span style=3D'font-weight:bold'>To:</span></b> Dirk Moolman; informix-list@iiug.org<br> <b><span style=3D'font-weight:bold'>Subject:</span></b> Re: Pass