IBM i Global

IBM i Global

Connect, learn, share, and engage with IBM Power.

 View Only
  • 1.  CPY command witch option COMMPRESS ( *NO / *YES )

    Posted Thu September 07, 2023 09:33 AM

    Do you have a such experience ( V7R5 ) ?

    I run CPYF twice with differnet option COMMPRESS (*YES / *NO ), but the same results

    SOURCE file  ( have #75 deleted records )

                                Source Creation    Last Change                  Deleted
    Member           Size        Type  Date       Date     Time      Records    Records
    source    211731464192        23/08/09 23/08/09 13:39:49      233272445     75
      Text:                                                                            
    Total number of members  . . . . . . . . . :                 1                     
    Total number of members not available  . . :                 0                     
    Total records  . . . . . . . . . . . . . . :         233272445                     
    Total deleted records  . . . . . . . . . . :                75                     
    Total of member sizes  . . . . . . . . . . :      211731464192                     

    1.option COMMPRESS (*YES )
    *created empty file via command CRDUPOBJ from SOURCE  with parameter DATA(*NO)
    *CPYF FROMFILE(SOURCE)   TOFILE(TARGET_YES) MBROPT(*REPLACE) 

                                Source Creation    Last Change                  Deleted
    Member           Size        Type  Date       Date     Time      Records    Records
    TARGET   211731423232        23/09/06 23/09/06 14:25:24        233272445     0
      Text:                                                                            
    Total number of members  . . . . . . . . . :                 1                     
    Total number of members not available  . . :                 0                     
    Total records  . . . . . . . . . . . . . . :         233272445                     
    Total deleted records  . . . . . . . . . . :                 0                     
    Total of member sizes  . . . . . . . . . . :      211731423232                     
     
    Here is Total deleted records = 0 , which is OK

    2.option COMMPRESS (*NO )    
    *created empty file via command CRDUPOBJ from SOURCE  with parameter DATA(*NO)
    *CPYF FROMFILE(SOURCE)   TOFILE(TARGET_NO) MBROPT(*REPLACE)   


                                Source Creation    Last Change                  Deleted
    Member           Size        Type  Date       Date     Time      Records    Records
    TARGET_NO 211731423232        23/09/06 23/09/06 14:25:24        233272445   0
      Text:                                                                            
    Total number of members  . . . . . . . . . :                 1                     
    Total number of members not available  . . :                 0                     
    Total records  . . . . . . . . . . . . . . :         233272445                     
    Total deleted records  . . . . . . . . . . :                 0                     
    Total of member sizes  . . . . . . . . . . :      211731423232                     

    Here is Total deleted records = 0 , which should be 75, am I right ?
    HELP for COMPRESS (*NO) ob CPYF command
    Both the deleted and nondeleted records are copied to the to-file.   

    HELP for COMMPRESS option
    Explanation about COMMPESS parameter on CPYF command 
    https://www.ibm.com/docs/en/i/7.5?topic=copy-copying-deleted-records-compress-parameter


    Compress out deleted records (COMPRESS)
    Specifies whether the to-file contains a compressed form of the from-file. Compression occurs when deleted records in the from-file are not copied to the to-file. *NO is used to copy all records when the from-file and to-file are both physical files. If from-file is delete-capable and the to-file is not delete-capable, then *YES must be specified. 
    *YES
    The records copied to the to-file are compressed. Deleted records that exist in the from-file are not copied to the to-file. 
    *NO
    Both the deleted and nondeleted records are copied to the to-file.   

    Thx   Roman



    ------------------------------
    Roman HORSKY
    ------------------------------


  • 2.  RE: CPY command witch option COMMPRESS ( *NO / *YES )

    Posted Thu September 07, 2023 11:33 AM

    Dear Roman

    Please read this information :  Details of the COMPRESS(*NO) parameter and the Copy File command at https://www.ibm.com/docs/en/i/7.5?topic=parameter-details-compressno-copy-file-command    and take note of this sentence : 

    The COMPRESS(*NO) parameter allows the system to copy more quickly because records are transferred in blocks, but this is not always true.   

    and then this one :

    If you do not specify the COMPRESS(*NO) parameter, the system might still use the internal functions to perform the copy, but the choice of how the copy is performed is based on the number of records in the from-file and to-file members before the copy, and the number of keyed access paths over the to-file member.

    When you encounter such description, it's a good learning experience that the function is not designed for black and white behaviour and what you found in your experiment  fits the description above.  Now what you need to do is to adjust your way of understanding how a function of your interest works by interpreting IBM's subtle explanation such as ones I quoted above.

    My guess is that the fact that there are so little number of deleted rows is a factor here that influences what you found out.  If, say, your file has 50,000 deleted rows, I'm fairly confident you will see different result regarding the treatment of the deleted rows in the copy operation.



    ------------------------------
    Chance favors only the prepared mind.
    -- Louis Pasteur
    ------------------------------
    Satid S.
    ------------------------------



  • 3.  RE: CPY command witch option COMMPRESS ( *NO / *YES )

    Posted Wed September 13, 2023 10:27 AM

    Hello Roman

    I did some research and it seems COMPRESS(*NO) works only when FROMRCD/TORCD is specified for keyed file as Record number.

    For examples:

    CPYF FROMFILE(SOURCE)   TOFILE(TARGET_NO) MBROPT(*REPLACE)   FROMRCD(1) COMPRESS(*NO) - will copy Deleted recrds.

    Thanks & Regards.

    Lev.



    ------------------------------
    lev ostromich
    ------------------------------