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.
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
Soft coding a file operation
Collapse
X
-
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
-
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
-
-
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
Comment