sponsored links



No announcement yet.

Can the STRCPYSCN command be used to Scrape Info from AS400 Screen

  • Filter
  • Time
  • Show
Clear All
new posts

  • Can the STRCPYSCN command be used to Scrape Info from AS400 Screen

    I am a AS400 newbie, and I want to know if I could use the STRCPYSCN command to Scrape Info from AS400 Screen. I want to automate the process of copying Spool Files to a Shared Folder, and the CPYSPLF command requires certain information about the Spool File (such as User Name, Job Name, etc.)

    Client Access is being used, and the PCOMM emulator is also being used. I have never used STRCPYSCN, but hopefully I can get some help from someone on this.

    Many Thanks
    Al Rice

  • #2
    First, IBM stopped making the AS/400 last century, so that term obsolete.

    According to the InfoCenter (https://www.ibm.com/support/knowledg.../strcpyscn.htm), that command is used for one 5250 screen to view another 5250 screen. Are you trying to access a different 5250 job? It sounds to me like you want to screen-scrape the current 5250 job, which would be something different.



    • #3
      If you could supply more details on what you are trying to achieve, we might be able to assist you better. If all you are wanting to do is copy a report, STRCPYSCN seems a very bad choice. Where do the reports come from? What determines if they should be copied? etc.


      • #4
        Thanks to those who responded, so far. As additional background, I have a recurring (daily) need to copy some 40, or so, spool files (txt reports) to a Shared Folder in Windows such that these spool files (txt reports) are accessible to a Data Analytics tool (Monarch). I am using the CPYSPLF command to copy these spool files to a Physical File and then using CPYTOIMPF to copy the Physical File the Shared Folder.

        Using the CPYSPLF command requires input of spool file information which is specific to each spool file or group of spool files. For example I have 36 files which share the same (1) Spool File Name, (2) User name and (3) Spool File Number. As the intent is to automate this whole process, I am trying to fine a way the automate getting the three (3) pieces of information without manual intervention. I though I could use the WRKSPLF command to launch the Spool Files by Name, then use the STRCPYSCN command to get the User Name and Spool File Number information. The automation script would use these two values to complete the CPYSPLF process and the continue on with the CPYTOIMPF command.

        I truly hope this is clear. And hopefully this is enough to get some assistance.



        • #5
          You don't mention the version of the OS you're using, but if it's fairly recent, the QSYS2.OUTPUT_QUEUE_ENTRIES_BASIC view might be a way to accomplish what you need.




          • #6
            Hello Emmanuel

            I googled "QSYS2.OUTPUT_QUEUE_ENTRIES_BASIC " and It looks like a this view could be queried and certain attributes of Spool files can be retrieved using a Select statement. Since I know the Spool File name and the User Name and the Date the spool files are created, then a Select statement can be crafted to retrieve the Spool file Number... RIght?

            Do you know if results of the select statement be written out to a text file, ideally directly to the Shared Folder, where my VBA automation code could pick up the Spool File number to complete the full automation I am trying to accomplish?

            Would you happen to have example code (WRKQRY or Select statement) similar to this that I can edit for my purpose.

            BTW... you are amazingly helpful... Thanks,


            • #7
              There are several ways this could be done depending on your setup.
              For instance, would it be possible to modify the program that creates the reports to copy them after? Could you put a CL wrapper around the program to copy it after?
              If these particular reports went to a specific output queue, you could attach a DTAQ to that output queue so whenever a report was put in the output queue, the system will place an entry in the DTAQ. You could create a program to use the info to copy your reports. I don't know what OS you are using, this link is for V7R2. https://www.ibm.com/support/knowledg...6/dqoutput.htm
              The nice thing about the above approaches is they could be done in real time.
              You could use the SQL view QSYS2.OUTPUT_QUEUE_ENTRIES_BASIC. You can get an example of its use from ACS using the "insert by examples" feature.
              If they just go to a general output queue, the QUSLSPL API could be used. It is a complex API though.
              It may be possible to use the WRKSPLF command (which has a print option) to create your list as well. I'm not a fan of using spool output as the format can change from release to release which means your program may need more maintenance so I prefer an API if possible.


              • #8
                Hi All,

                Well, a straight select * from QSYS2.OUTPUT_QUEUE_ENTRIES_BASIC, with output to a file should do it. You're apparently familiar with CPYTOIMPF - that could be used to place the resulting file in the shared folder.




                • #9
                  Thanks... I will try it tonight. Thanks much... Al