ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

chain condition and field value

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

  • #31
    I think you need to step through in Debug, line by line to see where your value is getting set to blank. If it is coming in as a parameter with a value, then some line of code is changing it.

    Is there another person at your company that can help ? Sometimes a different person may notice a bug or something overlooked.
    Also, sometimes in preparation for asking a co-worker for help, and getting the information to explain to them, I then notice the problem/solution as part of the review.
    Last edited by MFisher; February 17, 2022, 11:32 AM.

    Comment


    • #32
      I just noticed that it is not being passed as parameter value ( please ignore my last post in which I said it's passed as parameter, I just did not check it properly ) neither it is being overridden with any other value simply the same key field name exists in 3 files in this program and just prior to chain operation one of it's key field (Key C 's key field 'fld Y' ) has blank value in it. that I am trying to find out why is it blank.


      Thanks..

      Comment


      • #33
        I think you can "Prefix" one of the fields so they don't have the same name from 2 different files.

        Comment


        • #34
          even after prefixing issue remains same and i see blanks in the fields of klist and i think it's normal to have blank values in fields defined on klist like :-

          keyc klist
          kfld fldY
          kfld fldZ

          here by default for example in above case fldY and fldZ will be having blank values only right unless we assign some values in it here same is happening:-

          after defining this keyc like above in fldz fixed value is assigned and then chain operation on file3 takes place ( with fldY as blank value and fldZ with some fixed value )which results blank value return in output file as a return of one of the field from file3 (fldS from file3 to the the file declared in output mode only)

          so idea is if chain operation fails due to one of the composite key field value being blank then what can be done to avoid this?
          and is it normal to have fields defined under klist as key fields to have default values as blanks?


          Thanks...

          Comment


          • #35
            Originally posted by John192 View Post
            and is it normal to have fields defined under klist as key fields to have default values as blanks?
            If FLDY and FLDZ are program defined, then they are blank until the program puts a value in them.
            If FLDY and FLDZ are input from a file, then they have whatever value is in the file, unless Y and Z have been updated since the file was read.

            It doesn't matter what the field values are on the KLIST line of code.
            It DOES matters what the values are when the KLIST is used to access a file (CHAIN , SETLL ...)
            Last edited by MFisher; February 18, 2022, 09:25 AM.

            Comment


            • #36
              Originally posted by John192 View Post

              after defining this keyc like above in fldz fixed value is assigned and then chain operation on file3 takes place ( with fldY as blank value and fldZ with some fixed value )which results blank value return in output file as a return of one of the field from file3 (fldS from file3 to the the file declared in output mode only)
              Why is FLDY Blank ?
              Last edited by MFisher; February 18, 2022, 09:42 AM.

              Comment


              • #37
                ..just for clarification so what would it be called if a key field is defined like below program defined only right ?

                keyc klist
                kfld fldY
                kfld fldZ

                also there sequence fldY and fldZ are also same in file3 like above ( I mean fldY and fldZ fields of file3 are having same sequence and are defined as key fields inside DDS of file3 here) and it should be same as per this link:-https://www.go4as400.com/rpgle-opcod...0.aspx?cid=239


                Thanks...

                Comment

                Working...
                X