IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

UNSTRING without a delimiter


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Mon Nov 26, 2007 4:33 pm
Reply with quote

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

New User


Joined: 11 Jun 2007
Posts: 80
Location: Columbus, Ohio

PostPosted: Mon Nov 26, 2007 5:16 pm
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Nov 26, 2007 6:43 pm
Reply with quote

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

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Tue Nov 27, 2007 9:36 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 27, 2007 12:19 pm
Reply with quote

Hello,

Check here. . .
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr10/6.2.39.1?ACTION=MATCHES&REQUEST=unstring&TYPE=FUZZY&SHELF=&DT=20020920180651&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

The cobol documentation are available via the "Manuals" link at the top of the page.
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Tue Nov 27, 2007 2:43 pm
Reply with quote

Thanks all for the timely Help.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts Export columns from DB2 table with pi... DB2 14
No new posts COBOL - Array result in single variab... COBOL Programming 3
No new posts Unstring COBOL Programming 4
No new posts UNSTRING problem COBOL Programming 3
Search our Forums:

Back to Top