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

How to WRITE sub pgm return data in to file in main pgm?


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

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Tue May 27, 2008 1:36 pm
Reply with quote

I am receiveing data from called program,but the data is in Index table formamt.that data variable which is specified in called program is occurs 85 times and it is return in to calling program,now i want to written the data in to output file.how do i get code it in calling program.please find the code for more understanding?

In called(sub pgm) pgm:

05 LK-HISTIRY-TABLE.
10 LK-SUB PIC 9(03).
10 LK-HISTORY-INDEX OCCURS 85 TIMES.
15 LK-IND-CNTL-TBNAME PIC X(18).

MOVE CNTL-TBL-NME TO LK-IND-CNTL-TBNAME (LK-SUB).

In Calling(main pgm) pgm :

CALL CALL-PGM USING LINKAGE-AREA.
IF GOOD-RETURN OF LINKAGE-AREA
PERFORM 85 TIMES
MOVE LK-IND-CNTL-TBNAME (LK-SUB)
TO RETURN-TB-NAME
MOVE RETURN-TB-NAME TO OUTPUT-REC
WRITE OUTPUT-REC
END-PERFORM

But i am getting only one occurence data 85 times?how do i solve this problem?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue May 27, 2008 2:03 pm
Reply with quote

babu_hi,

in the called program, i only see you addressing 1 table item.

having no idea what the sub-module does, makes it difficult to suggestion solutions.

if your intent in the sub-module is to populate the 85 items, you need some kind of processing loop which would populate each item.
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Tue May 27, 2008 2:16 pm
Reply with quote

Hi babu,

You are not increasing the LK-SUB value. Add 1 to LK-SUB within perform. I think I am right.
Back to top
View user's profile Send private message
jckraheja

New User


Joined: 19 May 2008
Posts: 13
Location: Pune

PostPosted: Tue May 27, 2008 2:53 pm
Reply with quote

YEs birdy K....U r right ... if we increased LK-SUB by 1 after RETURN-TB-NAME then problem must be get resolved....
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 Binary File format getting change whi... All Other Mainframe Topics 7
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
Search our Forums:

Back to Top