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

String the elements of a COBOL Table


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

New User


Joined: 09 Nov 2006
Posts: 21

PostPosted: Mon Jan 21, 2008 1:34 pm
Reply with quote

I have a table..with ten elements in it. i need to string all of them and
put it in a record

i am trying but no much progress
can any body helpa
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Jan 21, 2008 1:54 pm
Reply with quote

Can you show us what have you tried so far?

O.
Back to top
View user's profile Send private message
mvmadhavi

New User


Joined: 09 Nov 2006
Posts: 21

PostPosted: Mon Jan 21, 2008 2:13 pm
Reply with quote

PERFORM VARYING X1 FROM 1 BY 1 UNTIL X1 > W-COUNT
STRING W-XML-REC
',AKSJON=' W-TJKD-READ (X1)
';'
DELIMITED BY SIZE
INTO W-XML-REC
END-STRING

end-perform
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Jan 21, 2008 2:19 pm
Reply with quote

...and the problem is....?

O.
Back to top
View user's profile Send private message
mvmadhavi

New User


Joined: 09 Nov 2006
Posts: 21

PostPosted: Mon Jan 21, 2008 2:34 pm
Reply with quote

The problem is i am not able get all 10 elements in table in the record.
only the last one is written.

each time in the loop the previous is overwritten
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon Jan 21, 2008 2:51 pm
Reply with quote

Hi mvmadhavi !

I think you have to use String-Command with the Pointer-Option for stringing them one after the other into a line.

Regards, UmeySan


Example:

Move 01 to Li-Pos ...output position
Set Fi-Ind to 1 ....input index

Loop-Start

STRING Field-01(Fi-Ind) DELIMITED BY SIZE
INTO WRK-TEXT-LINE(Li-Ind)
WITH POINTER Li-Pos
END-STRING

COMPUTE Li-Pos = (Li-Pos+ 1) END-COMPUTE

Set Fi-ind up by 1

Loop-Stopp
Back to top
View user's profile Send private message
mvmadhavi

New User


Joined: 09 Nov 2006
Posts: 21

PostPosted: Mon Jan 21, 2008 6:49 pm
Reply with quote

Thanks! it works : icon_smile.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jan 21, 2008 7:50 pm
Reply with quote

If I'm reading you correctly, the easy way is to move the 01 level (or the level directly above the level w/the 1st occurs clause), assocaited w/the table, to your O/P field.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Mon Jan 21, 2008 9:14 pm
Reply with quote

as far as i understand your situation, i don't think there is any need of stringing the dataitems of the table into some other dataitem. you can directly use the table defining item which is having the OCCURS clause for the table to get the data of all the dataitems together.
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 Load new table with Old unload - DB2 DB2 6
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top