Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

In UNSTRING the delimiter "~" is not recogniz

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: In UNSTRING the delimiter "~" is not recogniz
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Jan 14, 2009 3:41 pm    Post subject:
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    Post subject: Reply to: In UNSTRING the delimiter "~" is not rec
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

Site Director


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

PostPosted: Wed Jan 14, 2009 3:55 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: In UNSTRING the delimiter "~" is not rec
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    Post subject:
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    Post subject: Reply to: In UNSTRING the delimiter "~" is not rec
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    Post subject: Reply to: In UNSTRING the delimiter "~" is not rec
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    Post subject: Reply to: In UNSTRING the delimiter "~" is not rec
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

Site Director


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

PostPosted: Wed Jan 14, 2009 11:08 pm    Post subject: Reply to: In UNSTRING the delimiter "~" is not rec
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts "DFSRRC00 vs IKJEFT01" for ... arunsoods All Other Mainframe Topics 5 Fri Aug 12, 2016 9:54 pm
No new posts Unstring list of values into an array. Roshnii COBOL Programming 8 Mon Jun 27, 2016 6:25 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us