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

Re: [sqr-users] Call SYSTEM command in SQR



You have to know the structure of your unix file directory - Also you
need a space between cd and $datadirectory
$CMD = 'cd' || ' '||  $DataDirectory

yamuna_pandiyan@freddiemac.com wrote:
> 
> The following command works fine or the directory from where the SQR
> program runs - '/shared/main/prog/sqr'. This command does not look for the
> file in a different directory, i.e the data file resides in the data
> directory - ' /shared/main/files/data/'. This is true if the command is
> used with or without the predefined prefix variable.
> 
> Example, I copied the data file from the above data directory to the SQR
> directory and ran the program.The latest SAMPLE.DAT file name was written
> into the filename defined in the '$file_list' variable.
> 
> I did the cd command, $SqrDirectory = '/shared/main/prog/sqr'
>                       $DataDirectory = '/shared/main/files/data/'
> 
>                       $CMD = 'cd' || $DataDirectory
>                       $cmd = 'ls -lt SAMPLE.DAT >' || $DataDirectory ||
> $file_list
>                       call system using $syscmd #unix_status
> 
> I get the error - SAMPLE.DAT: No such file or directory
> 
> But the above command works fine if I copy the SAMPLE.DAT file into the SQR
> directory and use the following code,
> 
> $cmd = 'ls -lt SAMPLE.DAT >' || ' ' || $file_list
> call system using $syscmd #unix_status
> 
> Could you help me how to use the 'cd' command with 'ls' command or how to
> make the program to look for the data file in the data directory...?
> 
> Thanks,
> Yamuna
> 
> 
>              "Dattatraya
>              Shetty"
>              <datta_shetty@yah                                          To
>              oo.com>                   "This list is for discussion about
>                                        the SQR database reporting language
>   Sent by :                            from Hyperion Solutions."
>   sqr-users-bounces+yamuna_pan         <sqr-users@sqrug.org>
>   diyan=freddiemac.com@sqrug.o                                          cc
>   rg
>                                                                    Subject
>                                        Re: [sqr-users] Call SYSTEM
>              03/31/2005 01:25          command in SQR
>              PM
> 
> 
>              Please respond to
>                "This list is
>                for discussion
>                about the SQR
>                   database
>                  reporting
>                language from
>                   Hyperion
>                 Solutions."
>               <sqr-users@sqrug
>                    .org>
> 
> 
> 
> This fix is simple change the command to below
> let $syscmd = 'ls -lts SAMPLE.DAT >' || $file_list
>  call system using $syscmd #unix_status
>  if #unix_status != 0
>  stop quiet
>  end-if
> 
> No need to Add the fileprefix to ls command. Its a Unix command and if
> you add fileprefix to it the OS will try and execute the ls command
> from the path in fileprefix which is wrong because the ls command is
> not stored there. its some where in /usr/bin:
> if you need to give the path then log into unix and issue the following
> command
> 
> $> whence ls
> see the path displayed and use that.
> 
> HTH
> Datta.
> 
> --- yamuna_pandiyan@freddiemac.com wrote:
> 
> >
> > Hi Datta,
> >
> > The sqr program resides in the  ' /shared/main/prog/sqr'  directory.
> > The
> > data file is created in the ' /shared/main/files/data/' directory.
> > The <FILEPREFIX} is defined in the SQC which sets the environments.
> > There
> > is nothing wrong in the {FILEPREFIX} variable, since it woks fine
> > with all
> > other programs.
> >
> > But I am not able to debug, since I have limited knowledge on the
> > Call
> > System commands. When the below program is executed, the
> > Latestfile.dat is
> > created in the directory ' /shared/main/files/data/'.
> >
> > The error that is generated when executing the program is  'sh:
> > /shared/main/files/data/ls : not found' if I use the below command.
> > if I remove the {FILEPREFIX} from the command line, the following
> > error is
> > generated -   '/shared/main/files/data/ : cannot execute'
> >
> > Thanks,
> > Yamuna
> > 918-5127
> >
> >
> >
> >
> >              "Dattatraya
> >
> >              Shetty"
> >
> >              <datta_shetty@yah
> >   To
> >              oo.com>                   "This list is for discussion
> > about
> >                                        the SQR database reporting
> > language
> >   Sent by :                            from Hyperion Solutions."
> >
> >   sqr-users-bounces+yamuna_pan         <sqr-users@sqrug.org>
> >
> >   diyan=freddiemac.com@sqrug.o
> >   cc
> >   rg
> >
> >
> > Subject
> >                                        Re: [sqr-users] Call SYSTEM
> >
> >              03/30/2005 04:14          command in SQR
> >
> >              PM
> >
> >
> >
> >
> >
> >              Please respond to
> >
> >                "This list is
> >
> >                for discussion
> >
> >                about the SQR
> >
> >                   database
> >
> >                  reporting
> >
> >                language from
> >
> >                   Hyperion
> >
> >                 Solutions."
> >
> >               <sqr-users@sqrug
> >
> >                    .org>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi Yamuna,
> >     The Second part of the Problem is that FILEPREFIX may be an
> > environment
> > variable not defined?
> >
> > In the fist part the $ is missing for an environment variable.
> >
> > It would help if you let us know what is the excat command you are
> > typing
> > in at the command
> > prompt.
> >
> > e.g
> >
> > $> ls -tls FMUBSOPT.DAT* > ${FILEPREFIX}Latestfile.dat
> > is this what you are typing ?
> >
> > The fact that you are getting a file called Latestfile.dat tells me
> > that
> > the FILEPREFIX is not defined or you are not keying it correctly what
> > is it
> > ?
> >
> > HTH
> > Datta.
> >
> >
> >
> > yamuna_pandiyan@freddiemac.com wrote:
> > I am using a program which needs to compare the current data with the
> > previous data file. the data files are created with date and time
> > stamp.
> > This program runs once a week, and has to compare the previous weeks
> > data
> > file to monitor the data changes.
> >
> > I am using the following command on the Unix box to sort the most
> > recent
> > file
> >
> > let $file_list = '{FILEPREFIX}Latestfile.dat'
> >
> > let $syscmd = '{FILEPREFIX}' || 'ls -lts SAMPLE.DAT >' || $file_list
> > call system using $syscmd #unix_status
> > if #unix_status != 0
> > stop quiet
> > end-if
> >
> > The Latestfile.dat file is created in the data directory mentioned
> > under
> > {FILEPREFIX}. But the file is empty. I would like to send the result
> > of the
> > command
> > ls -lts SAMPLE.DAT* to the above file.
> > when I execute the above program in the unix server , I ge the
> > following
> > error - {FILEPREFIX} : cannot execute, but a blank file in the name
> > of
> > Latestfile.dat is created.
> >
> > any help in greatly appreciated.
> >
> > Thanks,
> > Yamuna
> > 918-5127
> >
> >
> >
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> >  Yahoo! Sports -  Sign up for Fantasy Baseball.
> >
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
> >
> >
> >
> >
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
> >
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Personals - Better first dates. More second dates.
> http://personals.yahoo.com
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users