The [database and device] *FILE Record Format name is not capable of being changed. The ability to set the name of the record format is only available at creation-time. And although the effect of CHGPF SRCFILE(named) can in almost every way be considered to have enabled that effect via a CL command, that creates a new file to get the new format name. So aside from the effect from CHGPF SRCFILE(named), there is neither an API nor any CL command that can effect directly the /rename/ of a record format of a *FILE or the database *FMT. As noted, the RNMOBJ [and the rename object API] can change the *FILE name to be different than any of the static Record Format names of the *FILE; the Record Format name(s) of course, remain unchanged.

Unfortunately the Query/400 never exposed the RcdFmt name for its Output File (OUTFILE) support as a parameter\element, neither in the definition-time WRKQRY [Define Database File Output] nor its run-time RUNQRY OUTTYPE(*OUTFILE) OUTFILE(). The name of the RcdFmt will always be created with the same name as the database *FILE that the utility creates; even for invalid record format names :-( However since the database files created by Query/400 would best be avoided for use in production, such that instead use of files created with either CRTPF using DDS or with SQL DDL being the recommended approach, and with those the Record Format can be named. And following that logic to an obvious conclusion, a *QRYDFN that is used solely for *OUTFILE support might best be replaced with an SQL equivalent such as CREATE TABLE AS. Given the use of CREATE TABLE, then the RCDFMT clause\specification is also directly available, instead of as recovery from the inflexible Query/400 OutFile support.

Regards, Chuck

On 20 Apr 2012 07:47, Dunk, Michael - Bognor wrote:
Creating a file named DIBDWF3 with an AS/400 query, to be read in
RPG was causing QRG2122.

Looking at a similar program written some time ago by someone else,
the query file read by RPG had a different record format name.

Using Google I found two links:

http://search400.techtarget.com/tip/Changing-existing-physical-files-record-format
wasn't something I could do in a CL program

The following article leads me to wonder if there isn't a command to
change a record format name.

http://www.mcpressonline.com/tips-techniques/sql/techtip-sql-and-i5os-record-format-names.html

The only way I could find to solve this, was to use RNMOBJ to rename
the file. Then the record and file name have different names, a
similar to the above article. Do you know if there is a simple way to
change a record format name?

The compilation error in the RPG program attempting to read the file
was:
*...+....1....+....2....+....3....+....4....+....5....+....6....+
H
300 FDIBDWF3 IF E DISK
400 * Query file
* 2122 300 RECORD NAME DIBDWF3 PREVIOUSLY DEFINED AS FILE NAME.
RECORD FORMAT(S): LIBRARY MY_LIB FILE DIBDWF3.
EXTERNAL FORMAT DIBDWF3 DROPPED DUE TO ERROR OR IGNORE.


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].