ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Error when using CPYTOIMPF command

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

  • Error when using CPYTOIMPF command

    Hi all,

    I am trying to move one logical file data int flat file using command CPYTOIMPF but i am getting error.

    Any idea why this error is coming? I attached the error screen shot. Also whats the alternate way of downloading the data.

    Regards,

    Pintu
    Attached Files

  • #2
    Re: Error when using CPYTOIMPF command

    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	86.3 KB
ID:	126732
    By error msg it says from file is incorrect but from file is logical file only and i can see the data using runqry command

    Comment


    • #3
      Re: Error when using CPYTOIMPF command

      You have to run that command over the physical file.

      Comment


      • #4
        Re: Error when using CPYTOIMPF command

        CPYTOIMPF can run over LFs, but there are restrictions. It might be necessary to see DSPFD or the DDS for the LF to figure out why this LF is a problem.
        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


        • #5
          Re: Error when using CPYTOIMPF command

          Originally posted by tomliotta View Post
          CPYTOIMPF can run over LFs, but there are restrictions. It might be necessary to see DSPFD or the DDS for the LF to figure out why this LF is a problem.
          What kind of problem as per you? I checked and found that this logical file had 2 different record format as it was based on two different physical file.!!

          Comment


          • #6
            Re: Error when using CPYTOIMPF command

            Originally posted by pintusrm2010 View Post
            ...this logical file had 2 different record format as it was based on two different physical file.!!
            In that case, it's not valid for CPYTOIMPF. You can't "import" (CPYFRMIMPF) or "export" (CPYTOIMPF) files with multiple record formats, even if the formats match.

            You might try CPYF to create a temporary PF with the data you want. Then use CPYTOIMPF to export that temporary file.

            That's essentially what the CPF2801 error message that you showed us says needs to be done.
            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


            • #7
              Re: Error when using CPYTOIMPF command

              Hi ,

              Even i cant able to download using CPYF command.

              Getting error like "RCDFMT(*ALL) not valid for file IMHIST02 in library AMFLIB. "

              and if i am specifying a particular record format then data only related to one physical file is getting downloaded.

              ANy idea what need to be done in order to download the logical file data which is based on multiple physical file. ??


              Originally posted by tomliotta View Post
              In that case, it's not valid for CPYTOIMPF. You can't "import" (CPYFRMIMPF) or "export" (CPYTOIMPF) files with multiple record formats, even if the formats match.

              You might try CPYF to create a temporary PF with the data you want. Then use CPYTOIMPF to export that temporary file.

              That's essentially what the CPF2801 error message that you showed us says needs to be done.

              Comment


              • #8
                Re: Error when using CPYTOIMPF command

                That's right. You need to copy the physical files, not the invalid LF. If you want all PFs copied into the same "export" file, you can possibly use the CPYTOIMPF MBROPT(*ADD) option.
                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


                • #9
                  Re: Error when using CPYTOIMPF command

                  One more query... If a LF has two record format say A and B . A record format for PF A1 and B record format for B1 . There is no select and omit condition in LF. so if we run sql command on LF then this LF will show totat record as sum of record present in A1 and B1? So in case A1 has 50 record and B1 has 100 reocord ,so LF will show total 150 records?

                  Also any other idea how we can download multi record format LF?
                  Originally posted by tomliotta View Post
                  That's right. You need to copy the physical files, not the invalid LF. If you want all PFs copied into the same "export" file, you can possibly use the CPYTOIMPF MBROPT(*ADD) option.

                  Comment


                  • #10
                    Re: Error when using CPYTOIMPF command

                    Originally posted by pintusrm2010 View Post
                    One more query... If a LF has two record format say A and B . A record format for PF A1 and B record format for B1 . There is no select and omit condition in LF. so if we run sql command on LF then this LF will show totat record as sum of record present in A1 and B1? So in case A1 has 50 record and B1 has 100 reocord ,so LF will show total 150 records?
                    It shouldn't. It should throw message SQL7003 "File ... has more than one format." The LF 'S'elect/'O'mit isn't relevant. The relevant part is that the LF file description lists two record formats.

                    Also any other idea how we can download multi record format LF?
                    Sure. Write programs to have the download work any way you choose with any file you want. It's not necessary to use system tools.
                    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


                    • #11
                      Re: Error when using CPYTOIMPF command

                      Originally posted by tomliotta View Post
                      It shouldn't. It should throw message SQL7003 "File ... has more than one format." The LF 'S'elect/'O'mit isn't relevant. The relevant part is that the LF file description lists two record formats.



                      Sure. Write programs to have the download work any way you choose with any file you want. It's not necessary to use system tools.
                      One more query. I am not able to download one PF. I am getting error as "Column PBD52 contains replacement character +"

                      When i saw that column i saw data like :

                      PBD52
                      ++++++++++
                      ++++++++++
                      ++++++++++
                      ++++++++++
                      ++++++++++
                      ++++++++++
                      ++++++++++
                      ++++++++++
                      ++++++++++


                      Any idea what it means and how to download this data.

                      Comment


                      • #12
                        Re: Error when using CPYTOIMPF command

                        Originally posted by pintusrm2010 View Post
                        Any idea what it means and how to download this data.
                        It essentially means that the value in the column is invalid for whatever you're trying to do. Some part of the process is unable to prepare the data to show it to you.

                        When you see it, what are you doing? Is that shown through a green-screen or on a PC? What tool are you using to "download"? What is the definition of the PBD52 column?
                        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


                        • #13
                          Re: Error when using CPYTOIMPF command

                          Originally posted by tomliotta View Post
                          It essentially means that the value in the column is invalid for whatever you're trying to do. Some part of the process is unable to prepare the data to show it to you.

                          When you see it, what are you doing? Is that shown through a green-screen or on a PC? What tool are you using to "download"? What is the definition of the PBD52 column?
                          It is showing on green screen itself. I am moving the data in IFS folder in .csv format using CPYTOIMPF command but this file is not getting downloaded. This field contain finance related data like price.

                          Comment


                          • #14
                            Re: Error when using CPYTOIMPF command

                            And what is the definition of the PBD52 column?
                            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


                            • #15
                              Re: Error when using CPYTOIMPF command

                              Originally posted by tomliotta View Post
                              And what is the definition of the PBD52 column?
                              Hi .. Please find the definition.

                              Click image for larger version

Name:	1.png
Views:	1
Size:	73.1 KB
ID:	126739
                              Click image for larger version

Name:	3.png
Views:	1
Size:	12.0 KB
ID:	126740

                              Is it suffice?

                              Regards,

                              Pintu

                              Comment

                              Working...
                              X