Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to WRITE sub pgm return data in to file in main pgm?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to WRITE sub pgm return data in to file in main pgm?
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: 6970
Location: porcelain throne

PostPosted: Tue May 27, 2008 2:03 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: How to WRITE sub pgm return data in to file in mai
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    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 Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us