ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

dspfd and dspobjd outfile declaration problem.

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

  • dspfd and dspobjd outfile declaration problem.

    Hello

    i have a cl, what is use two command to create outfile.

    dspfd and dspobjd, and i have a RPGLE program where i want use this outfiles, but when i try to cimpile get error, cause this ourfiles not have sources.

    anyone know how to need to declarate this outfile, or how can i use this files in RPGLE?

  • #2
    Re: dspfd and dspobjd outfile declaration problem.

    Could you please post your CL-command that creates the file and the F-Specs in your RPGLE program.
    Also make sure the Worktable is available and in the library list at compile time.

    Birgitta

    Comment


    • #3
      Re: dspfd and dspobjd outfile declaration problem.

      Originally posted by Jama
      dspfd and dspobjd, and i have a RPGLE program where i want use this outfiles, but when i try to cimpile get error, cause this ourfiles not have sources.
      Seeing what error your are getting might go miles in terms of us helping you too. The source for a physical file is not required for a compile to work on a standard, run-of-the-mill RPGLE program...so that can't be the error your getting.

      Comment


      • #4
        Re: dspfd and dspobjd outfile declaration problem.

        Hi ARobb73:

        Also make sure the Worktable is available and in the library list at compile time.
        That is probably your issue. Run the commands before compile and delete the files after the compile.

        Best of Luck
        GLS
        The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

        Comment


        • #5
          Re: dspfd and dspobjd outfile declaration problem.

          Did you figure out your error? I have a poor man's Hawkeye RPG program that uses both commands and dumps them out to files which are then searched through with SQL. It might help with what you are attempting to do.
          Your friends list is empty!

          Comment


          • #6
            Re: dspfd and dspobjd outfile declaration problem.

            Please do post....Im looking for material for the next site..

            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


            • #7
              Re: dspfd and dspobjd outfile declaration problem.

              Next site Jamie??

              Okay, you'll see in this code I meant it when I said "poor man's version".



              Program to gather references:

              Code:
                   h bnddir( 'QC2LE' )
                   h dftactgrp(*NO)
              
                   fDSPOBJDDMPif   e           k disk
              
                   d RunCmd          pr            10i 0 extproc( 'system' )
                   d command                         *   value options( *string )
              
                    *  -------------------------------------------------------------
                    *  -  Variable declarations                                    -
                    *  -------------------------------------------------------------
              
                   d APOS            c                   Const( X'7D' )
                   d string          s           1000a   varying
              
                    /free
              
                      RunCmd( 'CLRPFM MHASTON/DSPOBJDDMP' );
                      RunCmd( 'CLRPFM MHASTON/DSPPGMREFD' );
              
                      RunCmd( 'DSPOBJD OBJ(HB2320MOD/*ALL) OBJTYPE(*PGM *SRVPGM) '
                            + 'OUTPUT(*OUTFILE) OUTFILE(MHASTON/DSPOBJDDMP) '
                            + 'OUTMBR(*FIRST *ADD)' );
              
                      RunCmd( 'DSPOBJD OBJ(HB2320BFUS/*ALL) OBJTYPE(*PGM *SRVPGM) '
                            + 'OUTPUT(*OUTFILE) OUTFILE(MHASTON/DSPOBJDDMP) '
                            + 'OUTMBR(*FIRST *ADD)' );
              
                      RunCmd( 'DSPOBJD OBJ(HB2320BA/*ALL) OBJTYPE(*PGM *SRVPGM) '
                            + 'OUTPUT(*OUTFILE) OUTFILE(MHASTON/DSPOBJDDMP) '
                            + 'OUTMBR(*FIRST *ADD)' );
              
                      RunCmd( 'DSPOBJD OBJ(HB2320BP/*ALL) OBJTYPE(*PGM *SRVPGM) '
                            + 'OUTPUT(*OUTFILE) OUTFILE(MHASTON/DSPOBJDDMP) '
                            + 'OUTMBR(*FIRST *ADD)' );
              
                      RunCmd( 'DSPOBJD OBJ(CGIDEV2/*ALL) OBJTYPE(*PGM *SRVPGM) '
                            + 'OUTPUT(*OUTFILE) OUTFILE(MHASTON/DSPOBJDDMP) '
                            + 'OUTMBR(*FIRST *ADD)' );
              
              
                      read DSPOBJDDMP;
                      dow not %eof;
              
                        RunCmd( 'DSPPGMREF PGM(' + %trim(ODLBNM) + '/' + %trim(ODOBNM) + ')'
                              + ' OBJTYPE(' + %trim(ODOBTP) + ')'
                              + ' OUTPUT(*OUTFILE) OUTFILE(MHASTON/DSPPGMREFD) '
                              + 'OUTMBR(*FIRST *ADD)' );
              
                        read DSPOBJDDMP;
                      enddo;
              
                      *inlr = *on;
              
              
                    /end-free
              
              
              

              CGIDEV2 version of the program to search and display:

              Code:
                   ×**********************************************************************
                   ×*·compile options
                   ×**********************************************************************
                   h bnddir( 'CGIDEV2' )
                   h dftactgrp( *no )
              
                    /copy cgidev2/qrpglesrc,hspecs
                    /copy cgidev2/qrpglesrc,hspecsbnd
              
                   ×**********************************************************************
                   ×*·files
                   ×**********************************************************************
              
                   ×**********************************************************************
                   ×*·prototypes
                   ×**********************************************************************
                    /copy cgidev2/qrpglesrc,prototypeb
                    /copy cgidev2/qrpglesrc,usec
              
              
                   d PrepareSQL      pr
              
                   d ReadNext        pr              n
              
                   ×**********************************************************************
              
                     //·indicators for GetHtmlIfsMult subprocedure
                   d IfsMultIndicators...
                   d                 ds
                   d  NoErrors                       n
                   d  NameTooLong                    n
                   d  NotAccessible                  n
                   d  NoFilesUsable                  n
                   d  DupSections                    n
                   d  FileIsEmpty                    n
              
                   d sessionid       s             15a
                   d savedQueryString...
                   d                 s          32767    varying
                   d nbrVars         s             10i 0
                   d file            s             10a   varying
                   d library         s             10a   varying
                   d v_file          s             10a   varying
                   d v_program       s             10a   varying
                   d v_library       s             10a   varying
                   d v_usage         s             10a   varying
                   d v_type          s             10a   varying
                   d v_obj           s             10a   varying
                   d prepared        s               n
                   d noData          s               n   Inz( *ON )
                   d bg_style        s            100a   varying inz( 'c_lgtCream' )
              
                   ×**********************************************************************
              
                    /free
              
                      Exec Sql
                        Set Option  closqlcsr = *endmod,
                                    dlyprp = *yes,
                                    srtseq = *langidshr;
              
                      nbrVars = zhbGetInput( savedQueryString : qusec );
                      file = uppify( zhbGetVar( 'file' ) );
                      library = zhbGetVar( 'library' );
                      UpdHtmlVar( 'file' : file );
              
                      ClrHtmlBuffer();
                      GetHtmlIFS( '/CgidevExtHtml/hawkeye.htm' );
                      WrtSection( 'main' );
              
                      if file <> *blanks;
                        WrtSection( 'header' );
              
              ´       dow ReadNext();
              
                        noData = *off;
              
                        If bg_style = 'c_lgtCream';
                          bg_style = *blank;
                        Else;
                          bg_style = 'c_lgtCream';
                        EndIf;
              
                        select;
                          when v_usage = '1';
                            v_usage = 'Input';
                          when v_usage = '2';
                            v_usage = 'Output';
                          when v_usage = '3';
                            v_usage = 'Input/Output';
                          when v_usage = '4';
                            v_usage = 'Update';
                          when v_usage = '5';
                            v_usage = 'Input/Update';
                          when v_usage = '6';
                            v_usage = 'Output/Update';
                          when v_usage = '7';
                            v_usage = 'Input/Output/Update';
                          when v_usage = '8';
                            v_usage = 'Not Specified';
                          when v_usage = '9';
                            v_usage = 'Input/Not Specified';
                          when v_usage = '10';
                            v_usage = 'Output/Not Specified';
                        endsl;
              
                        UpdHtmlVar( 'background' : bg_style );
                        UpdHtmlVar( 'v_library' : v_library );
                        UpdHtmlVar( 'v_program' : v_program );
                        UpdHtmlVar( 'v_usage' : v_usage );
                        UpdHtmlVar( 'v_type' : v_type );
                        UpdHtmlVar( 'v_obj' : v_obj );
              
                        WrtSection( 'line' );
              
              ´       enddo;
              
                      endif;
              
                      if noData;
                        WrtSection( 'no_data' );
                      else;
                        WrtSection( 'end_table' );
                      endif;
              
                      WrtSection( 'end_form' );
                      WrtSection( '*fini' );
              
                      *inlr = *on;
              
                    /end-free
              
                   Î*--------------------------------------------------------------------*
                   Î*À  PrepareSql - prepare the sql statement                          Î*
                   Î*--------------------------------------------------------------------*
                   p PrepareSql      b
                   d PrepareSql      pi
              
                   d APOS            c                   const( X'7D' )
                   d inString        s           1000a   varying inz
                   d sqlString       s           5000a   varying inz
                   d whereString     s           1500a   varying inz
                   d groupString     s           1500a   varying inz
                   d orderString     s           1500a   varying inz
              
                    /free
              
                       sqlString =
              
                         ' select distinct '                                              +
                         '  whlib as library '                                            +
                         '  , whpnam as program '                                         +
                         '  , whfusg as usage '                                           +
                         '  , odobat as type '                                            +
                         '  , odobtp as obj  '                                            +
              
                         ' from '                                                         +
                         '  mhaston/dsppgmrefd '                                          +
                         '  join mhaston/dspobjddmp '                                     +
              
                         ' on  '                                                          +
                         '  whpnam = odobnm '                                             +
              
                         ' where '                                                        +
                         '  whfnam = ' + apos + %trim( file ) + apos                      +
              
                         ' order by '                                                     +
                         '  whlib,  '                                                     +
                         '  whpnam  '                                                     ;
              
              ¹        exec sql
                         Prepare SQL from :sqlString ;
              
              ¹        exec sql
                         Declare C1 cursor for SQL;
              
              ¹        exec sql
                         Open C1;
              
                    /end-free
              
                   p PrepareSql      e
                   Î*--------------------------------------------------------------------*
                   Î*À  ReadNext - read next record from cursor                         Î*
                   Î*--------------------------------------------------------------------*
                   p ReadNext        b
                   d ReadNext        pi              n
              
                   d RecordExists    s               n   inz( *on )
              
                    /free
              
              ´       if  NOT prepared;
                        PrepareSQL();
                        prepared = *On;
              ´       endif;
              
              ¹       exec sql
                        Fetch next from C1
                              into :v_library, :v_program, :v_usage, :v_type, :v_obj ;
              
              ´       if ( sqlCod < 0 ) Or ( sqlCod = 100 );
              ¹         exec sql
                          Close C1;
                        return  *Off ;
              ´       else;
                        return  *On ;
              ´       endif;
              
                    /end-free
              
                   p ReadNext        E
              

              PHP version of the program to search and display:

              PHP Code:
              <html>
              <head>
              <title>Hawkeye - DSPPGMREF</title>
              <link rel="stylesheet" href="styles2.css" type="text/css">

              </head>

              <body>

              <?php
              include ("config.php");
              ?>

              <form name="form1" action="" method="post">
              <TABLE width="98%" cellpadding="2" cellspacing="2">
                  <TBODY>
                      <TR>
                          <TD width="100%" colspan="2">
                          <DIV class="ecko_content_outline">
                          <DIV class="ecko_content_header">
                          <DIV class="contenthdr"><STRONG>Filter Options </STRONG></DIV>
                          </DIV>
                          <DIV class="ecko_content_box" align="left">
                          <TABLE width="98%" cellpadding="2" cellspacing="2">
                              <TBODY>
                                  <TR class="ecko_content_box">
                                      <TD width="35%" rowspan="3" valign="top" nowrap="nowrap">
                                      <DIV align="left" valign="bottom"><STRONG>Search for Reference</STRONG>
                                      <BR>
                                      <INPUT name="object" type="text" size="20" width="100"> <INPUT
                                          name="goButton" id="goButton" type="submit" value="Search"
                                          rel="lightboxform"></DIV>

                                      </TD>
                                  </TR>
                              </TBODY>
                          </TABLE>
                          </DIV>
                          </DIV>
                          </br>
                          <!-- Finance Header --> <?php
                          
              print "<div class='cf5'>" $_POST ['object'] . "</div> \n";
                          
              ?>
                          <TABLE cellpadding="1" cellspacing="0" id="header"
                              class="borderStyle">
                              <COL width="100">
                              <COL width="100">
                              <COL width="200">
                              <COL width="100">
                              <COL width="100">
                              <COL width="40%">
                              <TBODY>
                                  <TR class="contentredhdr">
                                      <TH width="100" nowrap="nowrap" class="borderStyle">
                                      <DIV><STRONG>Library</STRONG></DIV>
                                      </TH>
                                      <TH width="100" nowrap="nowrap" class="borderStyle">
                                      <DIV><STRONG>Program</STRONG></DIV>
                                      </TH>
                                      <TH width="200" nowrap="nowrap" class="borderStyle">
                                      <DIV><STRONG>Usage</STRONG></DIV>
                                      </TH>
                                      <TH width="100" nowrap="nowrap" class="borderStyle">
                                      <DIV><STRONG>Type</STRONG></DIV>
                                      </TH>
                                      <TH width="100" nowrap="nowrap" class="borderStyle">
                                      <DIV><STRONG>Object</STRONG></DIV>
                                      </TH>
                                      <TH width="40%" class="borderStyle">&nbsp;</TH>
                                  </TR>
                              </TBODY>
                          </TABLE>
                          <DIV
                              style="overflow: auto; width: 100%; height: 250px; border-left: 1px gray solid; border-bottom: 1px gray solid; padding: 0px; margin: 0px;">
                          <TABLE cellpadding="1" cellspacing="0" class="borderStyle">
                              <COL width="100">
                              <COL width="100">
                              <COL width="200">
                              <COL width="100">
                              <COL width="100">
                              <COL width="40%">
                              <TBODY>

                                  <?php

                                  
              if ($_POST ['object'] != '') {
                                  
                                      
              //$db_username = trim($_SERVER['PHP_AUTH_USER']);
                                      
              $conn db2_connect $db_host$db_username$db_password );

                                      if ((
              $conn == 0)) {
                                          echo (
              "Connection to database failed.");
                                          
              $sqlerror odbc_errormsg $dbconn );
                                          echo (
              $sqlerror);
                                      } else {
                                          echo (
              "Connection to database successful.");
                                      }

                                      
              $sqlStmt =
                                          
              " select distinct
                                               whlib
                                               , whpnam
                                               , cast(
                                              case
                                               when whfusg = '1' then 'Input'
                                               when whfusg = '2' then 'Output'
                                               when whfusg = '3' then 'Input/Output'
                                               when whfusg = '4' then 'Update'
                                               when whfusg = '5' then 'Input/Update'
                                               when whfusg = '6' then 'Output/Update'
                                               when whfusg = '7' then 'Input/Output/Update'
                                               when whfusg = '8' then 'Not Specified'
                                               when whfusg = '9' then 'Input/Not Specified'
                                               when whfusg = '10' then 'Output/Not Specified'
                                               else 'Unknown'
                                              end as char(50) ) USAGE
                                              , odobat
                                              , odobtp

                                          from
                                           mmdf.dsppgmrefd inner join mmdf.dspobjddmp
                                           on whpnam = odobnm

                                          where
                                            whfnam = upper( " 
              "'" $_POST ['object'] . "' )

                                          order by
                                            whpnam,
                                            whlib "
              ;

                                      if (
              $conn) {
                                          
              $stmt db2_exec $conn$sqlStmt );
                                          while ( 
              db2_fetch_array $stmt ) ) {

                                              
              $Library db2_result $stmt'WHLIB' );
                                              
              $Program db2_result $stmt'WHPNAM' );
                                              
              $Usage db2_result $stmt'USAGE' );
                                              
              $Type1 db2_result $stmt'ODOBAT' );
                                              
              $Obj db2_result $stmt'ODOBTP' );

                                              print 
              "<TR class='cv3' height='18'>";
                                              print 
              " <TD width='100' nowrap='nowrap' class='borderStyle'><DIV align='left'>" $Library "</DIV></TD>";
                                              print 
              " <TD width='100' nowrap='nowrap' class='borderStyle'><DIV align='left' >" $Program "</DIV></TD>";
                                              print 
              " <TD width='200' nowrap='nowrap' class='borderStyle'><DIV align='left'>" $Usage "</DIV></TD>";
                                              print 
              " <TD width='100' nowrap='nowrap' class='borderStyle'><DIV align='left'>" $Type1 "</DIV></TD>";
                                              print 
              " <TD width='100' nowrap='nowrap' class='borderStyle'><DIV align='left'>" $Obj "</DIV></TD>";
                                              print 
              " <TD width='40%' class='borderStyle'>&nbsp;</TD>";
                                              print 
              "</TR>";
                                          }
                                          
              db2_close $conn );
                                      }
                                  }
                                  
              ?>

                                  <TR></TR>
                              </TBODY>
                          </TABLE>
                          </DIV>
                          <BR>

                          </TD>
                      </TR>
                  </TBODY>
              </TABLE>

              </form>
              <script type="text/javascript">
                  document.form1.object.focus();
              </script>
              <div><?php //echo( "Welcome back " . $_SERVER['PHP_AUTH_USER']) ?></div>
              </body>
              </html>
              Your friends list is empty!

              Comment

              Working...
              X