What’s an alternative to %SCAN?

560 pts.
Tags:
Hexadecimal values
iseries v5r4
I have a program that scans a file field 5000 bytes long for 34 hexadecimal values that colorize text. I remove these hexadecimal values in a do loop nested in a for loop. Without that logic, the program runs for 4 hours but with this "hexadecimal clean-up", the program is running for more than 9 hours. What alternatives do I have? Our iSeries is V5R4.)

Software/Hardware used:
iSeries V5R4
ASKED: May 12, 2010  11:21 AM
UPDATED: May 22, 2010  12:54 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    First, does the field have to be 5000 bytes or could it be variable length? Is the value often less than 5000 long? (I.e., is it right-padded with blanks? Do you know how long the value is?) Next, have you tried a simple %xlate() instead? And since this is a file field, why not just read it through a LF that applies a basic translation table (the DDS TRNTBL() keyword) to the field that translates the hex values to blanks? By moving a pointer through the field, you could probably make good use of the strpbrk() C run-time function in a proc that starts with the pointer at position 1 and resets it in a loop every time it gets a hit. You might also use the Test and Replace (TESTRPL) MI builtin function, but I'd want to know if strpbrk() or TESTRPL is faster. Or any of the Translate (XLATE), Translate Bytes (XLATEB), Translate Bytes One Byte at a Time (XLATEB1), Translate Multiple Bytes (XLATEMB) or Translate with Table (XLATEWT) MI builtins might be useful. I'd start by seeing how %xlate worked. Then I'd see about using a LF to do the translation for me. Tom
    125,585 pointsBadges:
    report
  • bogeybetsy
    Hi Tom, thanks for the reply. You were right about the %Xlate. We found out that the problem was not the %SCAN. There was some other new code inserted that caused the program to run for about 22 hours. The %SCAN did just fine. But I did replace the %SCAN code with the %XLATE. There was a whole new subroutine using %SCAN. With %XLATE, there were only a few lines (3 statements). Thanks very much for your help!
    560 pointsBadges:
    report
  • TomLiotta
    ...thanks for the reply. You're welcome. Happy to help, and thank you for returning to post a followup. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following