× 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.



John,

Thanks for pointing that out to me. Makes me feel a little better :)

Rob,

Here's the basics (trivial code changes, again no error handling though
with an addition to your select statement due to that lack of error
handling and really needing to only access physical tables/files as
systables has a few other items in it):

ctl-opt dftactgrp(*no);

dcl-pr RtvFD2;
fileIn char(10) const;
libIn char(10) const;
reuseSts char(10);
fileInd int(5) const;
libInd int(5) const;
reuseStsInd int(5);
sqlState char(5);
sqlName varchar(517) const;
sqlSpecific varchar(128) const;
sqlDiag varchar(1000);
end-pr;
dcl-pi RtvFD2;
fileIn char(10) const;
libIn char(10) const;
reuseSts char(10);
fileInd int(5) const;
libInd int(5) const;
reuseStsInd int(5);
sqlState char(5);
sqlName varchar(517) const;
sqlSpecific varchar(128) const;
sqlDiag varchar(1000);
end-pi;

dcl-pr RtvReuse extpgm('QDBRTVFD');
rcvVar char(65535) options(*varsize);
lenRcvVar int(10) const;
qualRtnFN char(20);
formatAPI char(8) const;
qualFileName char(20) const;
rcdFmtName char(10) const;
ovrPcs char(1) const;
system char(10) const;
formatType char(10) const;
errCde likeds(qusec);
end-pr;

/copy qsysinc/qrpglesrc,qusec
/copy qsysinc/qrpglesrc,qdbrtvfd

dcl-ds baseFD likeds(QDBQ25) based(ptrRcvVar);
dcl-ds pFAtrs likeds(QDBQ26) based(ptrPFAtrs);
dcl-ds errCde qualified;
hdr likeds(qusec);
errDta char(256);
end-ds;

dcl-s ptrPFAtrs pointer;
dcl-s ptrRcvVar pointer inz(%addr(rcvVar));
dcl-s qualRtnFN char(20);
dcl-s rcvVar char(4096);
dcl-s theFile char(10) inz('MYFILE');

errCde.hdr.QUSBPrv = 0;
RtvReuse( rcvVar :%size(rcvVar) :qualRtnFN
:'FILD0100' :(fileIn + libIn) :' *FIRST'
:'0' :'*LCL' :'*INT'
:errCde);
ptrPFAtrs = ptrRcvVar + baseFD.QDBPFOf;
if %bitand(pFAtrs.QDBBits33 :x'80') = x'80';
reuseSts = 'YES';
else;
reuseSts = 'NO';
endif;
*inlr = *on;
return;

To create the function:

create or replace function Reuse_Deleted_Records
( tableName char(10)
,schemaName char(10)
)
returns char(10)
external name 'VINING/RTVFD2'
program type main
language rpgle
parameter style sql
returns null on null input
no external action
not fenced

And to test it (with a recommendation to qualify the library as I do below):

Select system_table_name, system_table_schema,
Reuse_Deleted_Records(system_table_name,system_Table_schema)
From systables
where table_type in ('P', 'T')
and system_table_schema = 'VINING'

I did provide at least the interface to handle null inputs though that
logic would need to be added and the returns null on null input removed
from the create.

Bruce

On Thu, Jan 16, 2020 at 3:12 PM John Yeung <gallium.arsenide@xxxxxxxxx>
wrote:

On Thu, Jan 16, 2020 at 3:07 PM Bruce Vining <bruce.vining@xxxxxxxxx>
wrote:

You're right of course. For some reason I just had DSPFFD on my mind
(and
didn't re-read the original reference to DSPFD).

The reason you had DSPFFD on your mind is that OP (Gord) and I both
did as well. The very first post in this thread had the correct
command, but then OP's own subsequent post introduced DSPFFD, and I
just ran with that.

John Y.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.