MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert binary value in a file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
anu.k
Beginner


Joined: 09 Nov 2006
Posts: 6
Topics: 4

PostPosted: Wed Apr 16, 2008 4:33 am    Post subject: Insert binary value in a file Reply with quote

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
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Wed Apr 16, 2008 9:00 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
anu.k
Beginner


Joined: 09 Nov 2006
Posts: 6
Topics: 4

PostPosted: Tue Apr 22, 2008 7:52 am    Post subject: Reply with quote

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
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Apr 22, 2008 9:52 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group