Emile Straker
New User
Joined: 27 Mar 2013 Posts: 3 Location: United Kingdom




Hi,
I'm trying to do a simple find & replace of a field using the following:
Code: 
££FILEM DSU INPUT=DD01,
££FILEM PROC=*
IF FLD(269,9) ¬= ' ' &,
FLD(269,9) ¬= '000000000'
THEN DO
OVLY_OUT('123456789',269)
RETURN
END

As well as spaces and zeros, the field above can contain x'000000000000000000'
I also want to ignore the field if it is all hex zeros.
The manual advised there are additional operators for Binary, Packed Decimal & Zoned Decimal, but I can't get the result I'm after.
Any help would be greatly appreciated. 

hankoerlemans
New User
Joined: 25 Jan 2018 Posts: 60 Location: Australia




2 ways to code that – In both cases hex string is specified with standard REXX ‘hhhh’x notation.
Option 1  Using contains operator and one function call – note ‘,,’ is required for parameter delimiter and REXX continuation
IF FLDI(269,9,'CO','000000000000000000'X,,
'000000000',,
' ') THEN
OVLY_OUT('123456789',269)
Option 2 – Using FLD() function similar to what they’ve attempted.
IF FLD(269,9) ¬= '000000000000000000'X,
& FLD(269,9) ¬= '0000000000',
& FLD(269,9) ¬= ' ' THEN
OVLY_OUT('123456789',269)
Under FASTREXX which both will run there would be probably no difference in performance.
Response c/ of FM Developer @ HCLTECH
Cheers Hank, HCLTECH 
