TAA Tools
WRTDBF          WRITE DATA BASE FILE                   TAADBFX

          *                                                 *
          *                    CAUTION                      *
          *                                                 *
          *  While the WRTDBF command can be helpful, it    *
          *   can also easily write garbage into your       *
          *   data base. Use it properly.                   *
          *                                                 *
          *  An improved solution is available with the     *
          *   CLPDBR tool.                                  *
          *                                                 *

The Write  Data Base File  command lets  you write a  record to a  data
base  file  from  a  CL   program.    There  is  no  update  or  delete
capability.  A typical command would be entered as:

          WRTDBF   FILE(xxx) RECORD('Whatever data you want')

The  value in the RECORD parameter is  written to the file beginning in
byte 1  of  the  record.   It  is up  to  you  to properly  format  the
contents of the RECORD parameter to match the data base definition.

The  ACTION  parameter  determines   what  will  occur.    The  default
(*WRTRMNOPEN)  is to write  to the file  and have the  file remain open
(waiting for another write).   When you are finished writing, you  must
close the file as:

          WRTDBF   FILE(xxx) RECORD('Any value') ACTION(*CLOSE)

A special action *WRTCLOSE  lets you write a record  and close the file
in the same command.

The  file/member  is  opened by  the  first  action  of *WRTRMNOPEN  or

You can only write to physical data files.   If you want to write to  a
source file, see the WRTSRC TAA Tool.

You cannot have  more than one member open  at a time.  You  must close
an  open member  before you  can write  to  a different  combination of

The  file being written to must be 500 bytes  or less.  If the value in
the record parameter exceeds  the length of the file, an  error message
is sent.

Command parameters                                    *CMD

   FILE          The  qualified file  name of  the file.    The library
                 value  defaults   to  *LIBL.    *CURLIB  may  also  be

   RECORD        The data to be written (as a record) to the file.

   ACTION        The  action  to   be  performed.     The  default   is
                 *WRTRMNOPEN (Write and  remain open).  This  means the
                 value in  the RECORD parameter is  written to the file
                 and the member remains open.

                 *WRTCLOSE means the value  in the RECORD parameter  is
                 written to the file and the member is closed.

                 *CLOSE  means the  value in  the  RECORD parameter  is
                 ignored and the member is closed.

   MBR           The member  to be written to.   The default is *FIRST.


The  command  can  only  be  entered  in a  CL  program.    This  is an
artificial restriction to help prevent misuse of the command.

The file to be  written to must be a  data base physical file for  data
(not source)  and cannot  exceed 500  bytes in length.   The  length of
the RECORD passed cannot exceed the length of the file.


The following TAA Tools must be on your system:

     EDTVAR       Edit variable
     SCNVARRGT    Scan variable from the right
     SNDCOMPMSG   Send completion message
     SNDESCMSG    Send escape message


None, the tool is ready to use.

Objects used by the tool

   Object        Type        Attribute      Src member    Src file
   ------        ----        ---------      ----------    ----------

   WRTDBF        *CMD                       TAADBFX       QATTCMD
   TAADBFXC      *PGM           CLP         TAADBFXC      QATTCL
   TAADBFXR      *PGM           RPG         TAADBFXR      QATTRPG

Added to TAA Productivity tools April 1, 1995

Home Page Up to Top