Also ich hab hier mal ein Beispielprogramm:
DDS Source:
Code:
A R PFA002R
A
A FLD01 2S 0 COLHDG('FELD 01 ')
A FLD02 10A COLHDG('FELD 02 ')
Inhalt der Datei PFA002P:
Code:
*...+....1..
01Text 1
02Text 2
03Text 3
04Text 4
05Text 5
06Text 6
07Text 7
08Text 8
09Text 9
10Text 10
Und hier der Programmcode:
PHP-Code:
**free
ctl-opt decedit('0,') datedit(*dmy) dftactgrp(*no) option(*nodebugio:*srcstmt:*nounref);
dcl-pr GibText char(10);
$1id zoned(2) const;
end-pr;
dcl-s i int(3);
dcl-s text char(10);
text = *blanks;
i = 5;
text = GibText(i);
dsply text;
*inlr = *on;
// Subprozedur
dcl-proc GibText;
// Datei und Host-DS einbinden
dcl-f pfa002p disk usage(*input);
dcl-ds pfa002rDS likerec(pfa002r); // "pfa002r" wird im likerec auch nicht erkannt :(
// Prozedure-Interface
dcl-pi GibText char(10);
$1id zoned(2) const;
end-pi;
// Lokale Felder
dcl-s x1id like($1id); // $1id wurde bereits verwendet -> wird auch vorgeschlagen
dcl-s result like(pfa002rDS.fld02); // Teilweise wurde hier schon die Autocomplete verweigert
// Beginn der Programmlogik
x1id = $1id; // Muss selber tippen, da x1 noch nicht verwendet wurde
read pfa002r pfa002rDS; // Auch hier musste ich den Namen selber schreiben. Vorgeschlagen wird nur der Dateiname, nicht der Satzformatname
dow (not %eof(pfa002p));
if (pfa002rDS.fld01 = x1id); // Ab hier kannte RDi den Namen "pfa002rDS"
result = pfa002rDS.fld02;
leave;
endif;
read pfa002r pfa002rDS;
enddo;
return result;
end-proc;
Probier mal das ganze nachzustellen/nachzuschreiben. Vielleicht hast Du ja auch bei den Kommentierten Stellen das Problem.
So, wie das Programm oben aussieht (bzw eigentlich die Subprozedur "GibText", bau ich im Normalfall alle meine Unterprozeduren auf (Zuerst die Datei, dann Host-DS, PI, Lokale Felder und dann erst der Programmcode).
Bookmarks