View previous topic :: View next topic |
Author |
Message |
anu.k Beginner
Joined: 09 Nov 2006 Posts: 6 Topics: 4
|
Posted: Wed Apr 16, 2008 4:33 am Post subject: Insert binary value in a file |
|
|
Hi,
I have a file with the following structure.
field 1 - PIC S9(4) COMP
field 2 - X(40)
Input data:
Field 1 Field 2
1 AAAA....
2 BBBB...
3 CCCC..
.. ..
.. ..
53 ZZZZ...
My requirement is to overwrite the Field 1 value with constant data '54' for all the records.
Output should look like :
Field 1 Field 2
54 AAAA....
54 BBBB...
54 CCCC..
. ..
. ..
54 ZZZZ...
Please advice..
Thanks,
Anu |
|
Back to top |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Wed Apr 16, 2008 9:00 am Post subject: |
|
|
If I understand you correctly, MOVE 84 TO FIELD-1 will result in FIELD-1 consisting of X'0054' after the MOVE statement. An alternate method would be to redefine FIELD-1 as PIC XX and moving X'0054' to it. I don't have access to a mainframe, so the best way to find out is to write a little test program for yourself. Oops, I just noticed this was posted in the Utilities forum and I gave you a COBOL solution. _________________ ....Terry |
|
Back to top |
|
 |
anu.k Beginner
Joined: 09 Nov 2006 Posts: 6 Topics: 4
|
Posted: Tue Apr 22, 2008 7:52 am Post subject: |
|
|
Thanks for your response Terry.
However my requirement was to achieve it in SORT and I managed to do so with the following sort card :
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(X'0036',3:3,40)
|
Thanks,
Anu |
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Tue Apr 22, 2008 9:52 am Post subject: |
|
|
Here's a simpler way to do it with DFSORT:
Code: |
SORT FIELDS=COPY
OUTREC OVERLAY=(X'0036')
|
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
|
|