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
 

 

String the elements of a COBOL Table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: String the elements of a COBOL Table
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: 2360
Location: Israel

PostPosted: Mon Jan 21, 2008 1:54 pm    Post subject:
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    Post subject: Reply to: strings in cobol
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: 2360
Location: Israel

PostPosted: Mon Jan 21, 2008 2:19 pm    Post subject:
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    Post subject: Reply to: strings in cobol
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: 755
Location: Germany

PostPosted: Mon Jan 21, 2008 2:51 pm    Post subject:
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    Post subject: Reply to: strings in cobol
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    Post subject:
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    Post subject:
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    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 Loading data to table gives wrong for... Raghu navaikulam DB2 18 Thu Jul 13, 2017 2:11 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am


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