View previous topic :: View next topic |
Author |
Message |
rajeev5174 Beginner
Joined: 05 Jun 2007 Posts: 25 Topics: 10
|
Posted: Mon May 21, 2012 8:55 am Post subject: Convert from binary to character field |
|
|
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 |
|
 |
Sqlcode Intermediate
Joined: 15 Dec 2006 Posts: 157 Topics: 38
|
Posted: Mon May 21, 2012 9:20 am Post subject: |
|
|
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 |
|
 |
rajeev5174 Beginner
Joined: 05 Jun 2007 Posts: 25 Topics: 10
|
Posted: Mon May 21, 2012 9:39 am Post subject: |
|
|
yes there are filler spaces at the end & the file can be a new one with a new record length |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon May 21, 2012 10:46 am Post subject: |
|
|
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 |
|
 |
rajeev5174 Beginner
Joined: 05 Jun 2007 Posts: 25 Topics: 10
|
Posted: Mon May 21, 2012 12:03 pm Post subject: |
|
|
Thanks & it worked fine. |
|
Back to top |
|
 |
|
|