[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Fwd: Re: Open for reading without knowing full filename [GDnn P.TXT]



Title: RE: Fwd: Re: Open for reading without knowing full filename [GDnnP.TXT]

Hi Hrair,

What you want is to have your SQR construct something like the following:
        command.com /C dir c:\windows\desktop\gd*.* > c:\dirfile.txt

You can experiment with that on your computer (Win95/98, right?)

So, using the following variables:
        Let $SrcDir = 'C:\windows\desktop\'
        Let $FilePrefix = 'gd'
        Let $DirFile = 'c:\dirfile.txt'         <-- note I made this full path

The construction of the command line would be:
        let $cmd = getenv('COMSPEC') || ' /C ' || 'dir '
        let $cmd = $cmd || $SrcDir || $FilePrefix || '*.*'
        let $cmd = $cmd || ' > ' || $Dirfile

The getenv('COMSPEC') will give you the appropriate 'secondary command processor' for your machine (e.g. command.com for Win95/98, cmd.exe for WinNT, varies for other OSs).

Then you just issue the CALL SYSTEM USING command thusly
        CALL SYSTEM USING $cmd #Status              <-- always useful to check status

You might want to put a show just before the CALL SYSTEM to display $cmd, to make sure syntax is what you intended; I always do that for test/debug purposes.

HTH
BOb

-----Original Message-----
From: Hrair Tcholakian [mailto:htcholakian@MBHCONSULTING.COM]
Sent: Thursday, January 27, 2000 11:25 AM
To: SQR-USERS@list.iex.net
Subject: Re: Fwd: Re: Open for reading without knowing full filename
[GDnnP.TXT]


Thanks for the quick reply Bob,

I tried the code you sent me but I keep getting the following:
Specified COMMAND search directory bad
Too many parameters
Too many parameters

c:\cs800\sqrw>

Am supposed to have the code in a specific section? What are your values
for or Where/how do you set the variables:
$SrcDir                           <- Mine is Let $SrcDir =
'C:\windows\desktop\'
$FilePrefix                       <-            Let $FilePrefix = 'gd'
$DATType                       <-            Let $DATType = 'p.txt'
$DirFile                           <-            Let $DirFile = 'dirfile.txt'

Thanks
-Hrair




At 11:36 PM 1/26/00 -0500, you wrote:
>>X-From_: owner-sqr-users@list.iex.net Wed Jan 26 17:48:04 2000
>>Date:         Wed, 26 Jan 2000 17:33:41 -0500
>>Reply-To: sqr-users@list.iex.net
>>Sender: "Discussion of SQR,
>>               Brio Technology's database reporting language"
>>               <SQR-USERS@list.iex.net>
>>From: Bob Buford-Abba Systems <bbuford@GALEIND.COM>
>>Subject:      Re: Open for reading without knowing full filename [GDnnP.TXT]
>>To: SQR-USERS@list.iex.net
>>
>>Hi,
>>
>>I have an application in which I needed to read a number of files
>>(quantity and name unknown until runtime) in a directory.  I set up an
>>array that holds the file names in setup paragraph.  I then did a Call
>>System for this command string:
>>let $cmd = getenv('COMSPEC') || ' /C dir ' || $SrcDir
>>let $cmd = $cmd || $FilePrefix || '*' || $DATType || ' > ' || $DirFile
>>call system using $cmd #status WAIT
>>
>>I opened dirfile.txt for reading, record=65, and put into the array any
>>line where the initial characters matched a prescribed filename prefix.
>>
>>Then in the main loop I just read each element of the array.
>>
>>Note that the filenames placed in the array were 8.3 format, but that
>>would work OK when I used that same filename in the OPEN command in the
>>main loop.
>>
>>Please write if any of this wasn't clear.
>>
>>Bob
>>
>>-----Original Message-----
>>From: Hrair Tcholakian
>>[<mailto:htcholakian@MBHCONSULTING.COM>mailto:htcholakian@MBHCONSULTING.COM]
>>Sent: Wednesday, January 26, 2000 4:51 PM
>>To: SQR-USERS@list.iex.net
>>Subject: Open for reading without knowing full filename [GDnnP.TXT]
>>
>>
>>Hi All,
>>
>>Is there a way to Open for reading without knowing full filename [GDnnP.TXT].
>>I have a specific directory that I need to read a file from but the name is
>>dynamic in a sense where the nn is a numeric value that could change. Path
>>is [   c:\temp\GDnnP.TXT  ]
>>
>>I'm running this on Windows95 against an Oracle DB. SQR version 3.x
>>
>>Thanks,
>>-Hrair
>
>--