Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Unstring a part of the string using reference modification

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vmutyalapalli

New User


Joined: 09 Jun 2005
Posts: 5
Location: India

PostPosted: Wed Jan 17, 2007 2:33 pm    Post subject: Unstring a part of the string using reference modification
Reply with quote

Hi,

Can we unstring a part of the record as follows using refrence modification:

Working-storage Section.

01 Record Pic x(40).

Unstring Record(1:20)
into
R1, R2, R3

I tried with this. It is saying illegal operand in unstring. Can I know is there is restrictions that we cannot use like above or are there any version restrictions??? I am using cobol 74

Thanks in Advance
Back to top
View user's profile Send private message

vmutyalapalli

New User


Joined: 09 Jun 2005
Posts: 5
Location: India

PostPosted: Wed Jan 17, 2007 2:46 pm    Post subject: Re: Unstring a part of the string using reference modificati
Reply with quote

Sorry for giving the wrong code here. there is delimited by ',' also.

So total is like this.

Working-storage Section.

01 Record Pic x(40).

Unstring Record(1:20) delimited by ','
into R1, R2, R3

Thanks


Hi,

Can we unstring a part of the record as follows using refrence modification:

Working-storage Section.

01 Record Pic x(40).

Unstring Record(1:20)
into
R1, R2, R3

I tried with this. It is saying illegal operand in unstring. Can I know is there is restrictions that we cannot use like above or are there any version restrictions??? I am using cobol 74

Thanks in Advance
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Wed Jan 17, 2007 2:57 pm    Post subject: Re: Unstring a part of the string using reference modificati
Reply with quote

Sorry, as far as i know: NO !
Regards, UmeySan
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Jan 17, 2007 3:05 pm    Post subject:
Reply with quote

You should stay in your original thread.....

The latest COBOL says:
Quote:
identifier-1
Represents the sending field. Data is transferred from this field to the data receiving fields (identifier-4).
It must be an alphanumeric data item.
As an IBM extension, identifier-1 can be reference-modified. It can be an alphanumeric-edited or an alphabetic data item. It can also be a DBCS data item.
so unless your COBOL supports the IBM extention, you are out of luck.
You can always move that part of the data by RM to another elementry item and unstring it from there.

Hope that helps,

Bill
Back to top
View user's profile Send private message
vmutyalapalli

New User


Joined: 09 Jun 2005
Posts: 5
Location: India

PostPosted: Wed Jan 17, 2007 3:15 pm    Post subject: Re: Unstring a part of the string using reference modificati
Reply with quote

Thanks Umeysam and Thompson for the replies.

As i have read it can be RM, i have tried giving directly in unstring. But it didnt work.

Then, I have tried moving the same into another field. But here, the problem is I dont know exactly till which postion i have to move. it is variable. sometimes it is 20 and sometimes it is not.

Hope i am clear in explaining the problem.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Jan 17, 2007 3:28 pm    Post subject: Re: Unstring a part of the string using reference modificati
Reply with quote

vmutyalapalli wrote:
I have tried moving the same into another field. But here, the problem is I dont know exactly till which postion i have to move. it is variable. sometimes it is 20 and sometimes it is not.
How do/did you determine it was 20 this time?
Once you know the length, RM move to a temporary area and unstring it.
Or redefine the area as a variable array depending on the determined length and unstring that.

Bill
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Wed Jan 17, 2007 3:31 pm    Post subject:
Reply with quote

Oh Bill,

Ashes upon my Head for not beeing uptodate,
Mea maxima culpa !!!

Your right, I just testet it.

LINKAGE EDITOR: * OK *


UNSTRING WRK-VERWENDTX (01:10) DELIMITED BY '*'
INTO DATA-VERW-ZWECK-D IN UMSATZ-BEREICH
COUNT IN DATA-VERW-ZWECK-L IN UMSATZ-BEREICH
END-UNSTRING

UmeySan
Also thank's for learning a bit more.
Back to top
View user's profile Send private message
vmutyalapalli

New User


Joined: 09 Jun 2005
Posts: 5
Location: India

PostPosted: Wed Jan 17, 2007 3:42 pm    Post subject: Re: Unstring a part of the string using reference modificati
Reply with quote

Umey, U r using RM in unstring again. if that works no need of count again, no?

Can we declare a field with variable length?? i mean for now i want x(20) as exact length and next time, it can be x(25)

As i want to skip the spaces in the last of every record, i need like above.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Jan 17, 2007 3:43 pm    Post subject:
Reply with quote

UmeySan wrote:
Ashes upon my Head for not beeing uptodate,
Mea maxima culpa !!!
icon_question.gif Huh? icon_question.gif
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Wed Jan 17, 2007 3:56 pm    Post subject:
Reply with quote

@ vmutyalapalli !

In that example i'm using count for having the length of the string
in a separate field which i use later. Count is optional.

Also works:

Move Field-A (Position:Length) to Field-B where Position & length
are variables.

@Bill !
I don't understand your footnote.

Regards, UmeySan
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us