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

How i get the result by using with the UNSTRING


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

New User


Joined: 27 Sep 2006
Posts: 47
Location: Hyderabad

PostPosted: Wed Oct 04, 2006 10:23 am
Reply with quote

Hello All,

I have one doubt on UNSTRING.

Ex:

77 A PIC X(10) VALUE '29/10/2006'

01 B .
02 B1 PIC X(2)
02 B2 PIC X(2)
02 B3 PIC X(4)

result should be like this B1= 29
B2=10
B3=2006

My doubt is , How i get the above result by using with the UNSTRING


Thanx in adv
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Wed Oct 04, 2006 10:46 am
Reply with quote

Hi

I guess u r asking abt its Syntax.U could have easily found it anywhere in
this Forum or any tutorial.

anyways here is the syntax

UNSTRING
UNSTRING command is used to split one string to many strings.
Syntax:
UNSTRING identifier-1
[DELIMITED BY (ALL/) identifier2/literal1 [,OR (ALL/) (identifier-3/literal-2),..]]
INTO identifier-4 [, DELIMITER IN identifier-5, COUNT IN identifier-6]
[, identifier-7 [,DELIMITER IN identifier-8, COUNT IN identifier-9]

01 WS-DATA PIC X(12) VALUE ?10/200/300/1?.
UNSTRING WS-DATA DELIMITED BY ?/?
INTO WS-FLD1 DELIMITER IN WS-D1 COUNT IN WS-C1
WS-FLD2 DELIMITER IN WS-D2 COUNT IN WS-C2
WS-FLD3 DELIMITER IN WS-D3 COUNT IN WS-C3
END-UNSTRING.
Result:
WS-FLD1 = 10 WS-FLD2 =200 WS-FLD3=300
WS-C1 = 2 WS-C2=3 WS-C3=3 WS-D1 = ?/? WS-D2=?/? WS-D3 ?/?
ON OVERFLOW can be coded with STRING and UNSTRING. If there is STRING truncation then the imperative statements followed ON OVERFLOW will be executed.

This is al abt UNSTRING
Thanks,
-Kapil
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 first column truncated in search result IBM Tools 13
No new posts SDSF like solution in EJES (store com... All Other Mainframe Topics 4
No new posts executing XCTL command in COBOL witho... CICS 10
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts Undesired result while joining files. SYNCSORT 3
Search our Forums:

Back to Top