简体   繁体   中英

Using SQL, is it possible to create global temporary table with same format level identifier as original file(PF) it is based on?

Program A calls program B. I am creating the global temporary table based on File A in Prog B.

I have to open and read the temporary table in Program A. I have used EXTFILE opcode in F Spec to compile the Prog A.

fFILEA   if   e             disk    extfile(wrk_filnam)
f                                      usropn

/free

wrk_filnam = 'QTEMP/TEMP_TABLE'

open FILEA

/end-free

When i return to Prog A and Open File A , I am getting level check error as temporary table is created with new format level identifier.

Is there a workaround ? If i can do with CRTDUPOBJ then it would be great.

The sql statement DECLARE GLOBAL TEMPORARY TABLE tmptable LIKE srctable RCDFMT srcfmt will create tmptable with the same format level identifier as srctable as long as you make sure that srcfmt is the same record format name as the original.

Are you compiling with the correct file to get the correct level identifier? You can use DSPPGMREF to find out the level identifier expected by the program for each file.

CRTDUPOBJ应该创建与原始文件具有相同格式级别标识符的文件。

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