ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

as400 view

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

  • as400 view

    hi again,
    i need help on,

    1> creating views in as400
    im making a vb program and i want to have the flexibility to change the query without having to recompile my vb program.

    my view should be something like

    select a.bnkind, a.entity, CASE ((a.bnktyp*100) + a.branch) wHEN 0 THEN 'Head Office'
    ELSE trim(substring(a.inst, posstr(a.inst,'-') + 1)) END brancHName
    from banklibrary left join geographylib b on a.region=b.region and a.province=b.province and a.town=b.town where a.bnkind between 0 and 10

    2> and is it possible to save the source/view on a different library?
    the banklibrary & geographylibrary belongs to bankreference library
    our current working library is loanlibrary?

    thanks again.
    FYI I'm new to RPGLE

  • #2
    Re: as400 view

    I think your best option would be to save your sql statements in a text file or a xml file and have your vb app read and process your desired sql statement. That way you can change your statement a hundred times without recompiling the code. Another option is to dynamilcally create the SQL string with your vb code.

    I dont undestand what you are asking in number 2. The access path for a view applies to the table / library that you apply it to during creation.
    Last edited by kpmac; April 21, 2006, 07:38 AM.
    Predictions are usually difficult, especially about the future. ~Yogi Berra

    Vertical Software Systems
    VSS.biz

    Comment


    • #3
      Re: as400 view

      Hi,

      ad 1: You can embedd everything you can specify in a select statement in an view except the order by clause. When changing your view, you do not have to recompile any program (nor VB, nor RPG, nor JAVA), except you add some fileds and use select * in your programs.

      ad 2: Not sure if I undestand correctly. You want to have the view and the base tables in different libraries?
      If so, you have either to use system naming and adding both libraries in the library list or when using SQL naming, you have to qualify (hard code the library) your tables and views.

      Birgitta

      Comment

      Working...
      X