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

Unstring a part of the string using reference modification


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 771
Location: Germany

PostPosted: Wed Jan 17, 2007 2:57 pm
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: 3156
Location: Tucson AZ

PostPosted: Wed Jan 17, 2007 3:05 pm
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
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: 3156
Location: Tucson AZ

PostPosted: Wed Jan 17, 2007 3:28 pm
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: 771
Location: Germany

PostPosted: Wed Jan 17, 2007 3:31 pm
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
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: 3156
Location: Tucson AZ

PostPosted: Wed Jan 17, 2007 3:43 pm
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: 771
Location: Germany

PostPosted: Wed Jan 17, 2007 3:56 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top