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