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 

Convert from binary to character field

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


Joined: 05 Jun 2007
Posts: 25
Topics: 10

PostPosted: Mon May 21, 2012 8:55 am    Post subject: Convert from binary to character field Reply with quote

Hi.


we have got a file of length 80, the 1'st 10 bytes is character and from 11 byte there is a comp field which is s9(09) comp and rest of the field is charcter
I need to change the comp field to a numeric data. The length of the o/p file need not be kept 80. Please let us know how to handle.

Thanks,
Raj
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Mon May 21, 2012 9:20 am    Post subject: Reply with quote

rajeev5174,

Quote:
we have got a file of length 80, the 1'st 10 bytes is character and from 11 byte there is a comp field which is s9(09) comp and rest of the field is charcter
I need to change the comp field to a numeric data. The length of the o/p file need not be kept 80. Please let us know how to handle.


So how are you going to adjust rest of the fields? Do you have filler space at the end?

Thanks,
Back to top
View user's profile Send private message
rajeev5174
Beginner


Joined: 05 Jun 2007
Posts: 25
Topics: 10

PostPosted: Mon May 21, 2012 9:39 am    Post subject: Reply with quote

yes there are filler spaces at the end & the file can be a new one with a new record length
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon May 21, 2012 10:46 am    Post subject: Reply with quote

rajeev5174,

Use the following DFSORT JCL which will give you the desired results. This job will expand the 4 byte binary field to 9 bytes and write out the output. I assumed that you only have positive numbers in the binary field.

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD DSN=Your input FB 80 byte file,DISP=SHR               
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  SORT FIELDS=COPY                             
  INREC BUILD=(1,10,11,4,BI,M11,LENGTH=9,15,66)
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rajeev5174
Beginner


Joined: 05 Jun 2007
Posts: 25
Topics: 10

PostPosted: Mon May 21, 2012 12:03 pm    Post subject: Reply with quote

Thanks & it worked fine.
Back to top
View user's profile Send private message
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