ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Output physical file

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

  • Output physical file

    Hello again,

    I've been googling for quite some time now and cannot find a clear answer on how to do what I would guess is really pretty easy and I wanted to get some opinions.

    I have a physical file full of file information from the output of dspobjd. I created a tool using php/mysql that parses through that info for the create & last dates to look for objects that haven't been used for years.

    I found a way to finagle a file (member) to a text editor but it's not text. I'm thinking that I need to output the file to a spool or print file and then get the info out that way.

    But basically, I have a physical file that I want to create a text file out of the contents.

    What say you? Easy?
    I'm always worried at the end of the day that I may accidentally type in singoff.

  • #2
    Re: Output physical file

    Why would you do this with PHP?
    This is a very very simple task in RPG alone.

    I think you best bet would be to email back to the user that requested the data.
    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


    • #3
      Re: Output physical file

      Do you want to dump the PF into a text file. If so;

      QSYS/CPYTOIMPF FROMFILE(SLS8001PF) TOSTMF('/reports/sls.txt') RCDDLM(*LFCR) DTAFMT(*FIXED)
      This dumps a PF to a flat text file in folder /reports

      not sure what " get the info out that way." means. I hope you dont want to parse the text file versus the PF from dspobjd.
      Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

      Comment


      • #4
        Re: Output physical file

        @jamief - You are probably correct, however, the server that has the data on it doesn't have web access and I built the tool as a webservice. Plus, and thank you to all here, I do know RPG much better than I did, I still can get the tool built in PHP in an hour instead of RPG in a couple days...

        @deadman - Yep, that is what I wanted to do... Though it would be much better if it was in the format of dspobjd instead of all crushed together.

        Is there a better way? I know that there are RPG programs that creates PDFs from portions of a huge spool file... but it's an stored procedure that calls an SQL RPG that calls a CL that calls a RPGLE and by the time it gets to the 4th program, I'm lost on how it does what it does.

        Thanks!
        I'm always worried at the end of the day that I may accidentally type in singoff.

        Comment


        • #5
          Re: Output physical file

          I have written a PHP program that reads DB2 data and writes out a XML multi tabbed excel spread sheet.
          I then initiate the download from the server to the user running the application.

          Its the same as the RPG version that is posted on this forum (somewhere)

          Let me know if this would work for you
          Click image for larger version

Name:	Noname.jpg
Views:	1
Size:	232.5 KB
ID:	126626
          Jamie
          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


          • #6
            Re: Output physical file

            It almost would - except the server that the db2 data is on, PHP cannot communicate with. I actually tried that first from PHP by adding the library name to the library list in the db2_connect() function, but it failed because that particular library wasn't on the web machine, but the one not connected to the web. However, deadman's option does work for me and I mailed the file to myself because that non-connected machine can bounce email from the web one. I have the file and it isn't as pretty as the dspobjd version I can see on the greenscreen, it does have a solid format that I can parse using substr on each line and extract the 4 elements I need out of it.

            However, I wouldn't mind seeing the RPG version for my future use - I'm thinking this won't be the last time I'll want to extract data from physical files on that machine....
            I'm always worried at the end of the day that I may accidentally type in singoff.

            Comment


            • #7
              Re: Output physical file

              this is the RPG version:


              I can send you the PHP version, but as RPG is your 2nd language PHP is my 9th or 10th
              I have some of the code in an include and would need to pull out to send.

              Jamie
              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


              • #8
                Re: Output physical file

                Thank you for that, it does look very "automagical" (Nice word!)

                Don't worry about the PHP version, I breathe PHP, but I can actually see what that RPG is doing and will be helpful!

                Thanks!
                I'm always worried at the end of the day that I may accidentally type in singoff.

                Comment


                • #9
                  Re: Output physical file

                  You can connect to db2 using an odbc connection and specify the library list there , all in PHP.
                  Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                  Comment

                  Working...
                  X