ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Program Described Physical file

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

  • Program Described Physical file

    Hi All,

    Probably this is going to be one of the slliest questions i would have asked for some time.

    We have a program using a program described.Please find below the code and also the PF

    Code:
    FPFPGMDSC  IF   F   40    20AIDisk                                     
    DDSPGMDSC         DS                                                   
    DZFLD1                    1     10S 0                                  
    DZFLD2                   11     20A                                    
    DZFLD3                   21     30S 0                                  
    DZFLD4                   31     40A                                    
    DPGMKEY           S             20A                                    
    C     *ENTRY        PLIST                                              
    C                   PARM                    PGMKEY                     
    C                   Eval      Zfld4 = ' '                              
    C     PGMKEY        Chain     PFPGMDSC      DSPGMDSC             99    
    C                   IF        *IN99 = *Off                             
    C     ZFLD4         DSPLY                                              
    C                   Endif                                              
    C                   Seton                                            LR
    The PF PFPGMDSC

    Code:
    A          R RPGMDSC                  
    A            FLD1          10S 0      
    A            FLD2          10A        
    A            FLD3          10S 0      
    A            FLD4          10A        
    A          K FLD1                     
    A          K FLD3
    In this case what would be my key for PFPGMDSC. Is it Fld1 & FLD2 because i have used it as a program described file and the key field length is 20 or would it be FLD1 and FLD3 as defined in DDS.

    For the set of records below I called the program twice

    Code:
    ....+....1....+....2....+....3....+....4....+....5....
             FLD1   FLD2                 FLD3   FLD4      
    1,111,111,111   bbbbbbbbbb  2,222,222,222   First  Rec
    1,111,111,111   2222222222  3,333,333,333   Second Rec
    1,111,111,111   cccccccccc  3,333,333,333   Third  Rec
    1,111,111,111   eeeeeeeeee  5,555,555,555   Fourth Rec
    1,111,111,111   5555555555  7,777,777,777   Fifth  Rec
    ********  End of data  ********
    Code:
    CALL PGM(PGMDSC) PARM('11111111112222222222')
    The first record was record for the above call.

    Code:
    CALL PGM(PGMDSC) PARM('1111111111eeeeeeeeee')
    The Fourth record was selected this time round.

    Code:
    CALL PGM(PGMDSC) PARM('1111111111cccccccccc')
    The carziest of all for the above call the second record was selected.

    Its bit confusing for me. Can anybody please help me out.

    Thanks in adavnce.
    Regards,
    KR

  • #2
    Re: Program Described Physical file

    the "40" is the record length.
    The "20" is the length of the key.

    The default of KEYLOC(1) is implied, meaning that they key starts in position 1.

    when you use a internally defined file, the dds does not matter.

    I say change the program to use external DDS.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Program Described Physical file

      Thanks for that DeadManWalks.

      I actually figured out what was going wrong. The system was checking for the key length to be same as that of the external description. So when i chenged the length of FLD2 it was working fine.
      Regards,
      KR

      Comment

      Working...
      X