ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Spool file size

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

  • Spool file size

    Hi,
    Can some one suggest if I can find actual spool file size in bytes?
    While transmission of file I found actual bytes transmitted which varies from one displayed in WRKSPLF command.

    Thank you

  • #2
    Re: Spool file size

    How was file transmitted?

    Comment


    • #3
      Re: Spool file size

      File transmission is by NDM

      Comment


      • #4
        Re: Spool file size

        Not sure man. If the bytes transmitted is greater than the size on original machine, but result file size at destination is the same, then transmission bytes may be including datagram packet information in its calculation.

        If the result file at destination has a different size then we're going to have to call in the X-Files... unless that again has something to do with different blocking factors.

        What is the resultant file size in relation to the original?

        Comment


        • #5
          Re: Spool file size

          I guess AS4000 shows file size (in WRKSPLF) is not precise and is rounded.

          Actual transmission bytes are 1600 in transmission log and in spool (WRKSPLF command) it is showing 28 KB

          There should be some way to get exact size of spool file (QSYSPRT as program described), never used in past.

          Comment


          • #6
            Re: Spool file size

            maybe it is related to different enviroments (from AS400 to Windows - EBCDIC-ASCII)

            anyway, we have some control on this by no. of pages to make sure the FTP was transmitted successfully.

            Comment


            • #7
              Re: Spool file size

              The value of the spooled file size in WRKSPLF command is a rounded number.

              To get the actual spool file size, use the QUSRSPLFA api, and in position 1472 of the SPLA0100 format is the actual spool file size.
              Michael Catalani
              IS Director, eCommerce & Web Development
              Acceptance Insurance Corporation
              www.AcceptanceInsurance.com
              www.ProvatoSys.com

              Comment


              • #8
                Re: Spool file size

                you can call that wacky thing in cl if ya want to
                Code:
                DCL  &PAGES     *DEC    5
                DCL  &WHICHSPLF *CHAR   4
                DCL  &RCVLEN    *CHAR   4
                DCL  &RECEIVER  *CHAR 144
                
                /* Get number of pages produced by report */
                CHGVAR     VAR(%BIN(&WHICHSPLF)) VALUE(-1)
                CHGVAR     VAR(%BIN(&RCVLEN)) VALUE(144)
                CALL       PGM(QUSRSPLA) PARM(&RECEIVER &RCVLEN +
                             'SPLA0100' '*' ' ' ' ' QSYSPRT &WHICHSPLF)
                CHGVAR     VAR(&PAGES) VALUE(%BIN(&RECEIVER 141 4))
                also here is an RPG version

                Code:
                    ‚**************************************************************************
                
                     ‚* Program name:     RTVPRTFAR                                            *
                
                     ‚* Called from:      RTVPRTFAC (CPP for command RTVPRTFA)                 *
                
                     ‚* Date created:     April 18, 2003                                       *
                
                     ‚* Original author:  Tony Davis (T. Davis Consulting Inc.)                *
                
                     ‚* Description:      RETRIEVE PRINT FILE ATTRIBUTES                       *
                
                     ‚**************************************************************************
                
                  
                
                     H DATFMT(*ISO) DATEDIT(*YMD)
                
                       
                
                      * Retrieve Spool File Attributes
                
                     d QUSRSPLA        pr                  Extpgm('QUSRSPLA')
                
                     d  Spl_Attrib_DS             32767a   varying
                
                     d  Receiver_Len                 10i 0 const
                
                     d  Format_Name                   8a   const
                
                     d  Qual_Job_Name                26a   const
                
                     d  Int_JobID                    16a   const
                
                     d  Int_SpoolID                  16a   const
                
                     d  Spl_File_Name                10a   const
                
                     d  Spl_File_Numb                10i 0 const
                
                     d  Error_DS                    272a   options(*nopass)
                
                  
                
                  
                
                      * Qualified Spool File Job Name
                
                     d spl_jobname_ds  ds            26
                
                     d  spl_jname                    10a
                
                     d  spl_uname                    10a
                
                     d  spl_jnumber                   6a
                
                  
                
                      * List Spooled Files
                
                     d QUSLSPL         pr                  Extpgm('QUSLSPL')
                
                     d  Space_Name                   20a   const
                
                     d  Format_Name                   8a   const
                
                     d  User_Name                    10a   const
                
                     d  Qual_Outq                    20a   const
                
                     d  Form_Type                    10a   const
                
                     d  User_Spec_Dta                10a   const
                
                     d  Error_DS                    272a
                
                     d  Qual_Job_Name                26a   const
                
                     d  Key_Array                    20    const
                
                     d  Key_Count                    10i 0 const
                
                  
                
                     d Key_Count       c                   5
                
                  
                
                      *********************************************************************
                
                      * Spool File Attributes (retrieved from QUSRSPLA API)               *
                
                      *********************************************************************
                
                     d spl_attrib_ds   ds          3780    based(attr_ptr)
                
                     d  attr_retrn                   10i 0
                
                     d  attr_avail                   10i 0
                
                     d  attr_uname            59     68a
                
                     d  attr_usrdta           99    108a
                
                     d  attr_hold            129    138a
                
                     d  attr_nbr_page        149    152i 0
                
                     d  attr_outq            191    200a
                
                     d  attr_outqlib         201    210a
                
                     d  attr_date            211    217a
                
                     d  attr_system         3421   3428a
                
                     d  attr_user           3437   3446a
                
                     d  attr_spl_size       3777   3780i 0
                
                  
                
                      *********************************************************************
                
                      * Return Parameters                                                 *
                
                      *********************************************************************
                
                     d attr_nbr_pag_a  s             10
                
                     d attr_nbr_pag_x  s             10
                
                     d attr_spl_siz_a  s             10
                
                     d attr_spl_siz_x  s             10
                
                     d attr_hold_a     s             10
                
                     d attr_outq_a     s             10
                
                     d attr_outqlib_a  s             10
                
                     d attr_date_a     s              8
                
                     d attr_system_a   s              8
                
                     d attr_user_a     s              8
                
                  
                
                      * date spooled file opened - from API
                
                     d attr_date_ds    ds             7
                
                     d  date_cent                     1a
                
                     d  date_year                     2a
                
                     d  date_month                    2a
                
                     d  date_day                      2a
                
                  
                
                      *********************************************************************
                
                      * VARIABLES                                                         *
                
                      *********************************************************************
                
                     d attr_fmtname    s              8a   inz('SPLA0200')
                
                     d attr_data_str   s          32767a   inz varying
                
                     d attr_ptr        s               *   inz
                
                     d cmd_length      s             15p 5 inz
                
                     d cmd_string      s           1024a   inz
                
                     d length          s             10i 0 inz
                
                     d int_job_id      s             16a   inz
                
                     d int_spl_id      s             16a   inz
                
                     d spl_filname     s             10a
                
                     d spl_filnum_a    s              6a
                
                     d spl_filnum      s             10i 0
                
                     d nbrparms        s             10s 0
                
                  
                
                      *********************************************************************
                
                      * POINTERS TO PARAMETERS, needed in order to test for *NULL value   *
                
                      * passed from command (when using RTNVAL(*YES) in the command) if   *
                
                      * a parameter is not selected, then *NULL pointer is delivered to   *
                
                      * the command processor, and %parms is not sufficient to determine  *
                
                      * whether or not that parameter is OK to address.                   *
                
                      *********************************************************************
                
                     d PtrParm4        s               *   inz
                
                     d PtrParm5        s               *   inz
                
                     d PtrParm6        s               *   inz
                
                     d PtrParm7        s               *   inz
                
                     d PtrParm8        s               *   inz
                
                     d PtrParm9        s               *   inz
                
                     d PtrParm10       s               *   inz
                
                     d PtrParm11       s               *   inz
                
                     d PtrParm12       s               *   inz
                
                     d PtrParm13       s               *   inz
                
                  
                
                      *********************************************************************
                
                      *                                                                   *
                
                      *                        - Begin Program -                          *
                
                      *                                                                   *
                
                      *********************************************************************
                
                  
                
                     c     *entry        plist
                
                01   c                   parm                    spl_filname
                
                02   c                   parm                    spl_jobname_ds
                
                03   c                   parm                    spl_filnum_a
                
                04   c                   parm                    attr_spl_siz_a
                
                05   c                   parm                    attr_spl_siz_x
                
                06   c                   parm                    attr_nbr_pag_a
                
                07   c                   parm                    attr_nbr_pag_x
                
                08   c                   parm                    attr_hold_a
                
                09   c                   parm                    attr_outq_a
                
                10   c                   parm                    attr_outqlib_a
                
                11   c                   parm                    attr_date_a
                
                12   c                   parm                    attr_system_a
                
                13   c                   parm                    attr_user_a
                
                  
                
                     c                   eval      nbrparms = %parms
                
                  
                
                     c                   select
                
                     c                   when      spl_filnum_a = '*LAST'
                
                     c                   eval      spl_filnum = -1
                
                  
                
                     c                   when      spl_filnum_a = '*ONLY'
                
                     c                   eval      spl_filnum = 0
                
                  
                
                     c                   other
                
                     c                   move      spl_filnum_a  spl_filnum
                
                     c                   endsl
                
                  
                
                      * Do 1st pass to determine how much data is available to be returned
                
                     c                   eval      %len(attr_data_str)=8
                
                     c                   eval      length=%len(attr_data_str)
                
                  
                
                     c                   callp     qusrspla(
                
                     c                                      attr_data_str:
                
                     c                                      length:
                
                     c                                      attr_fmtname:
                
                     c                                      spl_jobname_ds:
                
                     c                                      int_job_id:
                
                     c                                      int_spl_id:
                
                     c                                      spl_filname:
                
                     c                                      spl_filnum)
                
                  
                
                      * Set attribute data structure to address of data string
                
                     c                   eval      attr_ptr=%addr(attr_data_str)
                
                  
                
                      * Do second pass to retrieve all spool file attributes
                
                     c                   eval      %len(attr_data_str)=attr_avail
                
                     c                   eval      length=%len(attr_data_str)
                
                  
                
                     c                   callp     qusrspla(
                
                     c                                      attr_data_str:
                
                     c                                      length:
                
                     c                                      attr_fmtname:
                
                     c                                      spl_jobname_ds:
                
                     c                                      int_job_id:
                
                     c                                      int_spl_id:
                
                     c                                      spl_filname:
                
                     c                                      spl_filnum)
                
                  
                
                      *********************************************************************
                
                      *                                                                   *
                
                      *                      - Return Paramaters -                        *
                
                      *                                                                   *
                
                      *********************************************************************
                
                  
                
                      * set address of parameter to variable/pointer
                
                     c                   eval      PtrParm4  = %addr(attr_spl_siz_a)
                
                     c                   eval      PtrParm5  = %addr(attr_spl_siz_x)
                
                     c                   eval      PtrParm6  = %addr(attr_nbr_pag_a)
                
                     c                   eval      PtrParm7  = %addr(attr_nbr_pag_x)
                
                     c                   eval      PtrParm8  = %addr(attr_hold_a)
                
                     c                   eval      PtrParm9  = %addr(attr_outq_a)
                
                     c                   eval      PtrParm10 = %addr(attr_outqlib_a)
                
                     c                   eval      PtrParm11 = %addr(attr_date_a)
                
                     c                   eval      PtrParm12 = %addr(attr_system_a)
                
                     c                   eval      PtrParm13 = %addr(attr_user_a)
                
                  
                
                      * size of spooled file (left justified)
                
                     c                   if        %parms >= 4 and PtrParm4 <> *NULL
                
                     c                   move      attr_spl_size attr_spl_siz_a
                
                     c                   if        %parms >= 5 and PtrParm5 <> *NULL
                
                     c     '0':' '       xlate     attr_spl_siz_aattr_spl_siz_x
                
                     c                   eval      attr_spl_siz_x = %triml(attr_spl_siz_x)
                
                     c                   end
                
                     c                   end
                
                  
                
                      * number of pages in spool file (left justified)
                
                     c                   if        %parms >= 6 and PtrParm6 <> *NULL
                
                     c                   move      attr_nbr_page attr_nbr_pag_a
                
                     c                   if        %parms >= 7 and PtrParm7 <> *NULL
                
                     c     '0':' '       xlate     attr_nbr_pag_aattr_nbr_pag_x
                
                     c                   eval      attr_nbr_pag_x = %triml(attr_nbr_pag_x)
                
                     c                   end
                
                     c                   end
                
                  
                
                      * hold spooled file
                
                     c                   if        %parms >= 8 and PtrParm8 <> *NULL
                
                     c                   eval      attr_hold_a = attr_hold
                
                     c                   end
                
                  
                
                      * output queue name
                
                     c                   if        %parms >= 9 and PtrParm9 <> *NULL
                
                     c                   eval      attr_outq_a = attr_outq
                
                     c                   end
                
                  
                
                      * output queue library name
                
                     c                   if        %parms >= 10 and PtrParm10 <> *NULL
                
                     c                   eval      attr_outqlib_a = attr_outqlib
                
                     c                   end
                
                  
                
                      * date
                
                     c                   if        %parms >= 11 and PtrParm11 <> *NULL
                
                     c                   eval      attr_date_ds = attr_date
                
                     c                   eval      attr_date_a =
                
                     c                             ('20' + date_year   +
                
                     c                                     date_month  +
                
                     c                                     date_day)
                
                     c                   end
                
                  
                
                      * system name
                
                     c                   if        %parms >= 12 and PtrParm12 <> *NULL
                
                     c                   eval      attr_system_a = attr_system
                
                     c                   end
                
                  
                
                      * user
                
                     c                   if        %parms >= 13 and PtrParm13 <> *NULL
                
                     c                   eval      attr_user_a = attr_user
                
                     c                   end
                
                  
                
                      * End of program
                
                     c                   return
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment

                Working...
                X