ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Internally Described file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Internally Described file

    hi,
    Can anyone please answer the below questions?
    1. What are Internally Described files and how do we define them?
    2. How to copy data from Externally described files to Internally described files?

    Thanks
    sateeshs

  • #2
    Re: Internally Described file

    Internally Described files ( also called as flat files )
    will not have any external Field description.


    We have

    Internally Described physical files
    Internally Described display files
    Internally Described printer files

    For all of these files there will be no DDS code which will define the fields & records in the files.

    The field description for these files will be given inside the program. hence the name.

    You can use CPYF to copy the data.
    Thanks,
    Giri

    Comment


    • #3
      Re: Internally Described file

      Thanks Giri... Now In a RPGLE PGM, I will copy the data from the externally desribed file to internally described file. Now Can i use this internally described file for a CPYTOSTMF command in a CLLE pgm after the RPGLE has terminated. If yes, how?

      thanks,
      sateeshs

      Comment


      • #4
        Re: Internally Described file

        please explain in detail what you are doing I think there is a much easier solution...but i need to know what your expected outcome is to be.

        thanks
        jamie
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Internally Described file

          Actually I am trying to send a mail with a DBF attachment(a physical file actually).

          I have a program for this and CL statement which is causing problems is


          CPYTOSTMF FROMMBR(&FRSTMF) TOSTMF(&TOSTMF) +
          STMFOPT(*REPLACE) CVTDTA(*TBL) +
          TBL('QSYS.LIB/QASCII.TBL') ENDLINFMT(*CRLF)


          The previous questions I asked was for the following comment:

          /* ------------------------------------------------------------- */
          /* Copy the AS/400 database file to the IFS directory. Note */
          /* that the Copy to Stream File (CPYTOSTMF) command only works */
          /* on internally described files. If you have an externally */
          /* described file you must first copy it to an internally */
          /* described file, and then use CPYTOSTMF. */
          /* ------------------------------------------------------------- */


          Thanks

          Comment


          • #6
            Re: Internally Described file

            Okay starters here is a program that writes directly to the IFS. It reads file(s) on the iseries and creates a file on the IFS then writes to it.

            Basically its done here (the writting)
            Code:
                 c                   eval      Data = %trim(%char(OHPRO7))   + ',' +
                 c                                    %trim(%char(Oicnt3))   + ',' +
                 c                                    %trim(%char(OHSL#))    + ',' +
                 c*                                   %trim(%xlate(',':'-':AASLNM)) + ',' +
                 c                                    %trim(%xlate(from:To:AASLNM)) + ',' +
                 c                                    %trim(%char(OHDTRQST)) + ',' +
                 c                                    %trim(%char(0)) + ',' +
                 c                                    %trim(%xlate(',':'-':IDMDES)) + ',' +
                 c                                    %trim(%xlate(',':'-':OISDES)) + ',' +
                 c                                    'Part:' +
                 c                                    %trim(%xlate(',':'-':OIPART)) + ',' +
                 c                                    %trimr(Oimat)          + ',' +
                 c                                    'Anal:' +
                 c                                    %trimr(Oianal)         + ',' +
                 c                                    %trimr(Oisize)         + ',' +
                 c                                    %trim(%char(Oicwid))   + ',' +
                 c                                    %trim(%char(Oiclgt))   + ',' +
                 c                                    %trim(OIDEC)           + ',' +
                 c                                    %trim(%char(Oipewt))   + ',' +
                 c                                    %trim(%char(OIWGT ))   + ',' +
                 c                                    %trim(OIALCO)          + ',' +
                 c                                    %trim(%xlate(from:To:OQLDES))+ ',' +
                 c                                    %trim(%xlate(From:To:OIALLC))+ ',' +
                 c                                    %trim(Complete)        + ',' +
                 c                                    %trim(Current)         + ',' +
                 c                                    '0'                    + ',' +
                 c                                    %trim(%char(OIQT07))   + ',' +
                 c                                    %trim(%char(Produced)) + ',' +
                 c                                    %trim(OHORTP)          + ',' +
                 c                                    %trim(OHPONM)                +
                 c                                    CRLF
            
                 c                   eval      Buf = %trim(Data)
                 c                   eval      BufLen = %scan(CRLF:Buf)
                 c                   eval      RC = write(FileDescr: BufP: BufLen)
            Attached Files

            Comment


            • #7
              Re: Internally Described file

              You might want to look at the IDDU utility in conjunction with Query/400 and CPYTOIMPF. This can help tame old S36-style files. This may be faster than writing a program for each file.

              here is a small discussion of interest:


              itp

              Comment

              Working...
              X