Sammy
Try this
procedure TForm1.Button1Click(Sender: TObject);
type
TCobolRec = record
case Cobol: boolean of
True: (CobolRecord: array[0..49] of char);
False:(Name : array[0..7] of char;
Description : array[0..19] of char;
Flag1 : char;
Flag2 : char;
Flag3 : char;
Status: char;
Filler: array[0..17] of char)
end;
var
CobolRec: TCobolRec;
s, t: string;
begin
CobolRec.CobolRecord := 'Neven Computer Consultant ABC*';
s := CobolRec.Name;
t := CobolRec.Description;
ShowMessage(Format('Name = %s, Desc = %s, Flag1 = %s, Flag2 = %s, Flag3 =
%s, Status = %s',
[s,t,CobolRec.Flag1,CobolRec.Flag2,CobolRec.Flag3,CobolRec.Status]));
end;
HTH
Neven
----- Original Message -----
From: Sammy <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Wednesday, 11 April 2001 18:49
Subject: [DUG]: Using a string with a record definition ?
> I have for example a database field which is a 50 character string. When
> this field is used in COBOL programs it is read into a redefined
structure.
> If I do
>
>
> type
> TRecordDef = record
> egName : string[8];
> egDescription : string[20]
> egFlag1 : string[1];
> egFlag2 : string[1];
> egFlag3 : string[1];
> egStatus: string[1];
> egFiller : string [18];
> end;
>
>
> is there any way to get the data into the structure ?? ie moving the whole
> string to the record definition in one hit (rather than piece by piece ?)
or
> is there anything better than a record to do the sort of thing I want ?
>
> TIA
>
> Sammy !!
>
>
>
>
>
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"