View previous topic :: View next topic
|
Author |
Message |
vmutyalapalli
New User
Joined: 09 Jun 2005 Posts: 5 Location: India
|
|
|
|
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 |
|
|
vmutyalapalli
New User
Joined: 09 Jun 2005 Posts: 5 Location: India
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Sorry, as far as i know: NO !
Regards, UmeySan |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
vmutyalapalli
New User
Joined: 09 Jun 2005 Posts: 5 Location: India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
vmutyalapalli
New User
Joined: 09 Jun 2005 Posts: 5 Location: India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
UmeySan wrote: |
Ashes upon my Head for not beeing uptodate,
Mea maxima culpa !!! |
Huh? |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
@ 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 |
|
|
|