ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Scan checks in spool file

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scan checks in spool file

    I want to programmatically scan a spool file that contains check disbursements. The user will provide a check number as the scan argument, and the program will return the spool file page number containing the check number.

    Thanks in advance for any recommendations?

  • #2
    create a flat file, cpysplf to that file then just use SQL (or read row by row) searching for that string
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      I think the solution provided by Tom might work, although you may need to scan the file twice if the page number appears above the check number; hold it - are there page numbers in the spool file? If not, I guess that solution won't work.

      It may be better to back up a bit and add code to the program that creates the spool file and have it track which page ends up with which check number, and update a file with that information for later retrieval.

      Cheers,

      Emmanuel

      Comment


      • #4
        If page numbers are not in the spooled file, you may have to use CTLCHAR(*FCFC) or CTLCHAR(*PRTCTL) to put control characters into the database file, and then count the page numbers as you read thru the database file. The control characters show where a new page begins.

        Comment


        • #5
          What elements are part of the checks? I.e., is it just text or are there *PAGSEGs, etc., that could complicate things? And how comfortable are calling APIs?
          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
            Originally posted by psomerscsfb View Post
            I want to programmatically scan a spool file that contains check disbursements. The user will provide a check number as the scan argument, and the program will return the spool file page number containing the check number.

            Thanks in advance for any recommendations?
            Is the program that generates the check available to modify? If so, how about modifying it to update a table with the desired information and when the user enters the check number the program interrogates that table to find out the page number in the spool file.

            In the event that's not an option - the CL program you generate could use CPYSPLF into a file and your program search through that to find the information you're looking for.

            Comment


            • #7
              You shouldn't have to do anything too complicated to get the page count - every check undoubtedly has some keywords - 'CHECK NUMBER' for example - count the times you see that at the expected place... the first time will be page 1, second one page 2, etc...

              Comment


              • #8
                Originally posted by Rocky View Post
                You shouldn't have to do anything too complicated to get the page count - every check undoubtedly has some keywords - 'CHECK NUMBER' for example - count the times you see that at the expected place... the first time will be page 1, second one page 2, etc...
                Which would be true only if the check stub information fits on single check. A list of invoices being paid could require multiple check stubs to completely print that detail, with the actual check forms for those pages needing to be voided. So pages 1 and 2 could be complete checks, while pages 3, 4, and 5 could end up being the "third" check. Depending on the OP's requirements, this could be one reason simply looking for something like "CHECK NUMBER" might lead to an invalid page number count.

                Best Regards,
                Fred Williams

                Comment


                • #9
                  Fred,

                  You can take that into account in your program easy enough as even the extra stubs will have a keyword(s) you can key on.

                  Rocky

                  Comment

                  Working...
                  X