Writing a message from dbaccess
Posted in 2005
The poster wanted dbaccess (IDS 9.4 on Solaris 9) to print progress messages to stdout so a shell script running several 'update statistics' jobs could be logged; using 'system echo hello;' gave error 201 syntax error. Replies explained the shell escape in dbaccess is '!' (e.g. '! echo hello' at the start of the line, no semicolon needed), and others suggested emitting text via SQL, e.g. select 'hello' from systables where tabid=1. The poster resolved it by using 'dbaccess -e' to echo the statements, plus '!' for shell commands.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Server Administration, Platform-Specific Issues, Versions, Editions & End-of-Life
Hi everybody !!
I have IDS 9.4 running over Solaris 9 and....
I want to write a message from dbaccess, for instance tried with system
statement:
> dbaccess ra1 << EOF
> system echo hello;
> EOF
But, this not work this gave me "201: A syntax error has occurred."
Someone can -plis- tell me how to write a message to standar output
from dbaccess ???
Thanks in advance
P.D.
I'm seeking how to write a message from dbaccess so I'll be able to log
what update statistics is running my shell script:
#!/usr/bin/ksh
.
count=1;
while [[ $count -le $maxStatRunning ]]; do
echo ${arrStmt[$count]} | nohup dbaccess $INFORMIX_DBID >
$logpath/${tabName}_
${logDate}_${count}.out 2>&1 &
((count=count+1))
done
arrStmt is a array with sentences:
arrStmt[1]= set lock mode to wait; update statistics high for table
jest(mandt)
distributions only; update statistics high for table jest(inact)
distributions
only;
arrStmt[2]= set lock mode to wait; update statistics high for table
jest(objnr)
distributions only;
arrStmt[3]= set lock mode to wait; update statistics low for table
jest; update
statistics high for table jest(stat) distributions only;
Hi,
the shell escape is the ! (bang).
It has to be in the first column (i.e. no white space
in front of it), and no semicolon needed :
dbaccess - - <<EOF
! echo "hello, world"
EOF
[ And all that without a C compiler ... ;-) ]
Regards,
Martin
--
Martin Fuerderer
IBM Informix Development Munich, Germany
Information Management
forum.subscriber@iiug.org wrote on 09.03.2005 01:52:49:
> Hi everybody !!
>
> I have IDS 9.4 running over Solaris 9 and....
>
> I want to write a message from dbaccess, for instance tried with system
> statement:
>
> > dbaccess ra1 << EOF
> > system echo hello;
> > EOF
>
> But, this not work this gave me "201: A syntax error has occurred."
>
> Someone can -plis- tell me how to write a message to standar output
> from dbaccess ???
>
> Thanks in advance
>
>
> P.D.
> I'm seeking how to write a message from dbaccess so I'll be able to log
> what update statistics is running my shell script:
>
> #!/usr/bin/ksh
RAúL MORALES said:
> Hi everybody !!
>
> I have IDS 9.4 running over Solaris 9 and....
>
> I want to write a message from dbaccess, for instance tried with system
> statement:
>
>> dbaccess ra1 << EOF
>> system echo hello;
>> EOF
Try:
dbaccess ra1 << EOF
! echo hello;
EOF
> But, this not work this gave me "201: A syntax error has occurred."
>
> Someone can -plis- tell me how to write a message to standar output
> from dbaccess ???
>
> Thanks in advance
>
>
> P.D.
> I'm seeking how to write a message from dbaccess so I'll be able to log
> what update statistics is running my shell script:
>
> #!/usr/bin/ksh
>
--
Bye now,
Obnoxio
"C'est pas parce qu'on n'a rien à dire qu'il faut fermer sa gueule"
- Coluche
"I'm trying to see things your way, but I can't get my head up my ass"
- JCH
"Ogni uomo mi guarda come se fossi una testa di cazzo"
- Marco
Travel broadens a person. You look as if you have been all over the world.
I went to the airport to check in and they asked what I did because I
looked like a terrorist. I said I was a comedian. They said, "Say
something funny then." I told them I had just graduated from flying
school.
-- Ahmed Ahmed
http://members.rogers.com/2remedy/images/smilies/banners/RTFM.gif
RAúL MORALES wrote
>
> I have IDS 9.4 running over Solaris 9 and....
>
> I want to write a message from dbaccess, for instance tried
> with system
> statement:
>
> > dbaccess ra1 << EOF
> > system echo hello;
> > EOF
>
> But, this not work this gave me "201: A syntax error has occurred."
>
> Someone can -plis- tell me how to write a message to standar
> output from dbaccess ???
>
> Thanks in advance
>
>
> P.D.
> I'm seeking how to write a message from dbaccess so I'll be
> able to log what update statistics is running my shell script:
>
> #!/usr/bin/ksh
>
You need to usr SQL syntax
dbaccess ra1 << EOF
select "hello" from systables where tabid=1 ;
EOF
But I cannot see the point of doing this from the command line !
_______________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security System.
_______________________________________________________________________
You can
do it from prompt line:
> echo "select 'Hello!' from systables where tabid = 1"|dbaccess sysmaster.
Instead of sysmaster you can use any existing database.
-----Original Message-----
From: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org] On Behalf
Of Colin Bull
Sent: Wednesday, March 09, 2005 11:21 AM
To: ids@iiug.org
Subject: RE: Writing a message from dbaccess [4446]
RAúL MORALES wrote
>
> I have IDS 9.4 running over Solaris 9 and....
>
> I want to write a message from dbaccess, for instance tried
> with system
> statement:
>
> > dbaccess ra1 << EOF
> > system echo hello;
> > EOF
>
> But, this not work this gave me "201: A syntax error has occurred."
>
> Someone can -plis- tell me how to write a message to standar
> output from dbaccess ???
>
> Thanks in advance
>
>
> P.D.
> I'm seeking how to write a message from dbaccess so I'll be
> able to log what update statistics is running my shell script:
>
> #!/usr/bin/ksh
>
You need to usr SQL syntax
dbaccess ra1 << EOF
select "hello" from systables where tabid=1 ;
EOF
But I cannot see the point of doing this from the command line !
_______________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security System.
_______________________________________________________________________
********************************************************************************
******************
The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or
the
sender immediately and do not disclose the contents to anyone or make copies.
** eSafe scanned this email for viruses, vandals and malicious content. **
********************************************************************************
******************
Try
using a ! instead of system
dbaccess ra1 << EOF
!echo hello;
EOF
On Wednesday 09 March 2005 00:52, RAúL MORALES wrote:
> Hi everybody !!
>
> I have IDS 9.4 running over Solaris 9 and....
>
> I want to write a message from dbaccess, for instance tried with system
>
> statement:
> > dbaccess ra1 << EOF
> > system echo hello;
> > EOF
>
> But, this not work this gave me "201: A syntax error has occurred."
>
> Someone can -plis- tell me how to write a message to standar output
> from dbaccess ???
>
> Thanks in advance
>
>
> P.D.
> I'm seeking how to write a message from dbaccess so I'll be able to log
> what update statistics is running my shell script:
>
> #!/usr/bin/ksh
Thanks to everyone !!
I modified my shell with "dbaccess -e", also is very useful know how to run
solaris commands with "!"
Thanks a lot :)