Announcement

Collapse
No announcement yet.

Program error

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

  • Program error

    Hi,


    Despite being both the fields numeric (defined as packed with same length) chain(AB(some prefix name)_fld2) file1 in fld2 and file1 why i am getting below compilation error in the RPGLE program?

    i checked using DSPFFD and founf fil1 and fld2 which is the field of some other file both are having same length and data type.,still i am getting below compilation error in my RPGLE program.



    *RNF7072 KFLD at sequence number is NUMERIC but key field is CHAR


    Could someone please tell what is the reason for this error now?



    Thanks...

  • #2
    Maybe your compile library list references a different version of the file with a CHAR field ?

    Comment


    • #3
      Some questions to help diagnose the problem:
      1) does file1 exist in one Library only or in multiple Libraries on this system?
      2) how exactly is file1 defined in the program - as an F-specification or dcl-f statement?
      3) is the Library List in effect when compiling (using the CRTRPGMOD or CRTBNDRPG command?) the same as the Library List in effect when using the DSPFFD command
      4) what does the output of command DSPFD FILE1 TYPE(*ACCPTH) show?
      5) what is the RPG statement (F-specification or dcl-f statement?) that defines the prefix AB_?

      Comment


      • #4
        Hi,

        Please find answers as followings:-



        1. file does exists in multiple libraries in the system but in
        edit library list it's there in just one library and that is on top of library list.

        2. it's defined as dcl-f statement with some prefix and is USROPN and as keyed and with renamed record format.

        3. yes library list and dspffd refers to same files and library name.

        4. it shows the description of this file like file accessed by logical file
        anf key fields names,sequence(ascending) sign specified (signed) ,access path (keyed)
        record format name( which is the same in my dcl-f statement which i have renamed in my program)
        etc.

        5. it's defined something like this:-

        dcl-f file1 disk usage((input) keyed rename(somerecordformat name: some changed record format name) prefix(AB_) USROPN;



        Thanks...

        Comment


        • #5
          And the key fields you use for accessing the file are also numeric? I suspect!

          Comment


          • #6
            So, field fld2 from file file1 will appear as AB_fld2 in this program. Is that correct?

            Is fld2 the first key field listed on the output from the DSPFD TYPE(*ACCPTH) command?

            Are there any other errors in the compiler listing besides RNF7072?

            Comment


            • #7
              Thanks..

              yes 'it will appear as AB_fld2 in this program.

              I just removed that keyed keyword from file declaration in RPGLE program and put that field 2 as the first field in the logical file file1 as it was not the first key field earlier but now i have made them just normal fields by removing 'K' in front of it's fields as earlier i was getting error "RNF7078. Length of Factor 1 is not the same as the first key field in the file." in the program statement "setll 1 file2;" ( 1 i was using to start reading from first record in file2) now this error is gone as i just declared fields as normal fields in the logical file but this error still exists "
              *RNF7072 KFLD at sequence number is NUMERIC but key field is CHAR"

              now just 30 level 1 error :- type of KFLD is not the same as corresponding key field in he file.

              and few 20 level errors *RNF5060- Factor 2 operand of ENDSR operation is not allowed.


              chain(AB(some prefix name)_fld2) file1 :-- here fld2 used in file2 and file1's corresponding fields are packed data type and of the same length.

              only difference in file1 and 2 is now is that in file2 i just removed that 'keyed' keyword to avoid that *RNF7078 error.



              Thanks...

              Comment


              • #8
                Originally posted by John192 View Post
                Thanks..

                yes 'it will appear as AB_fld2 in this program.

                I just removed that keyed keyword from file declaration in RPGLE program and put that field 2 as the first field in the logical file file1 as it was not the first key field earlier but now i have made them just normal fields by removing 'K' in front of it's fields as earlier i was getting error "RNF7078. Length of Factor 1 is not the same as the first key field in the file." in the program statement "setll 1 file2;" ( 1 i was using to start reading from first record in file2) now this error is gone as i just declared fields as normal fields in the logical file but this error still exists "
                *RNF7072 KFLD at sequence number is NUMERIC but key field is CHAR"

                now just 30 level 1 error :- type of KFLD is not the same as corresponding key field in he file.

                and few 20 level errors *RNF5060- Factor 2 operand of ENDSR operation is not allowed.


                chain(AB(some prefix name)_fld2) file1 :-- here fld2 used in file2 and file1's corresponding fields are packed data type and of the same length.

                only difference in file1 and 2 is now is that in file2 i just removed that 'keyed' keyword to avoid that *RNF7078 error.



                Thanks...
                Just for clarification I am asking ...

                is it necessary that for example i am doing chain like this :-- chain(xyz) file2

                here for example xyz is the field of some logical file and i am looking corresponding mattching records from file 2 using this operation then both matching fields should be the first fields along with their data types and length should also match?


                Thanks...

                Comment


                • #9
                  thanks, I was able to resolve this *RNF7072 but as mentioned that Error "RNF7078. Length of Factor 1 is not the same as the first key field in the file." in the program statement "setll 1 file2;" ( 1 i was using to start reading from first record in file2) now this error is gone as i just declared fields as normal fields in the logical file but if i use it as keyed file in my program and declare fields inside the logical file file2 then again i get this error *RNF7078.

                  so is declaring this logical file without the key and declaring it's fields without keys is the only solution to resolve this error *RNF7078?


                  Thanks much...

                  Comment


                  • #10
                    samething works well when file is not keyed for example if i do SETLL 1 FILE2

                    Where file2 is not keyed with no key fields in it and it is a logical file and same line gives error when file 2 is keyed and a logical file . why is it so?


                    thanks much...

                    Comment


                    • John192
                      John192 commented
                      Editing a comment
                      this i was telling for the same error "RNF7078. Length of Factor 1 is not the same as the first key field in the file."



                      Thanks much...

                  • #11
                    Originally posted by John192 View Post
                    samething works well when file is not keyed for example if i do SETLL 1 FILE2

                    Where file2 is not keyed with no key fields in it and it is a logical file and same line gives error when file 2 is keyed and a logical file . why is it so?


                    thanks much...
                    Can you clarify: when you say the file is not keyed, do you mean the 'keyed' keyword is NOT used on the File Specification in the RPG program or do you mean the file has no key? (DSPFD TYPE(*ACCPTH) shows 'Arrival sequence')?

                    If FILE" is defined in the RPG program without the 'keyed' keyword then the program will read it in arrival sequence and the statement SETLL 1 FILE2 means "position the file to record number 1", i.e. to the start of the file.

                    I think it will be a lot quicker to understand and explain the errors here if you just copy+paste the entire source code of the RPG program AND the database files.

                    Comment


                    • #12
                      Few things I tried :-

                      1) defined fields as keys in that logical file file2 and declared this file2 without 'keyed' keyword in dcl-f statement in RPGLE program, then program got compiled successfully.


                      2) Defined fields as keys in that logical file file2 and declared it with 'keyed' keyword in dcl-f statement in RPGLE program then I got this error "*RNF7078 . Length of Factor 1 is not the same as the first key field in the file."


                      3) defined fields as normal fields without and keys in that logical file file2 and then declared this file2 without 'keyed' keyword in dcl-f statement in RPGLE program, then also program got compiled successfully.



                      So from above 2nd option if i want to declare fields as keys and want to define that logical file ( file2) with 'keyed' keyword in dcl-f statement in my RPGLE program then to avoid this error " *RNF7078 Length of Factor 1 is not the same as the first key field in the file." what should I do?



                      Thanks much...

                      Comment


                      • John192
                        John192 commented
                        Editing a comment
                        I just tried one more thing based on the error description of *RNF7078-Length of Factor 1 is not the same as the first key field in the file."

                        so for statement in my RPGLE Program SETLL 1 File2; , I just tried replacing it with SETLL 00000000001 File2; as I just noticed that length of first key field in file 2 is 11 and it's data type is packed with 0 decimal position.

                        So when i tried this that compilation error "*RNF7078-Length of Factor 1 is not the same as the first key field in the file." got disappeared.

                        So when a logical file is declared with 'keyed' keyword in the RPGLE program same statement " SETLL 1 FILE2 " pays attention towards first key field of the file2 and when this same logical file is declared with 'keyed' keyword in the RPGLE program then same statement " SETLL 1 FILE2" does not pay attention towards the first key field of the file2.




                        Thanks...

                    • #13
                      …just wanted to correct my last comment here "So when a logical file is declared with 'keyed' keyword in the RPGLE program same statement " SETLL 1 FILE2 " pays attention towards first key field of the file2 and when this same logical file is declared without 'keyed' keyword in the RPGLE program then same program statement " SETLL 1 FILE2" does not pay attention towards the first key field of the file2.


                      Thanks....

                      Comment


                      • #14
                        …just wanted to correct my last comment here "So when a logical file is declared with 'keyed' keyword in the RPGLE program same statement " SETLL 1 FILE2 " pays attention towards first key field of the file2 and when this same logical file is declared without 'keyed' keyword in the RPGLE program then same program statement " SETLL 1 FILE2" does not pay attention towards the first key field of the file2."


                        Thanks....

                        Comment


                        • #15
                          yes, if you declare a file without the 'keyed' keyword in the RPG program then the file will be accessed in arrival sequence and the argument used on SETLL and CHAIN operations always refers to the relative record number in the file. The key fields defined on the file are not used in that scenario.

                          Comment

                          Working...
                          X