In BEFORE Global Data it throws Field not found: RECORD - if I move it to Global Data it does compile but it doesn’t have any fields, at least Intellisense doesn’t show fields - if i use a GROUP instead of LIKE intellisense does show fields, but during compilation it throws an error the field is not found, so:
typeRec:Table GROUP(FILE:Record),TYPE
END
Also using the PRE doesn’t compile - need to use the full file label
I’ve done (PRE:Record pRecord) before. But you have to make sure that the file is always generated so that the prototype can see it. The chicken has to be hatched before the egg is laid, or something like that.
don’t include { } inside of the prototype
Please show us your actual code, so we can help you
Yes you can pass the record buffer as a group, or better yet as a typed group
I like to write:
gtRec_ADJ GROUP(ADJ:Record),TYPE,PRE(gtADJ); END
I use dot notation on the group - I don’t use it’s prefix
But it’s required to add a prefix - to replace the original prefix in the file
Keys need to have a prefix so nearly all files need to have a prefix
so with that data type I can write:
SomeProc PROCEDURE(*gtREC_ADJ xADJ)
CODE
xADJ.ID = 42 ! point being I have access to all of the fields in the file
I can call :
SomeProc( ADJ:Record )
SomeProc( Adjustment.Record )
SomeProc( Adjustment{PROP:Record} ) ! this might work, I haven't tested it
Just needed to do this again, the example from @MarkGoldberg works, but only if used as PROCEDURE parameter I can access the fields (ex1)- the one from @greenslk using LIKE instead of GROUP also allows it to be used as local variable with access to the fields (ex2)
FILE:
Dummy FILE,DRIVER('TOPSPEED'),NAME('data\Dummy.dat'),PRE(DUM),CREATE
Dum_KeyNr KEY(DUM:Nummer),PRIMARY,NOCASE,OPT
record RECORD
Nummer STRING(1)
END
END
EX1:
Record:Dummy GROUP(DUM:Record),TYPE,PRE(R:DUM)
END
PROC_WORKS PROCEDURE(*Record:Dummy dumdum)
CODE
dumdum.Nummer = 1;
PROC_NO_WORKS PROCEDURE()
!dumdum Record:Dummy ! Does not compile
dumdum LIKE(Record:Dummy)
!or
!dumdum GROUP(Record:Dummy),PRE(dd)
!END
CODE
dumdum.Nummer = 1; ! FIELD NOT FOUND
EX2:
Record:Dummy LIKE(DUM:Record),TYPE
PROC_WORKS PROCEDURE()
!dumdum Record:Dummy ! Does not compile sadly
dumdum LIKE(Record:Dummy)
CODE
dumdum.Nummer = 1;
The purpose of the ,TYPE was to be able to pass a record as a parameter and have access to field(s). But if the File Dummy is in scope then the above LIKE compiles just fine
The support of parameters of *GROUP type (both generic and having a named type) is very partial. The compiler produces different errors for parameters of such types and their usage. Fixes for known me issues related to parameters of GROUP types were sent to SV several months ago.