ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Rlssplf splnbr(*any)

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

  • Rlssplf splnbr(*any)

    I have a program that I want to release the spool files that are on hold as the very last step. There may be mutiple spool files with the same name and I want to release them all. I have some code in the program that goes liike this:
    Code:
    RETRY:       RLSSPLF    FILE(APDDCHK) SPLNBR(*ANY)                       
                 MONMSG     MSGID(CPF3300) EXEC(GOTO CMDLBL(ENDTAG))          
                 GOTO       CMDLBL(RETRY)                                     
    ENDTAG:      ENDPGM
    The program blows up because there are more than one spool file with the same name. To me, ANY means ANY but apparently not. I want to reelase them in the order they were created, if possible so *LAST is not a a choice. Also, they may not be ordered consecutively, that is, there may be a APDDCHK nmbr(0001), APDDCHK nmbr(0002), APDDCHK nmbr(0003) and APDDCHK nmbr(0005) but no APDDCHK nmbr(0004).

    How can I make the program release them in order created.

  • #2
    Re: Rlssplf splnbr(*any)

    Originally posted by gregwga50
    To me, ANY means ANY but apparently not.
    It's true... "Apparently not." What a particular value means to you is less important than what it means to the command. To see what it means to the command, review the {Help} text. The meaning of SPLNBR(*ANY) is:
    ...Use this value when the job
    system name parameter or the spooled file create date
    and time parameter
    is to take precedence over the
    spooled file number when selecting a spooled file.
    If you can make use of the JOBSYSNAME() or CRTDATE() parameter, then "*ANY" will be useful. Otherwise you need to specify a SPLNBR() value that meets requirements.

    The List Spooled Files (QUSLSPL) API can return the spooled files for a job. Format SPLF0300 includes create date/time, so you can choose which are first or last.
    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


    • #3
      Re: Rlssplf splnbr(*any)

      FWIW as the machines got faster in v5r4 IBM made changes to the *SPLF commands & APIs due to "phantom" spooled files (machines simply ran too fast and it appeared to the system that there were 2 spooled files with the same number/user/job and spooled file number) the "fix" was to include the CRTDATE() values and they would process as expected. i recently ran into this after a hardware upgrade and spent some quality time with a very helpful lady (wish I could remember her name!) at IBM support. needless to say my predecessor used CPYSPLF into flat files and parsed them all over the place (put I had to modify my programs that used APIs) to add that keyword to avoid the error. so in essence simply using number/user/job and spooled file number isn't enough anymore.
      I'm not anti-social, I just don't like people -Tommy Holden

      Comment


      • #4
        Re: Rlssplf splnbr(*any)

        It might be easier to put some user-data on the spooled file, and then use RLSSPLF *SELECT to release them.

        Or, pehaps best, save all of the spooled file identifiers (splf name, job/user/nbr, splf number) into an array when the spooled file is created. Then, loop thru the array, and RLSSPLF for each one.

        Comment


        • #5
          Re: Rlssplf splnbr(*any)

          RLSSPLF *SELECT would be good if any UserData was kept unique to this job (or was understood potentially to affect files from other jobs). Storing spoolfile data in an array could also be good if it was reasonably certain that no other spooled files were created in the job before or while these are being created.
          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


          • #6
            Re: Rlssplf splnbr(*any)

            With the array method, I don't see why it'd be a problem to have other spooled files created before or during?? The array would contain unique identifiers for each spooled file, retrieved when each file is created, so you'd have an exact list of files to release and you'd just spin through them.

            Using userdata would require you to have a string that's unique to this program within this job, so that string might be tricky to come by -- but, side from that, it would be easy to code.

            Comment


            • #7
              Re: Rlssplf splnbr(*any)

              Originally posted by Scott Klement View Post
              The array would contain unique identifiers for each spooled file, retrieved when each file is created,...
              Ah, right... spoolfile number is in the open feedback for printer files.

              Never mind.
              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

              Working...
              X