ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Problem defining files in a service program procedure

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem defining files in a service program procedure

    In a service program I have two procedures which include files. In the first procedure I have:

    Code:
    Ftsctl uf e disk
    
    D tsctlDs e ds extname(tsctl : *all)
    
    read tsctlr tsctlDs;

    In the second I have:

    Code:
    Fzipcd1 if e k disk rename(zipcdr:zipcd1r)
    
    D zipcdDs e ds extname(zipcd : *all)
    
    chain (zpCity : pState) zipcd1r zipcdDS;
    There are no compile errors in the first procedure. But the second procedure gives me Data structure ZIPCDDS is not allowed for the operation. When I remove the data structure from the chain operation, I get an error saying a data structure is required.

    I have a second view of this file, hence the use of "rename". I get the same compile errors on this file as well.



  • #2
    is it a RPGLE or SQLRPGLE source?
    I sometimes have a similar error when using SQLRPGLE. In such cases the root of the problem belongs to somewhere else.

    Comment


    • #3
      In the second example, you are using ZIPCD in your extname, but you are not declaring ZIPCD1R to be the record format of ZIPCD anywhere.
      So, there's nothing in the DS tying it to ZIPCD1R.
      Rather than extname(ZIPCD), it might be better to extname(ZIPCD1), since that's the view you're using anyway.

      I'm guessing here. I hate these kind of errors.

      Comment

      Working...
      X