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



Dan,
  Try using the *BLDKEY in your FromKey / ToKey keywords, then listing the key 
values as a separate list.
  Ex.  Cpyf File1 File2 *n *n *replace FromKey(*Bldkey (20050101)) 
ToKey(*Bldkey (20051231)) 
   
  

Dan <dan27649@xxxxxxxxx> wrote:
  Anybody got a more elegant solution for using CPYF FROMKEY/TOKEY when the
key is packed-numeric?

I had a situation where I thought using INCREL would be satisfactory but,
while it seemed that the key was used to limit the records accessed when run
interactively, it was a total dog in batch as it read through the entire
11,000,000 records.

So I switched to using the FROMKEY/TOKEY. On a command line, or hard-coded,
it's fairly easy to specify a hex value (i.e. x'020050101F'), but it's
rather kludgy to do when the value is variable. (Have to set the command
string up in a string variable, and run it via qcmdexc.) Here's what I
ended up doing, and hoping someone can offer an easier way.

Dcl &YearBegin *dec ( 8 ) Value( 20050101 )
Dcl &YearEnd *dec ( 8 ) Value( 20051231 )
Dcl &@YearBegin *char ( 8 )
Dcl &@YearEnd *char ( 8 )
Dcl &Command *char ( 1024 ) Value( ' ' )
Dcl &CommandLen *dec ( 15 5 ) Value( 1024 )

ChgVar &@YearBegin &YearBegin
ChgVar &@YearEnd &YearEnd
ChgVar &Command Value( +
'Cpyf FromFile( CUSMAL06 ) ToFile( *Print ) +
FromKey( 1 ( x''0' *cat &@YearBegin *cat 'F'' )) +
ToKey( 1 ( x''0' *cat &@YearEnd *cat 'F'' )) ' )
SndPgmMsg ( 'qCmdExc: ' *cat &Command )
Call qCmdExc Parm( &Command &CommandLen )

TIA,
Dan

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.