简体   繁体   中英

IBM i- parse data from IFS text file into a IBM i db2 table?

Is it possible to parse data from IFS text file into a db2 table? Examples I see use a field in a DB2 table. In the following example, we use field JDATA from table MYLIB.DATA_IN.

INSERT INTO MYLIB.MYTABLE (  value  )
   SELECT value
    FROM MYLIB.DATA_IN, 
    JSON_TABLE (JDATA,'$.meetings[*]'
    COLUMNS (
        value varchar ( 100 ) PATH '$.value'
    )
)

It depends on the format of the text in the IFS file. If you have fixed columns, or delimiter separated values, CPYFRMIMPF will do the trick. If you have a big block of unformatted text that you want to load into a single field database file, CPYFRMSTMF will work. If you have XML or JSON, or HTML, or something else that you want to parse, you will need to do it a different way.

So short answer is YES. No long answer possible without more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM