ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CPD7948: Name of Key- or Select-Field not found in logical file

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CPD7948: Name of Key- or Select-Field not found in logical file

    Hello,
    does somebody sees an error in the following DDS for a LF:

    Code:
         A          R MHSTRYS                   PFILE(MATUPDTEST/MHSTRY)
         A            MHSKEY10      10A  I      SST(MHSKEY 01 10)
         A          K MHSKEY10
         A          S MHSANW                    CMP(EQ 'M')
         A            MHSTYP                    CMP(EQ 'A')
         A*
         A          S MHSANW                    CMP(EQ 'E')
         A            MHSTYP                    CMP(EQ 'A')
         A*
         A          S MHSANW                    CMP(EQ 'M')
         A            MHSTYP                    CMP(EQ 'B')
    I would like to chain to the first 10 letters of the field MHSKEY.

    Thank you very much in advance.

    Kind regards,

    Sascha

  • #2
    Re: CPD7948: Name of Key- or Select-Field not found in logical file

    I don't see the field definitions for MHSANW and MHSTYP - is this why your receiving a CPD7948 error?

    Comment


    • #3
      Re: CPD7948: Name of Key- or Select-Field not found in logical file

      Hello,
      they are defined in the pf 'MHSTRY'. I think the PFILE-Keyword will load the definitions in the LF, or I am wrong?

      Comment


      • #4
        Re: CPD7948: Name of Key- or Select-Field not found in logical file

        Originally posted by Sascha View Post
        Hello,
        they are defined in the pf 'MHSTRY'. I think the PFILE-Keyword will load the definitions in the LF, or I am wrong?

        It seems the fields are not available. I cannot recognize why they are not there.

        Comment


        • #5
          Re: CPD7948: Name of Key- or Select-Field not found in logical file

          Originally posted by Sascha View Post
          they are defined in the pf 'MHSTRY'. I think the PFILE-Keyword will load the definitions in the LF, or I am wrong?
          LFs can have implicit or explicit field lists. If you don't list any fields, the field list will implicitly include all fields from the underlying PF. However, you did list a field, MHSKEY10, so you have an "explicit" field list. An explicit list includes only the fields that you chose.

          This LF only has MHSKEY10. If you remove the Select/Omit specs and recompile, the file should be created (unless some additional problem exists). You can the query the file to see that it only has the single field.

          Most LFs should probably have explicit field lists, but they commonly are implicit.
          Last edited by tomliotta; November 12, 2013, 06:55 AM. Reason: syntax
          Tom

          There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

          Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

          Comment


          • #6
            Re: CPD7948: Name of Key- or Select-Field not found in logical file

            My solution:

            Code:
                 A          R MHSTRYS                   PFILE(MATUPDTEST/MHSTRY)
                 A
                 A            MHSKEY10           I      SST(MHSKEY 01 10)
                 A            MHSKEY
                 A
                 A            MHSANW
                 A            MHSTYP
                 A          K MHSKEY10
            
                 A          S MHSANW                    CMP(EQ 'M')
                 A            MHSTYP                    CMP(EQ 'A')
                 A
                 A          S MHSANW                    CMP(EQ 'E')
                 A            MHSTYP                    CMP(EQ 'A')
                 A
                 A          S MHSANW                    CMP(EQ 'M')
                 A            MHSTYP                    CMP(EQ 'B')
            Last edited by Sascha; November 12, 2013, 07:02 AM. Reason: formating

            Comment

            Working...
            X