Theju112
Theju112

Reputation: 167

Defining Data structure using EXTNAME, EXTFLD and LIKE

I have created a DS as below:

dcl-ds P_IAC3002L                          extname('IAC3002_L') qualified template;
    LISTROWNumber                            extfld('LISTROWNBR');
    WorkTitle                                extfld('WORKTITLE');
    OriginalWorkTitle                        extfld('WRKTITLEOR');
    TypeOfWorkTitle                          extfld('WRKTITLETY');
    TitleTypeDescription                     extfld('TITLEDESC');
    OriginalVersionInd                       extfld('WRKORGIND');
    OriginalVersionIndDescription            extfld('WRKORGDESC');
    Role                                     extfld('ROLE' );
    RoleDescription                          extfld('ROLEDESC');
    StatusOfWork                             extfld('WRKSTS' );
    WorkStatusDescription                    extfld('WRKSTSDESC');
    WorkKey                                  extfld('WORKKEY');
    WorkTitleNumber                          extfld('WRKTITLENO');
    WorkMatchIndicator                       extfld('WRKMATCHIN');
    WorkCCIndicator                          extfld('WRKCCIND');
    OtherTitlesExist                         extfld('OTHTITLIND');
    WorkIsReferenced                         extfld('WRKISREF');
    WorkIsActive                             extfld('WRKISACT');
    AgreementExceptionExists                 extfld('PAGEXCEP');
    WorkReferencesCountExceedsLimit          extfld('RFCNMRTHLT');               //STR0044946
    WorkReferencesList                       like(P_IAC3002L.WORKREF) dim(10);   //STR0044946
  end-ds;

This works fine. But if I try to change the order of declaration of sub fields, by declaring WorkReferencesList like(P_IAC3002L.WORKREF) dim(10); first followed by WorkReferencesCountExceedsLimit extfld('RFCNMRTHLT');
compilation fails.

013200     WorkReferencesCountExceedsLimit          extfld('RFCNMRTHLT');        
======>                                             aaaaaa                            
*RNF3701 20 a      013200  Keyword is not allowed for a subfield definition; keyword  
                           is ignored.       

It seems that all EXTFLD should immediately follow the EXTNAME. However, in my case I would really like to first declare the sub field with LIKE as this is more logical from a readability point of view.

Any advice regarding this ?

Upvotes: 0

Views: 413

Answers (1)

Barbara Morris
Barbara Morris

Reputation: 3664

I think it's very unlikely that the compiler will ever change to allow EXTFLD definitions to follow ordinary subfield definitions.

But if your database file already has alternate names that are more readable, you could use the ALIAS keyword for your RPG data structure to pick up the alternate names and possibly skip the EXTFLD renames entirely.

Upvotes: 1

Related Questions