× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



<snip>
* setC1Result
D setC1Result...
D pr
D piMyFile likerec(MYFILE00) const
D piField1 like(FIELD1) const
D piField2 like(FIELD2) const

/free

setC1Result(piMyFile :'A' :'B');
*inlr = *on;
/end-free

**********************************************************************
* setC1Result
**********************************************************************
**********************************************************************
P setC1Result...
P B
D pi
D piMyFile likerec(MYFILE00) const
D piField1 like(FIELD1) const
D piField2 like(FIELD2) const

C/exec sql
C+ declare myfileC1 scroll cursor for
C+ select
C+ field1, field2
C+ from myfile
C+ where field1 = :piField1 and
C+ field2 = :piField2
C/end-exec

C/exec sql
C+ open myFileC1
C/end-exec


C/exec sql
C+ fetch from myFileC1
C+ into :C1Result
C/end-exec
</snip>

Not sure your problem has anything to do with the LikeRec and the PI.

You are passing the data structure to your procedure but never doing
anything with it. The data is being loaded into a global variable that
you declared so nothing is done with the piMyFile variable.

I think that your problem is using the Like keyword. I think what it is
getting upset about is that the fields definitions are coming from a
table.

Try just defining the fields and see if it works.

If your idea is to return the data from caller, why not use a return
value?

Also, why use a fetch when you are returning only a single record. Much
simpler to just use a Select Into.

d TD_MyFile...
d ds Qualified
d Based(StdNulPtr)
d Field1...
d Like(FIELD1)
d Field2...
d Like(FIELD2)

d MyFile...
d ds LikeDs(TD_MyFile)
/Free

MyFile = SetC1('A':'B');

/End-Free

P SetC1...
P b
D pi LikeDs(TD_MyFile)
D InField1...
D 1a
D InField2...
D 1a

D dsFileIn...
D ds LikeDs(TD_MyFile)
/Free

Exec Sql Select Field1, Field2
Into :dsFileIn
From MyFile
Where Field1 = :InField1 And
Field2 = :InField2;

Return dsFileIn;

/End-Free
p e




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.