View previous topic :: View next topic
|
Author |
Message |
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
I have record in a file :
Code: |
---------------
........ISH01P
00000000CECFFD44
0101000192801700
--------------- |
I can read and substr '0001000100000001'x to the variable. But I cannot build the folowing record :
Code: |
---------------
........ISH01P
00000000CECFFD44
0101000292801700
--------------- |
just add '1'x to the value in 8 first position in the file |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Oh well, never mind. How about posting something useful for us to consider.
Your code would be a good start. Along with an exact description of what you want to achieve. |
|
Back to top |
|
|
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
ok, hard to explaine...
if i read the record , how can I increment by 1 the hex value in first 8 positions..
Code: |
"EXECIO * DISKR SSS1 (FINIS STEM LF1."
"FREE FI(SSS1)"
IC = LF1.0
COUNT = C2X(SUBSTR(LF1.IC,1,8))
SAY COUNT
COUNT = COUNT + 1
SAY COUNT
EXIT |
result
Code: |
'000100010000000E'
22 +++ COUNT = COUNT + 1
Error running MERGISS, line 22: Bad arithmetic conversion
*** |
|
|
Back to top |
|
|
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
never mind , I found the problem - to big decimal value |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Well done for finding the solution,
And another big one for posting what the problem was.
I assume that you used the NUMERIC DIGITS nn to resolve this. |
|
Back to top |
|
|
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
just used less positions... not 8 ... 4
Code: |
IC = LF1.0
COUNT = C2D(SUBSTR(LF1.IC,5,4))
COUNT = COUNT + 1
COUNT1= RIGHT(D2X(COUNT),8,0)
LF1.IC =SUBSTR(LF2.I,1,4)||X2C(COUNT1)||SUBSTR(LF2.I,9) |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
so the conclusion is that there was a wrong understanding of the record layout |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What happens on the one chance in you all the combinations that you actually get a "carry"?
With decimals, you solution would work with aaaaxxxx, where aaaa is anything and xxxx is 9999?
What if your eight bytes is -ve, but the rightmost four look positive, or vice versa? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
anatol wrote: |
never mind , I found the problem - to big decimal value |
You forgot to say that you changed the C2X to C2D, then you got the too big decimal value...
anatol wrote: |
COUNT1= RIGHT(D2X(COUNT),8,0)
LF1.IC =SUBSTR(LF2.I,1,4)||X2C(COUNT1)||SUBSTR(LF2.I,9) |
I would have used:
Code: |
Count1 = D2C(Count,4)
LF2.IC = Overlay(Count1,LF1.IC,5,4) |
|
|
Back to top |
|
|
|