View previous topic :: View next topic
|
Author |
Message |
jmreddymca Warnings : 1 New User
Joined: 14 Oct 2007 Posts: 29 Location: Bangalore
|
|
|
|
Hi
I have a requirement like below;
In my file first 4 bytes having hexa value. I have checked in the file hexa value i am able to see some nuber. Till the end of records there is some sequence numbers. But i want to edit that seqence number from 1 to till end of file. could you please help me on this.
Thanks
JMR |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
open the file in edit mode...
Type 'HEX ON' then edit the numbers. |
|
Back to top |
|
|
jmreddymca Warnings : 1 New User
Joined: 14 Oct 2007 Posts: 29 Location: Bangalore
|
|
|
|
sorry my file is having lacs of records |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
jmreddymca wrote: |
sorry my file is having lacs of records |
Provide below information:
LRECL RECFM of the input file,
Sort product installed at your shop
Show some sample records.
And expected output ( show hex values for sequence number you want in output)
(Use code tags) |
|
Back to top |
|
|
jmreddymca Warnings : 1 New User
Joined: 14 Oct 2007 Posts: 29 Location: Bangalore
|
|
|
|
LRECL - 223
RECFM - FB
using DFSORT
Code: |
records is like this
å.À%... ---- Rec1
4066000
774C009
å.À@... ---- Rec2
4067000
774C009 ......
o/p expecting like
å.À%... ---- Rec1
0000000
0001009
å.À@... ---- Rec2
0000000
0002009 ......
|
I just wnat to change sequence number from the beginning record. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
jmreddymca wrote: |
LRECL - 223
RECFM - FB
using DFSORT
Code: |
records is like this
å.À%... ---- Rec1
4066000
774C009
å.À@... ---- Rec2
4067000
774C009 ......
o/p expecting like
å.À%... ---- Rec1
0000000
0001009
å.À@... ---- Rec2
0000000
0002009 ...... |
I just wnat to change sequence number from the beginning record. |
Sambhaji asked you to use the Code tags. See the difference it makes?
I have no idea what you mean by "hexa", so perhaps you can explain that for us (or me, anyway).
I suspect you don't want to do what you say you want to do. I'm willing to bet a considerable sum (remember, that is all relative, I only bet really, really, tiny amounts) that the existing sequence number is actually a packed-decimal format.
4707646C and 4707647C is the hex "the other way" for your sequence numbers. Notice that the 6 changes to a 7, yet the C stays the same. That would be true for a packed-decimal field (in Cobol, Comp-3 PIC S9(7)). You are suggesting that you would like to change it to a 4-byte binary value starting from 00000001. If you do that without all the other programs that look at the sequence number changing, you will get incorrect results.
I suppose, maybe, your requirement is part of a change to convert the sequence number to a binary number, just on the off-chance that the file might one day accumulate to 2gig of numbers? If so, proceed as is. If not, start your sequence from one in a PD field for the Sort. |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
Try this code
Code: |
SORT FIELDS=COPY
OUTREC OVERLAY=(1:SEQNUM,4,PD)
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
JMR,
Or if you really want BI sequence numbers, use:
Code: |
OPTION COPY
OUTREC OVERLAY=(1:SEQNUM,4,BI)
|
|
|
Back to top |
|
|
jmreddymca Warnings : 1 New User
Joined: 14 Oct 2007 Posts: 29 Location: Bangalore
|
|
|
|
Thanks a lot Frank ,Bill,krato below code worked fine
OPTION COPY
OUTREC OVERLAY=(1:SEQNUM,4,BI)
Thanks a lot for your support. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks. Not that helpful of me, I think.
So I loose my bet (Luckily it was my "left pocket" that won the bet, so no overall loss, even though "right pocket" is sad and out for revenge), and still don't know what Hexa is :-) Oh well, I'll wait for next time someone mentions it and ask again. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Bill,
HEXA = Hexadecimal (over and under or side by side). Shows the individual nybbles rather than often unreadable bytes.
Over/under
Code: |
å.À%...
4066000
774C009
å.À@...
4067000
774C009 |
And as you mentioned:
Quote: |
4707646C and 4707647C is the hex "the other way" |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Hi Dick,
Thanks. I've never heard it called that, we just called it all "hex" - allowed us more jokes about magic than hexa would have done, I suppose :-)
Learn something new every day.
Have to say, a bit obscure from the usage I've seen on the fora. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
maybe, it is a non-fluent english speaker's abbreviation of hexadecimal |
|
Back to top |
|
|
|