View previous topic :: View next topic |
Author |
Message |
relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Tue Apr 03, 2007 10:52 am Post subject: shift to middle of record |
|
|
Gurus,
I need to shift the data to middle of record if it starts with @.
Input record lenght = 102, Output should be the same 102.
Input: Code: |
asdlasdjkl78897979879
@xgk
fjlklkljlkjljlksjdljlsdjkflsd
|
Ouput:
Code: |
asdlasdjkl78897979879
blanks @xgk blanks
fjlklkljlkjljlksjdljlsdjkflsd |
Regards, |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Apr 03, 2007 11:24 am Post subject: |
|
|
Since this sounds like a report, the easiest way would be with a Rexx exec. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Apr 03, 2007 11:45 am Post subject: |
|
|
relaxing,
when you say middle, do you want to adjust it based on the length of the field? ie.
the 2nd record which starts with @xgk is 4 bytes and if the field you are trying to center it is 20 bytes then @xgk would begin at pos 9 of 20 byte field.
But if you have 6 byte field then how do you want to center it ? i.e @12345
Let us know the conditions and may be we can suggest something
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Tue Apr 03, 2007 1:07 pm Post subject: |
|
|
Kolusu, the bytes should be centred in the record. The output should be like:
Output:
abcdefghijklmnopqrst
blanks @12345 blanks
abcdefghijklmnopqrst
But as semigeezer said if there is no direct function then I can go for a cobol/rexx program. |
|
Back to top |
|
|
|
|