Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

CPYF question.

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

  • CPYF question.

    I didn't see an option in CPYF for multiple values when selecting by record position. I'd use SQL to get the appropriate rows needed. Depending on the source table and columns, you could use something like this:
    Code

  • #2
    CPYF question.

    Hi, The source is just a flat file and I have only the record positions. I dont have the field names. I need an alternative to using INCCHAR (*RCD pos) when there is more than one criteria to be seleccted. Thanks.

    Comment


    • #3
      CPYF question.

      Instead of trying to create the end file from 1 CPYF command, why not create an intermediery file, using 1 CPYF with the *INCCHAR(*RCD 135 *EQ 'A') creating FILEA, then do a 2nd CPYF from FILEA to FILEB with *INCCHAR(*RCD 145 *EQ 'XYZ'). Granted, this method is not as neat as what you hoped to achieve, but it does get the end result. Alan Shore

      Comment


      • #4
        CPYF question.

        Alan's solution will work fine. But you could still use SQL against flat files. The flat files I work with will have a single field name - F00001 - so that can be referenced as a regular field name would. Do a DSPFFD against the file in question for the field name. I changed the SQL statement to show how it would work:
        Code

        Comment


        • #5
          CPYF question.

          How about Format Data (FMTDTA)? You have to create a sort source member, but your conditions are not complicated. If there are no indices over the substrings you're testing, FMTDTA might have better performance than SQL. Read source as:[*] Regular sort, no control fields (i.e., no sorting, just a copy request).[*] Include by character test where column 135='A' AND where columns 145-147='XYZ'.[*] Output data from column 1 thorugh 9999. You'll have to substitute actual record length for the 9999.
          Code

          Comment


          • #6
            CPYF question.

            Hi, I need to extract data from a file based on the position value and not field name,eg using CPYF command I need to use 2 conditions for INCCHAR parameter *INCCHAR(*RCD 135 *EQ 'A') AND *INCCHAR(*RCD 145 *EQ 'XYZ'). But, is there a way to have 2 conditions on cpyf command. What are the options to get this done? Please advise. Thanks Regds,

            Comment


            • #7
              CPYF question.

              Another option is OPQNRYF. Advantage is no extra source member needed (FMTDTA needs sort source, SQL statements would be in a source member, executed by RUNSQLSTM). Performance should be the same as SQL.
              Code

              Comment

              Working...
              X