TAA Tools
WRTIFS          WRITE IFS                              TAAIFTC

The Write  IFS tool  provides a solution  for writing  to the  IFS from
RPG programs  using RPG's SPECIAL  file.  Sample  programs are provided
that  range from  simple to  complex in terms  of the  function that is
used.  You may  use these as models  for your programming.  A  standard
program (WRTIFS)  exists in TAATOOL that  may be called as  part of the
SPECIAL file.

The sample programs are invoked by commands:

        Command          Description         Program    Type
        -------          -----------         --------   ----

        DMOWRTIFS1       Simple OPM          TAAIFTCR5  RPG
        DMOWRTIFS2       Simple ILE          TAAIFTCR2  RPGLE
        DMOWRTIFS3       Medium ILE          TAAIFTCR3  RPGLE
        DMOWRTIFS4       Complex ILE         TAAIFTCR4  RPGLE

The  command writes a  record to a  stream file.  Use  WRKLNK to review
the output.

RPG's SPECIAL file
------------------

The RPG SPECIAL  file support  allows a  program to be  invoked with  a
parameter list  to perform  the I/O for  a file.   There is  a required
parameter  list as  well as  extra  parameters.   In the  examples, the
extra  parameter  list  is  named  EXTRA  and  can  can  have  1  to  5
parameters.    The  more  complex  examples  use   more  of  the  EXTRA
parameters.   These additional parameters map to  the parameters of the
open.    See  the later  discussion.    For more  information  on RPG's
SPECIAL file support, see the RPG guides.

The WRTIFS program uses an API to open the IFS file.

Opening multiple files in the same program
------------------------------------------

Multiple SPECIAL  files may  be opened concurrently,  but each  special
file must  use a different  program.  You  may use CRTDUPOBJ to  make a
duplicate of the WRTIFS program.

If  multiple files are  needed, but  only one must  be open  at a time,
you  can  use  a  single  SPECIAL  file  and  go  thru  the  steps   to
open-write-close the file before opening the next file.

Varying length records with other than LF/CR at end of line
-----------------------------------------------------------

Append the  'end of line'  characters to the  trimmed data and  set the
FixedRecl field to the number of bytes to be written.

EXTRA Discussion
---------------
                             Open()
  Parameter                 API Parm     Notes
  ---------                 --------     -----

  FileDS data structure                  Should be declared as
                                         shown in the examples.

    FileNameLn subfield     none         WRTIFS uses to build the
     (Zoned 4/0)                         path parameter.  It can
                                         be either the size of the
                                         filename subfield or the
                                         length of the data in the
                                         filename subfield.

    FileName subfield       path         WRTIFS trims and adds
     (Char 5000)                         the required X'00'.

    FixedRecl subfield      none         If 0, WRTIFS trims
     (Zoned 5/0)                         trailing blanks and adds
                                         a CR/LF to each record
                                         written, resulting in
                                         varying length records.
                                         If greater than 0, WRTIFS
                                         writes fixed length
                                         records of FixedRecl bytes.
                                         No CR/LF is written.

  OpenFlag
   (Integer 4)              oflag        See Open API documentation

  Mode                      mode         See Open API documentation
   (Integer 4)

  CodePage                  codepage     See Open API documentation
   (Integer 4)

  TxtCodePag                conversion   See Open API documentation
   (Integer 4)                ID

WRTIFS escape messages you can monitor for
------------------------------------------

None.  Escape messages from based on functions will be re-sent.

DMOWRTIFS1 Simple OPM (TAAIFTCR5)                       *CMD
---------------------------------

Uses  only the FileDS  extra parameter and  defaults the other  4.  The
result is a  text file  with varying  length records  each ending  with
CR/LF.   The  job's codepage  is translated  to codepage  819.   Public
data authority  is set to RWX.  Object  authority is inherited from the
file's directory.

   FILE          The IFS file name to be written to.

DMOWRTIFS2 Simple ILE (TAAIFTCR2)
---------------------------------

Uses  only the FileDS  extra parameter and  defaults the other  4.  The
result is  a text  file with varying  length records  each ending  with
CR/LF.   The  job's codepage  is translated  to codepage  819.   Public
data  authority is set to RWX.   Object authority is inherited from the
file's directory.

   FILE          The IFS file name to be written to.

DMOWRTIFS3 Medium ILE (TAAIFTCR3)
---------------------------------

Uses neither  the 5th  extra parameter,  nor the  O-TEXT_CREAT flag  in
the  second parameter.    Includes  logic to  open  the  file twice  to
enable correct  translation.  Only the user  has RWX authority.  Object
authority is inherited from the file's directory.

   FILE          The IFS file name to be written to.

DMOWRTIFS4 Complex ILE (TAAIFTCR4)
----------------------------------

Uses all  5 parameters.   Only  the  user has  RWX authority.    Object
authority is inherited from the file's directory.

   FILE          The IFS file name to be written to.

Restrictions
------------

None.

Prerequisites
-------------

The following TAA Tools must be on your system:

     SNDESCMSG       Send escape message

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

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

   DMOWRTIFS1    *CMD                   TAAIFTC5      QATTCMD
   DMOWRTIFS2    *CMD                   TAAIFTC2      QATTCMD
   DMOWRTIFS3    *CMD                   TAAIFTC3      QATTCMD
   DMOWRTIFS4    *CMD                   TAAIFTC4      QATTCMD
   TAAIFTCC5     *CLP                   TAAIFTCC5     QATTCL
   WRTIFS        *PGM       RPGLE       TAAIFTCR      QATTRPG
   TAAIFTCR2     *PGM       RPGLE       TAAIFTCR2     QATTRPG
   TAAIFTCR3     *PGM       RPGLE       TAAIFTCR3     QATTRPG
   TAAIFTCR4     *PGM       RPGLE       TAAIFTCR4     QATTRPG
   TAAIFTCR5     *PGM       RPG         TAAIFTCR5     QATTRPG
					

Added to TAA Productivity tools March 31, 2004


Home Page Up to Top