View previous topic :: View next topic
|
Author |
Message |
sakthi_ksv
New User
Joined: 20 Jul 2006 Posts: 48 Location: Chennai
|
|
|
|
Hi All,
I have a numeric field of 1594 characters in length. I want to delimit that string into different fields each of length 9 characters. In short I want split the field of lenth 1594 into different fields each of length 9 characters. How can I achieve this, Can I do this using 'UNSTRING', or is there any other way to achieve this? Please advice,..
Thanks and Regards,
Sakthi. |
|
Back to top |
|
|
rpuhlman
New User
Joined: 11 Jun 2007 Posts: 80 Location: Columbus, Ohio
|
|
|
|
Ok ... First thing ... you can not have a numeric field length of 1594 ... 18 or 31 is the max depending on your compiler options. Since I do not know what the requirements are for your request, all I can give you is a best guess ... and no, you do not need the UNSTRING statement to accomplish your task. Simply define a group level element that will redefine the 1594 byte element. As an example:
Code: |
01 WS-GROUP-ELEMENT.
03 WS-FIELD-1594 PIC X(1594).
03 WS-FIELD-AREA REDEFINES WS-FIELD-1594.
05 WS-FIELD-ENTRIES OCCURS 177 TIMES.
07 WS-FIELD-ENTRY PIC X(09).
05 WS-FIELD-EXTRA-BYTE PIC X(01). |
1594/9 = 177.1111111 .... So you have 177 nine byte fields with one byte left over. There are other ways to do this and I'm sure others here will give examples and suggestions. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
sakthi_ksv wrote: |
I have a numeric field of 1594 characters in length. I want to delimit that string into different fields each of length 9 characters. In short I want split the field of lenth 1594 into different fields each of length 9 characters. How can I achieve this, Can I do this using 'UNSTRING', or is there any other way to achieve this? Please advice,.. |
And yes, you can use UNSTRING without the DELIMETER, the number of chatracters unstrung into each field will depend on the field size. |
|
Back to top |
|
|
sakthi_ksv
New User
Joined: 20 Jul 2006 Posts: 48 Location: Chennai
|
|
|
|
Thanks rpuhlman. Also William Could you please explain how UNSTRING can be used with syntax/example? Becuase I couldnt find any example in the help without a DELIMITER word.
Thanks in advance,
Sakthi. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
sakthi_ksv
New User
Joined: 20 Jul 2006 Posts: 48 Location: Chennai
|
|
|
|
Thanks all for the timely Help. |
|
Back to top |
|
|
|