-
Problem bei Lookup
Ich steh hier grad aufm Schlauch und weiß nicht weiter.
ich hab ein compiletimearray den ich durchsuchen will:
d table1 s 1 dim(36) ctdata perrcd(36)
c eval int = %lookup(input(i):table1)
**
ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890
Jetzt wirft mir der Compiler die Meldung aus, daß der zweite Parameter von lookup nicht korrekt wäre.
Jemand eine Idee wo mein Denkfehler ist?
-
c eval int = %lookup(input(i):table1:1)
-
Bei Compile Time Arrays musst Du die Funktion %TLookupXX verwenden.
%LookUpXX ist nur für Feldgruppen.
%TLookup
Birgitta
-
Super, vielen lieben Dank!
Konnte ja auch nur so ne dumme Kleinigkeit sein.
-
Der Gedankenfehler liegt in folgendem begründet:
CTDATA
The CTDATA keyword indicates that the array or table is loaded using compile-time data. The data is
specified at the end of the program following the ** or **CTDATA(array/table name) specification.
Der Unterschied zwischen Array und Table liegt im Namen:
Alle Arrays, die mit "TAB" anfangen sind eine Table:
Table Names
The following additional rules apply to table names:
v A table name can contain from 3 to 10 characters.
v A table name must begin with the letters TAB.
v A table cannot be defined in a subprocedure.
Tables
The explanation of arrays applies to tables except for the following differences:
Activity
Differences
Defining
A table name must be a unique symbolic name that begins with the letters TAB.
Loading
Tables can be loaded only at compilation time and prerun-time.
Using and Modifying table elements
Only one element of a table is active at one time. The table name is used to refer to the active
element. An index cannot be specified for a table.
Searching
The LOOKUP operation is specified differently for tables. Different built-in functions are used for
searching tables.
Daher erklärt sich auch, dass Tabelle eben per TLOOKUP bedient werden muss und ein Array-Indexzugriff "Tabelle1(I)" nicht möglich ist.
Benennst du die Tabelle um "Zeichen", dann gilt wieder %lookup und Arrayindex.
-
Das schlimme ist ja daß ich das alles mal wusste, aber jetzt 10 jahre nicht aktiv benutzt und schlicht vergessen.
-
Nun ja, was bei mir generell hängen blieb war: Definiere ein Array (E, DIM) nie mit TABxxx!
Und das geht einem bei dem Namen "Tabelle" schnell unter, da RPG immer noch case insensitive ist.
Similar Threads
-
By harkne in forum NEWSboard Programmierung
Antworten: 7
Letzter Beitrag: 11-09-17, 09:10
-
By tarkusch in forum NEWSboard Programmierung
Antworten: 3
Letzter Beitrag: 23-02-17, 10:45
-
By muadeep in forum NEWSboard Programmierung
Antworten: 4
Letzter Beitrag: 13-10-15, 09:50
-
By JEsser in forum NEWSboard Server Software
Antworten: 0
Letzter Beitrag: 17-11-14, 18:28
-
By chrisi in forum IBM i Hauptforum
Antworten: 2
Letzter Beitrag: 27-02-02, 08:46
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks