Search code examples
db2rpgle

How to create a multiple record format DDS


Can anyone tell me how to create a PF with more than 1 record?

I tried the following:

 A**************************************************************************
 A*  Physical File
 A*-------------------------------------------------------------------------
 A
 A*            -------------------------------------------------------------
 A*            Record 01 - <Some description>
 A*            -------------------------------------------------------------
 A          R RAMPPF1
 A            D1SNAM        50A         ALIAS(SHIPNAME         )
 A            D1SADD        50A         ALIAS(SHIPADDRESS      )
 A            D1SCITY       50A         ALIAS(SHIPCITY         )
 A            D1SREGN        2A         ALIAS(SHIPREGION       )
 A            D1SPOST       10A         ALIAS(SHIPPOSTALCODE   )
 A            D1SCNTR       40A         ALIAS(SHIPCOUNTRY      )
 A            D1CSTID       80A         ALIAS(CUSTOMERID       )
 A            D1CNAM        50A         ALIAS(CUSTOMERNAME     )
 A            D1CADD        50A         ALIAS(ADDRESS          )
 A            D1CCITY       50A         ALIAS(CITY             )
 A* KEYS GO HERE
 A
 A*            -------------------------------------------------------------
 A*            Record 02 - <Some description>
 A*            -------------------------------------------------------------
 A          R RAMPPF2
 A            D2SNAM        70A         ALIAS(SHIPNAME         )
 A            D2SADD        60A         ALIAS(SHIPADDRESS      )
 A            D2SCITY       40A         ALIAS(SHIPCITY         )
 A            D2SREGN        2A         ALIAS(SHIPREGION       )
 A            D2SPOST       10A         ALIAS(SHIPPOSTALCODE   )
 A            D2SCNTR       40A         ALIAS(SHIPCOUNTRY      )
 A            D2CSTID       80A         ALIAS(CUSTOMERID       )
 A            D2CNAM        50A         ALIAS(CUSTOMERNAME     )
 A            D2CADD        50A         ALIAS(ADDRESS          )
 A            D2CCITY       50A         ALIAS(CITY             )
 A* KEYS GO HERE
 A
 A************************************************************************** 

As shown here

But when compiling this with 14 or with CRTPF command (CRTPF FILE(QTEMP/TST001P) SRCFILE(TSTLIB/QDDSSRC) SRCMBR(*FILE) I get an CPD7914

So what is wrong? The DDS definition or the compiling command? Since there are nearly no tutorials with multipe record formats out there in the internet, I haven't found a satisfying solution

Thanks in advance!


Solution

  • The reference for DDS files states that Specify only one R because a physical file can contain only one record format.