few AS400 query nuggets

I have not posted anything iSeries related in a while, so I thought I would toss up some of the little functions I have put together from different places. If you don't work with an AS400, then don't click 'read more' and move along =)

<span class='comment'></span>
SUBSTR(DIGITS(colName), 1, 4)

<span class='comment'></span>
col1 || col2 || ' literal string' || col3

<span class='comment'></span>
CREATE INDEX library.indexName ON library.physicalFileName (columnName ASC) WITH 0 DISTINCT VALUES

<span class='comment'></span>
CREATE TABLE
   REPORTS.PODET (
   POIDX INTEGER NOT NULL unique GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1),
   PONUM INTEGER NOT NULL ,
   POSEQ INTEGER NOT NULL ,
   POGL CHARACTER (6) NOT NULL ,
   POAMT DECIMAL (9,2) NOT NULL)

GO

LABEL ON TABLE REPORTS.PODET IS 'Detail records for POSYSTEM - CCP'
GO

LABEL ON COLUMN REPORTS.PODET (
POIDX TEXT IS 'Primary Key' ,
PONUM TEXT IS 'PO Number' ,
POSEQ TEXT IS 'PO Sequence' ,
POGL TEXT IS 'GL Number',
POAMT TEXT IS 'Record Amount')
GO

LABEL ON COLUMN REPORTS.PODET (
POIDX IS 'PO INDEX ' ,
PONUM IS 'PO NUM ' ,
POSEQ IS 'PO SEQ ' ,
POGL IS 'GL NUMBER ' ,
POAMT IS 'ITEM AMOUNT ' )
GO

<span class='comment'></span>
CREATE ALIAS libraryName.newAliasName FOR libraryName.fileName(memberName)

Digg StumbleUpon Facebook Technorati Fav newsvine reddit FARK Google Bookmarks
  1. Adrian J. Moreno

    #1 by Adrian J. Moreno - July 29, 2008 at 2:30 PM

    I'll have to dig up how we parsed and searched by a date value when the iSeries people didn't want to add a date column to a table since the last updated date was already in a sentence stored in a column named "comment".

Comments are closed.