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

In UNSTRING the delimiter "~" is not recogniz


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

New User


Joined: 26 Aug 2008
Posts: 52
Location: inida

PostPosted: Wed Jan 14, 2009 2:39 pm
Reply with quote

Hi,

I have PS file of length 500 and when ever "~" operator present i breaking the fields into sub strings but its not working.

I have given W-OUT DELIMITED BY "~" INTO VENDOR,LOCATION.
W-OUT is of length X(500) and VENDOR is of length X(20) and LOCATION is of length X(50).

But after the statement executed it copies first 20 characters of data
W-OUT into VENDOR and next 50 characters of data into LOCATION.

Why "~" is not recognizing in the UNSTRING.

Could any one help on this.

Regards
Suneel
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 14, 2009 3:06 pm
Reply with quote

We both know that if the code is correct and the data contains characters that we expect, the UNSTRING will work.

so, if it does not work, then possibly the "~" you are providing as a literal is not really the character in the string.

how are you determining that W-OUT contains a string with "~"?
Back to top
View user's profile Send private message
suneelv

New User


Joined: 26 Aug 2008
Posts: 52
Location: inida

PostPosted: Wed Jan 14, 2009 3:23 pm
Reply with quote

Hi,

Below is the example of the record

abcdefghi ~.ABC #111 - bbbbbbbbbbbb~.12/11/01 8:04:13 AM.~

i want EXample in to one field
ABC #111 - bbbbbbbbbbbb in to another field
12/11/01 8:04:13 AM. into another field.

Thanks

Suneel
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: Wed Jan 14, 2009 3:41 pm
Reply with quote

Hello,

It may help if you post the variable definitions and the complete unstring statement. . .
Back to top
View user's profile Send private message
suneelv

New User


Joined: 26 Aug 2008
Posts: 52
Location: inida

PostPosted: Wed Jan 14, 2009 3:48 pm
Reply with quote

Hi,

Here is the varible declaration and UNSTRING statement

01 W-OUTPUT-REC.
05 VENDOR PIC X(20).
05 LOCATION PIC X(50).

UNSTRING W-OUTPUT-REC DELIMITED BY "~"
INTO VENDOR,
LOCATION,

I am reading the file and writing the each record into W-OUTPU-REC and executing unstring command.

In the above just i gave 2 fields only but it contains more than 10 fields.

Thanks
Suneel
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: Wed Jan 14, 2009 3:55 pm
Reply with quote

Hello,

Unless other than the code used has been posted, the process is trying to unstring into itself. You need to unstring from one area to another, not the same one. Assuming the vendor, locaton, etc remain in the W-OUTPUT-REC, something like the following should work.

Code:
UNSTRING MY-NEW-WORK-REC DELIMITED BY "~"
    INTO VENDOR,
         LOCATION,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 14, 2009 3:59 pm
Reply with quote

This is the last time I will assume the OP has any knowledge of COBOL.
waste of time to provide an answer without knowing what chaos is going on.

feeling sorry for myself. I apologize.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 14, 2009 3:59 pm
Reply with quote

this should have been posted in the rookies forum.
Back to top
View user's profile Send private message
suneelv

New User


Joined: 26 Aug 2008
Posts: 52
Location: inida

PostPosted: Wed Jan 14, 2009 4:28 pm
Reply with quote

Hi,

I didn't get.

Regards
suneel
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 14, 2009 4:48 pm
Reply with quote

Quote:

Below is the example of the record

abcdefghi ~.ABC #111 - bbbbbbbbbbbb~.12/11/01 8:04:13 AM.~

i want EXample in to one field
ABC #111 - bbbbbbbbbbbb in to another field
12/11/01 8:04:13 AM. into another field.


it seems as if you will have 4 output fields.

abcdefghi ~ <will become> abcdefghi (the ~ will be dropped by the unstring
.ABC #111 - bbbbbbbbbbbb~ <will become> .ABC #111 - bbbbbbbbbbbb
.12/11/01 8:04:13 AM.~ <will become> .12/11/01 8:04:13 AM.
and whatever follows as the fourth.


you need a minimum of 4 output fields in your UNSTRING command.
Quote:

I didn't get


as Mr. Scherrer explained: you are unstringing a area and using the area as a receiver of the UNSTRING output. Designate output fields that are not part of the input, otherwise you are destroying your input.
Back to top
View user's profile Send private message
suneelv

New User


Joined: 26 Aug 2008
Posts: 52
Location: inida

PostPosted: Wed Jan 14, 2009 5:00 pm
Reply with quote

hI,

As per your suggesion i modified all variables as elementary data items

77 W-OUTPUT-REC PIC X(500).
77 VENDOR PIC X(20).
77 LOCATION PIC X(50).

UNSTRING W-OUTPUT-REC DELIMITED BY "~"
INTO VENDOR,
LOCATION,

I am reading the file and writing the each record into W-OUTPU-REC and unstringing the W-OUTPUT-REC into VENDOR and LOCATION.

At this time i got VENDOR and LOCATION are spaces.

Regards
Suneel
Back to top
View user's profile Send private message
suneelv

New User


Joined: 26 Aug 2008
Posts: 52
Location: inida

PostPosted: Wed Jan 14, 2009 5:26 pm
Reply with quote

Hi,

Here is the details of the variables and UNSTRING command and example of record also.

#WS

77 VENDOR PIC X(20).
77 LOCATION PIC X(50).
77 ACTIVITY-DT PIC X(19).
77 W-OUTPUT-REC PIC X(500).

#PD

UNSTRING W-OUTPUT-REC DELIMITED BY "~"
INTO VENDOR,
LOCATION,
ACTIVITY-DT,


example of record:

SECCONDDATA~.ARC #523 - LIMITED ACCESS~.12/01/08 8:04:13 AM.~

total of 3 fields and delimeter is "~"

when i execute above untstring command by using the above record
all the above 3 fields contains spaces.

Could you please tell me why it is happening.

Regards
Suneel
Back to top
View user's profile Send private message
suneelv

New User


Joined: 26 Aug 2008
Posts: 52
Location: inida

PostPosted: Wed Jan 14, 2009 5:39 pm
Reply with quote

Hi,

Its working now. i have missed "." after end of the UNSTRING.

Thanks for all your help.

Regards
Suneel
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: Wed Jan 14, 2009 11:08 pm
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

At the top of the page is a link to "IBM Manuals" and the COBOL manuals are available there. It will be to your advantage to become familiar and comfortable with those manuals. They are invaluable icon_wink.gif

d
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 PuTTY - "User is not a surrogate... IBM Tools 5
No new posts Newbie Stuck on "Duplicate Datas... TSO/ISPF 5
No new posts RABBIT HOLE NEEDED - "Live"... All Other Mainframe Topics 0
No new posts Using PARM=('JPn"&SYMBOL&quo... DFSORT/ICETOOL 2
No new posts Syncsort "Y2C" Function SYNCSORT 1
Search our Forums:

Back to Top