Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Soft coding a file operation

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

  • Soft coding a file operation

    The best you can do is code EXTFILE (or use OVRDBF) and re-open the file when you want to deal with a different file.

  • #2
    Soft coding a file operation

    Trevor, For a chain or read, SQL is a reasonable alternative. If you are interested, I wrote some procedures that make dynamic file access relatively easy (and also removes the requirement that you have the SQL development product on your AS/400. The procedures I wrote allow you to do things like open a file and return the contents of a record into some storage location (a data structure or field work fine). If you have a really dynamic application, you can call other procedures that allow you to determine the format of what was returned. The prototype for the SQL module documents some of the capabilities. You can download a package that includes this code at the iseries-toolkit web site. If this interests you, I can post some actual examples. David Morris

    Comment


    • #3
      Soft coding a file operation

      Are you talking about using embedded SQL, or accesing a service program and using a procedure? Either way I would love to see what you have available for my application. I am always game for new tricks! Thanks David

      Comment


      • #4
        Soft coding a file operation

        Trevor, Until I have time to work up a full running example:
         * Data Structure of SQL Select fields D pSQLDS S * INZ(%ADDR(SQLDS)) STATIC D SQLDS DS STATIC D Sel_Tag LIKE(P10WTag#) D Sel_Specie LIKE(P10WSpecie) D Sel_Grade LIKE(P10WGrade) D Sel_SED LIKE(P10WGrsDia) D Sel_LED LIKE(P10WButDia) D Sel_Length LIKE(P10WGrsLen) D Sel_QCCode 3P 0 D Sel_RRNSC1 LIKE(P10WRRNSC1) ... Some code to build the select statement C EVAL SQLStmHnd = CrtSQLHnd(Stm: Create SQL handle C *OMIT: C pSQLDS) C IF SQLStmHnd <> *ZEROS C EVAL UnExpSQLErr = ExcSQLSel(SQLStmHnd) Execute statement C ENDIF SQLStmHnd<>*ZEROS * Fetch requested number of records C IF SQLStmHnd > *ZERO C EVAL SQLErrDS = ExcSQLFet(SQLStmHnd) C DOW SQLErrDS = *ZEROS C EVAL SflRcdCnt = SflRcdCnt + 1 C EXSR SubSetSfl C IF SflRcdCnt > SflRcdFllCnt C LEAVE C ENDIF SflRcdCnt>ScrFmt... C EVAL SQLErrDS = ExcSQLFet(SQLStmHnd) C ENDDO SQLErrDS=*ZEROS 

        Comment


        • #5
          Soft coding a file operation

          There is a way on V5. See iSeris Network, section 2

          Comment


          • #6
            Soft coding a file operation

            If you are at V5r1, you can use teh EXTFILE keyword...AND! a variable name. Specify:
             FGENERIC IF E K DISK EXTFILE(input_file) D input_file s 10a C If Month = 01 C Eval Input_File = 'JANDATA' C Else C If Month = 02 C Eval Input_File = 'FEBDATA' C Endif C Endif C Open Generic C Read Generic C Dow (not %eof) C . C . C . etc..... 

            Comment


            • #7
              Soft coding a file operation

              Is there a way that you can soft code a factor two entry on a chain, or a read operation? I.E. Key1 Chain File

              Comment

              Working...
              X