T.Holt
01-01-1995, 02:00 AM
<font color="blue">On Wednesday, April 29, 1998, 11:20 PM, Sarah Cooper wrote: I need to join two record formats of a logical file with a physical file. When you specify the FORMAT you have to specify one of the record formats of the logical file therefore any fields that do not exist on that particular record format will not be included in the query. Does anyone know a way to get around this??</font> Let me see if I understand. You have a physical file and a logical file. The logical file has at least 2 record formats. You want to join two of the logical file record formats (I'll call them A and B) to the physical file. So you would wind up with a join that has two different record types -- the physical joined to A and the physical joined to B. Am I right? If so, you can't do this with one join. You could run two different OPNQRYF's -- one for each join -- and your RPG/COBOL program would have to process each one as a separate file. In such a case, it may be better to process the physical file and logical files without going thru OPNQRYF. Maybe you should describe the problem. It sounds like OPNQRYF may not be the best approach. <font color="blue"> Additionally does anyone know how to specify the record format on the MAPFLD parm for the field definition expression?? </font> Use numbers, indicating the position of the file in the FILE parameter. E.g. OPNQRYF FILE((ABC) (DEF) (GHI)) + MAPFLD(( .... '2/SOMEFIELD') SOMEFIELD gets its value from DEF, the 2nd file listed in the FILE parameter. Since the record format parameter is specified in the FILE parameter, this technique does what you're asking.